Monday, July 8, 2013

SNMP: on Solaris

Oracle Solaris 11

# svcadm enable svc:/application/management/net-snmp:default
# svcadm stop svc:/application/management/net-snmp:default

# vi /etc/net-snmp/snmp/snmpd.conf

Oracle Solaris 10
# vi /etc/sma/snmp/snmpd.conf
syslocation Toronto
syscontact Sysadmin (aniu@goweekend.ca)

# SNMP v3

createUser cactiadmin MD5 think4me DES
group groupv3             usm      cactiadmin
view    all included   .iso      80
access groupv3         ""        any       auth      exact    all         all        all

 
# svcadm restart svc:/application/management/sma:default
#  snmpget -v 3 -l AuthNoPriv -u cactiadmin -A <password> 137.15.20.7 sysName.0

SNMPv2-MIB::sysName.0 = STRING: taihu.goweekend.ca



Example for ZFS Monitoring

syslocation NewYork
syscontact Sysadmin ()



# SNMP v3

createUser cacti MD5 password DES
group groupv3             usm      cactiuser
view    all included   .iso      80
access groupv3         ""        any       auth      exact    all         all        all

extend .1.3.6.1.4.1.2021.88 zpool_name /bin/bash -c "zpool list -H -o name"
extend .1.3.6.1.4.1.2021.88 zpool_snap /bin/bash -c "zpool list -Ho name|for zpool in `xargs`;do zfs get -rHp -o value usedbysnapshots $zpool|awk -F: '{sum+=$1} END{print sum}';done"
extend .1.3.6.1.4.1.2021.88 zpool_used /bin/bash -c "zpool list -Ho name|xargs zfs get -Hp -o value used"
extend .1.3.6.1.4.1.2021.88 zpool_data_used /bin/bash -c "zpool list -Ho name|for zpool in `xargs`;do snap=`zfs get -rHp -o value usedbysnapshots $zpool|awk -F: '{sum+=$1} END{print sum}'`;pool=`zfs get -Hp -o value used $zpool`; echo $pool $snap|awk '{print (\$1-\$2);}';done"
extend .1.3.6.1.4.1.2021.88 zpool_available /bin/bash -c "zpool list -Ho name|xargs zfs get -Hp -o value available"
extend .1.3.6.1.4.1.2021.88 zpool_capacity /bin/bash -c "zpool list -H -o capacity"

 

No comments:

Post a Comment