Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
SIZES="SELECT relname AS objectname,
relkind AS objecttype,
reltuples AS "entries", pg_size_pretty(relpages::bigint*8*1024) AS size
FROM pg_class
WHERE relpages >= 8
ORDER BY relpages DESC;"
#!/bin/bash
TABLE_COUNTS="select count(*) as foreman_tasks_tasks from foreman_tasks_tasks;
select count(*) as foreman_tasks_locks from foreman_tasks_locks;
select count(*) as dynflow_execution_plans from dynflow_execution_plans;
select count(*) as dynflow_actions from dynflow_actions;
select count(*) as dynflow_steps from dynflow_steps;"
echo ""
echo "Table counts :"
<pre><font color="#06989A"><b>Upgrade Step: correct_repositories (this may take a while) ...</b></font>
<font color="#CC0000"><b>rake aborted!</b></font>
<font color="#CC0000"><b>Not all the services have been started. Check the status report above and try again.</b></font>
<font color="#CC0000"><b>/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.158/lib/katello/tasks/reimport.rake:8:in `block (2 levels) in &lt;top (required)&gt;&apos;</b></font>
<font color="#CC0000"><b>Tasks: TOP =&gt; katello:correct_repositories =&gt; katello:check_ping</b></font>
<font color="#CC0000"><b>(See full trace by running task with --trace)</b></font>
<font color="#CC0000"><b>{:status=&gt;&quot;FAIL&quot;,</b></font>
<font color="#CC0000"><b> :services=&gt;</b></font>
<font color="#CC0000"><b> {:pulp=&gt;{:status=&gt;&quot;ok&quot;, :duration_ms=&gt;&quot;46&quot;},</b></font>
<font color="#CC0000"><b> :pulp_auth=&gt;{:status=&gt;&quot;ok&quot;, :duration_ms=&gt;&quot;57&quot;},</b></font>
@mccun934
mccun934 / gist:424daee4f2edb7c6850fc25ffb6e3346
Last active January 24, 2018 17:48
Upgrade just candlepin
1) stop services:
# katello-service stop
# systemctl start postgresql
2) Upgrade RPMs
# yum update candlepin candlepin-tomcat candlepin-selinux
3) Update the candlepin database:
@mccun934
mccun934 / enable-pcp.bash
Last active January 12, 2018 14:59
Enable PCP
yum -y install pcp pcp-system-tools
systemctl start pmcd pmlogger
systemctl enable pmcd pmlogger
subscription-manager repos --enable rhel-7-server-optional-rpms
yum -y install pcp-webapi pcp-webapp-grafana \
pcp-webapp-graphite pcp-webapp-vector
systemctl start pmwebd
@mccun934
mccun934 / task-cleanup-61.bash
Last active December 11, 2017 17:15
Cleanup tasks older than 5 days on Satellite 6.1
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
# This will delete all tasks and associated task data from anything older than
# the number of days specified below defaulting to 120 days.
#DAYS_AGO=120
DAYS_AGO=16
echo ""
echo "DELETING All tasks and associated data from [$DAYS_AGO] days ago"
@mccun934
mccun934 / gencerts.sh
Created November 14, 2017 20:10 — forked from JacobCallahan/gencerts.sh
Satellite certificate generator script
#! /bin/bash
git clone https://github.com/iNecas/ownca.git
cd ownca
yes "" | ./generate-ca.sh
yes | ./generate-crt.sh $(hostname)
certdir="$(pwd)/$(hostname)/"
cp cacert.crt $(hostname)/
cd $(hostname)
katello-certs-check -c "$(hostname).crt" -k "$(hostname).key" -r "$(hostname).crt.req" -b cacert.crt
@mccun934
mccun934 / debugging_errata.md
Created November 8, 2017 14:38 — forked from jlsherrill/debugging_errata.md
debugging errata issues

Run all of these in 'foreman-rake console'

Check the event queue:

Katello::Event.count

Check 'bound repositories' known to katello

Please update router settings on Satellite and each Capsule as follows:
(1) In /etc/qpid-dispatch/qdrouterd.conf add the 2 new entries for helloInterval and helloMaxAge:
router {
mode: interior
router-id: satellite.example.com
helloInterval: 10
helloMaxAge: 30
}
@mccun934
mccun934 / gist:9812bd11fa985582bb63e7e7f06fc442
Created October 25, 2017 18:35
increase qpid dispatch timeout
Please update router settings on Satellite and each Capsule as follows:
In /etc/qpid-dispatch/qdrouterd.conf :
router {
mode: interior
router-id: satellite.example.com
helloInterval: 10
helloMaxAge: 30