From 940eef887f5142d980c91e95193e102c41d18808 Mon Sep 17 00:00:00 2001 From: "Bala.FA" Date: Thu, 13 Mar 2014 17:01:12 +0530 Subject: all: import plugins/templates/config from github All plugins/templates/config are imported from https://github.com/gluster-rhsc/nagios-plugin.git Change-Id: Icbbf23c0595e2b36548015489341d9ff823bac50 Signed-off-by: Bala.FA Reviewed-on: https://cuckoo.blr.redhat.com:8443/6 --- templates/Makefile.am | 12 +++++ templates/check_cpu_multicore.php | 102 +++++++++++++++++++++++++++++++++++++ templates/check_disk_and_inode.php | 69 +++++++++++++++++++++++++ templates/check_interfaces.php | 53 +++++++++++++++++++ templates/check_memory.php | 59 +++++++++++++++++++++ templates/check_swap_usage.php | 41 +++++++++++++++ 6 files changed, 336 insertions(+) create mode 100644 templates/Makefile.am create mode 100644 templates/check_cpu_multicore.php create mode 100644 templates/check_disk_and_inode.php create mode 100644 templates/check_interfaces.php create mode 100644 templates/check_memory.php create mode 100644 templates/check_swap_usage.php (limited to 'templates') diff --git a/templates/Makefile.am b/templates/Makefile.am new file mode 100644 index 0000000..ccd3006 --- /dev/null +++ b/templates/Makefile.am @@ -0,0 +1,12 @@ +pnp4nagiostemplatedir = $(datarootdir)/nagios/html/pnp4nagios/templates.dist +pnp4nagiostemplate_DATA = \ + check_cpu_multicore.php \ + check_disk_and_inode.php \ + check_interfaces.php \ + check_memory.php \ + check_swap_usage.php \ + $(NULL) + +EXTRA_DIST = \ + $(pnp4nagiostemplate_DATA) \ + $(NULL) diff --git a/templates/check_cpu_multicore.php b/templates/check_cpu_multicore.php new file mode 100644 index 0000000..0cb3942 --- /dev/null +++ b/templates/check_cpu_multicore.php @@ -0,0 +1,102 @@ +1) + +for( $cpu_n=0; $cpu_n<$no_cpu; $cpu_n++) { + $def[$def_n]=''; + $ds_name[$def_n] = "CPU Utlilization for core: $cpu_n"; + $opt[$def_n] = "--vertical-label \"% Usage\" --lower-limit 0 --upper-limit 100 --title \"CPU for $hostname / $servicedesc\" --slope-mode -N"; + + $index_of_threshold_val = $index; + $def[$def_n] = "DEF:total_cpu_in=$RRDFILE[$index]:$DS[$index]:AVERAGE " ; + $index += 1; + $def[$def_n] .= "DEF:system_cpu_in=$RRDFILE[$index]:$DS[$index]:AVERAGE " ; + $index += 1; + $def[$def_n] .= "DEF:user_cpu_in=$RRDFILE[$index]:$DS[$index]:AVERAGE " ; + $index += 1; + $def[$def_n] .= "DEF:idle_cpu_in=$RRDFILE[$index]:$DS[$index]:AVERAGE " ; + $index += 1; + + $def[$def_n] .= "CDEF:user_cpu_out=user_cpu_in "; + $def[$def_n] .= "LINE1:user_cpu_out#0000FF:\"User\t\t\" "; + $def[$def_n] .= rrd::gprint("user_cpu_out", array("LAST", "AVERAGE", "MAX"), "%6.2lf%%"); + + $def[$def_n] .= rrd::cdef("system_cpu_out", "system_cpu_in"); + $def[$def_n] .= "LINE1:system_cpu_out#008000:\"System\t\" "; + $def[$def_n] .= rrd::gprint("system_cpu_in", array("LAST", "AVERAGE", "MAX"), "%6.2lf%%"); + + $def[$def_n] .= rrd::cdef("total_cpu_out", "total_cpu_in"); + $def[$def_n] .= "LINE1:total_cpu_out#800079:\"Total\t\t\" "; + $def[$def_n] .= rrd::gprint("total_cpu_in", array("LAST", "AVERAGE", "MAX"), "%6.2lf%%"); + + if ($WARN[$index_of_threshold_val] != ""){ + $def[$def_n] .= "LINE2:$WARN[$index_of_threshold_val]#FFFF00:\"Warning\\n\" "; + } + if ($CRIT[$index_of_threshold_val] != ""){ + $def[$def_n] .= "LINE2:$CRIT[$index_of_threshold_val]#FF0000:\"Critical\\n\" "; + } + $def_n++; +} +?> diff --git a/templates/check_disk_and_inode.php b/templates/check_disk_and_inode.php new file mode 100644 index 0000000..3185544 --- /dev/null +++ b/templates/check_disk_and_inode.php @@ -0,0 +1,69 @@ +DS as $KEY=>$VAL) { + if ($i == 0) { + $VAL['NAME'] = str_replace("_","/",$VAL['NAME']); + $ds_name[$KEY] = "Disk Utilization"; + $name[$KEY] = "Disk Utilization for mount: " . $VAL['NAME']; + + # set graph labels + $opt[$KEY] = "--vertical-label \"% Usage\" --lower-limit 0 --upper-limit 100 --title \"$name[$KEY]\" "; + # Graph Definitions + $def[$KEY] = rrd::def( "var1", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE" ); + + # disk graph rendering + if ($VAL['ACT'] >= $VAL['CRIT']) { + $def[$KEY] .= rrd::line1( "var1", "#008000", "Disk Usage" ); + } elseif ($VAL['ACT'] >= $VAL['WARN']) { + $def[$KEY] .= rrd::line1( "var1", "#008000", "Disk Usage" ); + }else { + $def[$KEY] .= rrd::line1( "var1", "#008000", "Disk Usage" ); + } + $def[$KEY] .= rrd::gprint ("var1", array("LAST","MAX","AVERAGE"), "%3.4lf %S%%"); + $i = 1; + $k = $KEY; + } + else { + # inode graph rendering + $def[$k] .= rrd::def( "var2", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE" ); + if ($VAL['ACT'] >= $VAL['CRIT']) { + $def[$k] .= rrd::line1( "var2", "#0000FF", "Inode Usage" ); + } elseif ($VAL['ACT'] >= $VAL['WARN']) { + $def[$k] .= rrd::line1( "var2", "#0000FF", "Inode Usage" ); + }else { + $def[$k] .= rrd::line1( "var2", "#0000FF", "Inode Usage" ); + } + $def[$k] .= rrd::gprint ("var2", array("LAST","MAX","AVERAGE"), "%3.4lf %S%%"); + $i = 0; + + # create warning line and legend + $def[$k] .= rrd::line2( $VAL['WARN'], "#FFA500", "Warning\\n"); + + # create critical line and legend + $def[$k] .= rrd::line2( $VAL['CRIT'], "#FF0000", "Critical\\n"); + + } +} +?> diff --git a/templates/check_interfaces.php b/templates/check_interfaces.php new file mode 100644 index 0000000..96226e9 --- /dev/null +++ b/templates/check_interfaces.php @@ -0,0 +1,53 @@ + diff --git a/templates/check_memory.php b/templates/check_memory.php new file mode 100644 index 0000000..d620b66 --- /dev/null +++ b/templates/check_memory.php @@ -0,0 +1,59 @@ + \ No newline at end of file diff --git a/templates/check_swap_usage.php b/templates/check_swap_usage.php new file mode 100644 index 0000000..4d1c0ff --- /dev/null +++ b/templates/check_swap_usage.php @@ -0,0 +1,41 @@ +1;3406;0c \ No newline at end of file -- cgit