Skip to content

Instantly share code, notes, and snippets.

@mowings
mowings / ata.md
Created October 16, 2020 18:32
Get block device associated with ata channel (slot)
# ls -l /sys/block/sd*`
lrwxrwxrwx 1 root root 0 Oct  8 21:20 /sys/block/sda -> ../devices/pci0000:00/0000:00:17.0/ata1/host0/target0:0:0/0:0:0:0/block/sda
lrwxrwxrwx 1 root root 0 Oct  8 21:20 /sys/block/sdb -> ../devices/pci0000:00/0000:00:17.0/ata3/host2/target2:0:0/2:0:0:0/block/sdb
lrwxrwxrwx 1 root root 0 Oct  8 21:20 /sys/block/sdc -> ../devices/pci0000:00/0000:00:17.0/ata4/host3/target3:0:0/3:0:0:0/block/sdc
@mowings
mowings / cpu frequency.txt
Last active October 10, 2020 18:48
Watch cpu core frequency in real time
watch -n.1 "cat /proc/cpuinfo | grep \"^[c]pu MHz\""
@mowings
mowings / collectd.md
Created October 7, 2020 15:16
See what collectd is transmitting to a remote carbon server

The simplest way to do this is to use tcpdump and grep the part of the metric you are interested in. For example:

tcpdump -A port 2003 | grep interface # Show what merics are being sent with "interface" in the name

@mowings
mowings / ilo-ssh.md
Last active September 24, 2020 15:25
ssh in to ilo

ssh <ilo-user>@ilo-addr Commands:

HP CLI Commands:

POWER    : Control server power.
UID      : Control Unit-ID light.
NMI      : Generate an NMI.
VM       : Virtual media commands.
VSP : Invoke virtual serial port.
@mowings
mowings / pg9.sql
Created September 18, 2020 18:06
Postgres 9 active queries
select pid, datname, client_addr, age(clock_timestamp(), query_start), query from pg_stat_activity where state = 'active';
@mowings
mowings / readme.txt
Last active September 16, 2020 17:35
Get an HP DL60 Server to boot from root sata drive
RBSU > Storage Options > SATA Controller -> AHCI Mode
RBSU > Boot Options -> UEFIBoot Options > UEFI boot order -> push sat device to top
There may be a way to disable netboot altogether, but I have not been able to find it. Maybe "delete uefi boot option"
@mowings
mowings / readme.md
Created September 11, 2020 16:01
kubectl -- get pods last completion status

Useful for finding OOMKilled pods

kubectl get pods -A -o custom-columns=NAME:.metadata.name,REASON:..lastState..reason

@mowings
mowings / nfs-exports.md
Last active September 2, 2020 21:29
reload nfs exports, show which nfs volumes are mounted
# exportfs -ra
# showmount -e localhost
Export list for localhost:
/mnt/foo     *
/mnt/bar *
@mowings
mowings / reload-config-postgresql.md
Created August 25, 2020 13:41 — forked from tralston/reload-config-postgresql.md
[Reload PostgreSQL config] After updating pg_hba.conf or postgresql.conf, the server needs the config needs to be reloaded. #postgres

After updating pg_hba.conf or postgresql.conf, the server needs the config needs to be reloaded. The easiest way to do this is by restarting the postgres service:

service postgresql restart

When the service command is not available (no upstart on Synology NAS, for example), there are some more creative ways to reload the config. Note this first one needs to be done under the user that runs postgres (usually the user=postgres).

user#  sudo su postgres
postgres#  pg_ctl reload
@mowings
mowings / restart.sh
Created August 10, 2020 16:06
Force kube-proxy restart on a node -- one liner
docker ps | grep kube-proxy_kube-proxy | awk '{ print $1}' | xargs docker stop