random musings from a twisted mind
snmp
SNMP over SSH tunnels
Oct 3rd
Sometimes you just need to tunnel UDP based protocols – such as SNMP – and the easiest ways is to use socat
socat tcp4-listen:6667,reuseaddr,fork UDP:DESTINATION:161
socat udp4-listen:161,reuseaddr,fork tcp:localhost:6667
And in combination with your normal SSH tunnel
ssh -L6667:localhost:6667 BASTION_HOST
growing disks in macos
Feb 20th
I have 4 disks that are currently :-
320GB macos boot disk
320GB time machine
500GB mirrored data
500GB mirrored data
Running out of space on my mirrored data volume, so just upgrading it with a pair of 1.5TB drives, and so a little bit of a shell game… well I’m cheating and using ZFS as well, so here’s what I’m doing:-
$ diskutil disk1
$ sudo zpool replace disk0s2 disk1s2
wait for resilver to complete
greebo:~ mike$ zpool status
pool: pool1
state: ONLINE
status: One or more devices is currently being resilvered. The pool will
continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scrub: resilver in progress, 20.39% done, 3h9m to go
config:
NAME STATE READ WRITE CKSUM
pool1 ONLINE 0 0 0
mirror ONLINE 0 0 0
disk2s2 ONLINE 0 0 0
replacing ONLINE 0 0 0
disk0s2 ONLINE 0 0 0
disk1s2 ONLINE 0 0 0
Move boot disk onto newly freed up drive using ASR
greebo:~ mike$ sudo asr restore --source / --target /Volumes/greebo/
Password:
Validating target...done
Validating source...done
Validating sizes...done
Copying ....10....20....30....40....50....60....70....80....90
swap original boot drive (320GB) with a new 1.5TB drive and then repeat the zpool replace command
sudo zpool replace disk2s2 disk3s2
wait for the final resilver to complete and then export/import the pool to grow it.
$ sudo zpool export pool1
$ sudo zpool import pool1
Now we have spare space!
# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
pool1 1.36T 407G 989G 29% ONLINE -
argh, SNMP can really chafe!
Sep 26th
Using version 1:
% snmpget -c COMMSTRING -M /usr/local/share/snmp/mibs -v 1 -m
USAGE-MIB:PROXY-MIB:REDLINE-STATS-MIB:REDLINE-STATS-MIB:REDLINE-CONFIG-M
IB hostname REDLINE-STATS-MIB::sessActive.0 Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: REDLINE-STATS-MIB::sessActive.0
Using version 2 (2c):
% snmpget -c COMMSTRING -M /usr/local/share/snmp/mibs -v 2c -m
USAGE-MIB:PROXY-MIB:REDLINE-STATS-MIB:REDLINE-STATS-MIB:REDLINE-CONFIG-M
IB hostname REDLINE-STATS-MIB::sessActive.0
REDLINE-STATS-MIB::sessActive.0 = Counter64: 12247
Slightly annoying that – but makes certain sense
solaris zone utilisation via SNMP
Sep 8th
It’s been a bug-bear for a long time for me that the CPU metrics when querying a Solaris 10 host are global and not zone specific (which of course makes sense, just makes it harder to track zone utilisation).
So finally wrote a basic perl script that will provide that information via a SNMP mib, output looks like the following:
> snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255.7
UCD-SNMP-MIB::ucdavis.255.7.0 = STRING: "Zone name"
UCD-SNMP-MIB::ucdavis.255.7.1 = STRING: "global"
UCD-SNMP-MIB::ucdavis.255.7.2 = STRING: "gallery"
UCD-SNMP-MIB::ucdavis.255.7.3 = STRING: "nakos"
UCD-SNMP-MIB::ucdavis.255.7.4 = STRING: "mcdougallfamily"
UCD-SNMP-MIB::ucdavis.255.7.5 = STRING: "shared"
UCD-SNMP-MIB::ucdavis.255.7.6 = STRING: "packer"
UCD-SNMP-MIB::ucdavis.255.7.7 = STRING: "si"
Script is available at here
Current bugs/issues
# snmpwalk will not step through all the sub-trees