Disk Space Monitoring on Windows & Unix Systems

Monitor Disk Space on Windows, Linux/Unix hosts using SNMP

USAGE  === ./checkDisksviaSNMP.sh <community-string> <remote-server> <mib-oid-name> <warning> <critical> <option> <pattern>
 
Monitor only these directories '/u10 |/u12 |/u16 '

    MODEL1 === ./checkDisksviaSNMP.sh public prod01.blah.net HOST-RESOURCES-MIB::hrStorage 30 90 -IFS '/u10|/u12|/u16'
 
Exclude directories with common name '/oradata/CDR'

    MODEL2 === ./checkDisksviaSNMP.sh public prod01.blah.net HOST-RESOURCES-MIB::hrStorage 30 90 -ECFS '/oradata/CDR'
 
Monitor all disk partitions - no exceptions

    MODEL3 === ./checkDisksviaSNMP.sh public prod01.blah.net HOST-RESOURCES-MIB::hrStorage 30 90 -AFS /
 
Monitor only this specific filesystem '/'

    MODEL4 === ./checkDisksviaSNMP.sh public prod01.blah.net HOST-RESOURCES-MIB::hrStorage 30 90 -PFS /
 
Monitor everything except for this specific filesystem '/'

    MODEL5 === ./checkDisksviaSNMP.sh public prod01.blah.net HOST-RESOURCES-MIB::hrStorage 30 90 -EPFS /
 
( PERCENTAGE )  ===  To alert on ( PERCENTAGE ) of disk usage, use options -I, -EC, -A, -P or -EP
 
( FREE SIZE )   ===  To alert on ( FREE SIZE ) of disk usage, use options -IFS, -ECFS, -AFS, -PFS or -EPFS
[root@dgphx001 ~]#
[root@dgphx001 ~]#
[root@dgphx001 ~]# time ./check_disks_via_snmp.sh monitoringtest dgphx002.phx.kinglazy.dev HOST-RESOURCES-MIB::hrStorage 95 99 -E '/home'
CRITICAL: [  Cached_memory: size(0.61),usage(0.61),pct(100%)  ]. Threshold: [ 99% ]. 

real    0m0.614s
user    0m0.012s
sys     0m0.027s
[root@dgphx001 ~]# time ./check_disks_via_snmp.sh monitoringtest dgphx002.phx.kinglazy.dev HOST-RESOURCES-MIB::hrStorage 95 99 -E '/home|Cached.*memory'
OK: [ W=95% / C=99% ]. [ Physical_memory: size(3.74),usage(2.68),pct(71.63%) Virtual_memory: size(7.74),usage(2.69),pct(34.67%) Memory_buffers: size(3.74),usage(0.23),pct(6.07%) Swap_space: size(4),usage(0),pct(0.08%) /: size(3.94),usage(1.62),pct(41.16%) /dev/shm: size(1.87),usage(0),pct(0%) /boot: size(0.24),usage(0.04),pct(14.81%) /opt: size(3.94),usage(0.86),pct(21.74%) /tmp: size(0.98),usage(0.03),pct(3.3%) /var: size(1.97),usage(0.44),pct(22.4%) /var/audit: size(0.49),usage(0.33),pct(66.47%) /var/log: size(1.97),usage(0.14),pct(7.06%)  ]. 

real    0m0.558s
user    0m0.011s
sys     0m0.023s
[root@dgphx001 ~]# time ./check_disks_via_snmp.sh monitoringtest dgphx002.phx.kinglazy.dev HOST-RESOURCES-MIB::hrStorage 95 99 -E '/home|Cached.*memory|Physical.*memory'
OK: [ W=95% / C=99% ]. [ Virtual_memory: size(7.74),usage(2.69),pct(34.67%) Memory_buffers: size(3.74),usage(0.23),pct(6.07%) Swap_space: size(4),usage(0),pct(0.08%) /: size(3.94),usage(1.62),pct(41.16%) /dev/shm: size(1.87),usage(0),pct(0%) /boot: size(0.24),usage(0.04),pct(14.81%) /opt: size(3.94),usage(0.86),pct(21.74%) /tmp: size(0.98),usage(0.03),pct(3.3%) /var: size(1.97),usage(0.44),pct(22.39%) /var/audit: size(0.49),usage(0.33),pct(66.47%) /var/log: size(1.97),usage(0.14),pct(7.06%)  ]. 

real    0m0.514s
user    0m0.011s
sys     0m0.020s
[root@dgphx001 ~]#
[root@dgphx001 ~]#
[root@dgphx001 ~]# time ./check_disks_via_snmp.sh monitoringtest dgphx002.phx.kinglazy.dev HOST-RESOURCES-MIB::hrStorage 95 99 -E '/home|(Cached|Physical).*memory'
OK: [ W=95% / C=99% ]. [ Virtual_memory: size(7.74),usage(2.69),pct(34.67%) Memory_buffers: size(3.74),usage(0.23),pct(6.07%) Swap_space: size(4),usage(0),pct(0.08%) /: size(3.94),usage(1.62),pct(41.16%) /dev/shm: size(1.87),usage(0),pct(0%) /boot: size(0.24),usage(0.04),pct(14.81%) /opt: size(3.94),usage(0.86),pct(21.74%) /tmp: size(0.98),usage(0.03),pct(3.3%) /var: size(1.97),usage(0.44),pct(22.39%) /var/audit: size(0.49),usage(0.33),pct(66.47%) /var/log: size(1.97),usage(0.14),pct(7.06%)  ]. 

real    0m0.516s
user    0m0.009s
sys     0m0.022s
[root@dgphx001 ~]#
[root@dgphx001 ~]#
[root@dgphx001 ~]# time ./check_disks_via_snmp.sh monitoringtest dgphx002.phx.kinglazy.dev HOST-RESOURCES-MIB::hrStorage 95 99 -E '/home|(Cached|Physical).*memory|Swap.*space'
OK: [ W=95% / C=99% ]. [ Virtual_memory: size(7.74),usage(2.69),pct(34.67%) Memory_buffers: size(3.74),usage(0.23),pct(6.07%) /: size(3.94),usage(1.62),pct(41.16%) /dev/shm: size(1.87),usage(0),pct(0%) /boot: size(0.24),usage(0.04),pct(14.81%) /opt: size(3.94),usage(0.86),pct(21.74%) /tmp: size(0.98),usage(0.03),pct(3.3%) /var: size(1.97),usage(0.44),pct(22.39%) /var/audit: size(0.49),usage(0.33),pct(66.47%) /var/log: size(1.97),usage(0.14),pct(7.06%)  ].

real    0m0.473s
user    0m0.010s
sys     0m0.019s
[root@dgphx001 ~]#
[root@dgphx001 ~]#
[root@dgphx001 ~]# time ./check_disks_via_snmp.sh monitoringtest dgphx002.phx.kinglazy.dev HOST-RESOURCES-MIB::hrStorage 95 99 -E '/home|(Cached|Physical).*memory|Swap.*space|/dev/shm'
OK: [ W=95% / C=99% ]. [ Virtual_memory: size(7.74),usage(2.69),pct(34.67%) Memory_buffers: size(3.74),usage(0.23),pct(6.07%) /: size(3.94),usage(1.62),pct(41.16%) /boot: size(0.24),usage(0.04),pct(14.81%) /opt: size(3.94),usage(0.86),pct(21.74%) /tmp: size(0.98),usage(0.03),pct(3.3%) /var: size(1.97),usage(0.44),pct(22.39%) /var/audit: size(0.49),usage(0.33),pct(66.47%) /var/log: size(1.97),usage(0.14),pct(7.06%)  ]. 
USAGE  === ./checkDisksviaSNMP.sh <community-string> <remote-server> <mib-oid-name> <warning> <critical> <option> <pattern>
 
Monitor only these directories '/u10 |/u12 |/u16 '

    MODEL1 === ./checkDisksviaSNMP.sh public prod01.blah.net HOST-RESOURCES-MIB::hrStorage 30 90 -IFS '/u10|/u12|/u16'
 
Exclude directories with common name '/oradata/CDR'

    MODEL2 === ./checkDisksviaSNMP.sh public prod01.blah.net HOST-RESOURCES-MIB::hrStorage 30 90 -ECFS '/oradata/CDR'
 
Monitor all disk partitions - no exceptions

    MODEL3 === ./checkDisksviaSNMP.sh public prod01.blah.net HOST-RESOURCES-MIB::hrStorage 30 90 -AFS /
 
Monitor only this specific filesystem '/'

    MODEL4 === ./checkDisksviaSNMP.sh public prod01.blah.net HOST-RESOURCES-MIB::hrStorage 30 90 -PFS /
 
Monitor everything except for this specific filesystem '/'

    MODEL5 === ./checkDisksviaSNMP.sh public prod01.blah.net HOST-RESOURCES-MIB::hrStorage 30 90 -EPFS /
 
( PERCENTAGE )  ===  To alert on ( PERCENTAGE ) of disk usage, use options -I, -EC, -A, -P or -EP
 
( FREE SIZE )   ===  To alert on ( FREE SIZE ) of disk usage, use options -IFS, -ECFS, -AFS, -PFS or -EPFS