snmp
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
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-MIB \ 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-MIB \ hostname REDLINE-STATS-MIB::sessActive.0 REDLINE-STATS-MIB::sessActive.0 = Counter64: 12247 Slightly annoying that - but makes certain sense
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.