Need help in PERL SCRIPT for Nagiosgraph

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
shean71
Posts: 10
Joined: Fri Mar 25, 2011 9:14 am

Need help in PERL SCRIPT for Nagiosgraph

Post by shean71 »

I change all Nagios standard check to Nagios SNMP Check.
In Nagiosgraph, only CPU Load showing the correct graph.
Maybe only the /output of CPU Load match with Nagiod output.

Anyone can help to check the perl regular expression for /output as following?


# Nagios plugin: check_snmp_load.pl
# Nagios output: 8 CPU, average load 1.0% < 98% : OK
# ---------------------------------------------------------------------
/output:(\d+ CPU),.*load (\d+\.\d+)\% ([0-9]+)\% : /
and push @s, [ $1, [avg1min, GAUGE, $2 ] ];



# Nagios plugin: check_snmp_mem.pl
# Nagios output: RAM Used: 13%, SWAP Used: 0% : : OK
# ---------------------------------------------------------------------
#/output:RAM Used : (\d+)\%, SWAP Used : (\d+)\% : /
/output:(RAM Used: (\d+)\.), (SWAP Used: (.*) /
and push @s, [ memory,
[ ram, GAUGE, $1 ],
[ swap, GAUGE, $2 ] ];



# Nagios plugin: check_snmp_storage
# Nagios output: Physical Memory: 13%used(2113MB/16384MB) (<90%) : OK
# ---------------------------------------------------------------------
/output:(.*Memory:) (.*) (.*) : (.*) /
and push @s, [ $1, [ pctused, GAUGE, $2 ] ];



# Nagios plugin: check_ping
# Nagios output: PING OK - Packet loss = 0%, RTA = 0.29 ms
# ---------------------------------------------------------------------
/output:PING.*?(\d+)%.+?([.\d]+)\sms/
and push @s, [ ping,
[ losspct, GAUGE, $1 ],
[ rta, GAUGE, $2/1000 ] ];



# Nagios plugin: check_snmp_storage
# Nagios output: /dev/shm: 0%used(0MB/3915MB) (<90%) : OK
# ---------------------------------------------------------------------
/output:.*: (\d+)\%used\((\d+).*B\/(\d+).*B\) (.*)\% : (.*)/
and push @s, [ "$1", [ pctused, GAUGE, $2 ] ];



# Nagios plugin: check_snmp_storage
# Nagios output: T: Label:TempDB Serial Number d0ed6366: 2%used(118MB/5000MB) (<90%) : OK
# ---------------------------------------------------------------------
/output:.*: (.*: Label:.*: (\d+)\%used\((\d+).B\/(\d+).B\) (.*)\% : .*/
and push @s, [ "$1_drive", [ pctused, GAUGE, $2 ] ];
Thanks & Regards,
SHEAN
Locked