} else { $vlabel = $VAL['UNIT']; } $opt[$KEY] = '--vertical-label "' . $vlabel . '" --title "' . $this->MACRO['DISP_HOSTNAME'] . ' / ' . $this->MACRO['DISP_SERVICEDESC'] . '"' . $upper . $lower; $ds_name[$KEY] = $VAL['LABEL']; $def[$KEY] = rrd::def("var1", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); $def[$KEY] .= rrd::gradient("var1", "3152A5", "BDC6DE", rrd::cut($VAL['NAME'], 16), 20); $def[$KEY] .= rrd::line1("var1", $_LINE); $def[$KEY] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%3.4lf %S" . $VAL['UNIT']); if ($warning != "") { $def[$KEY] .= rrd::hrule($warning, $_WARNRULE, "Warning {$warning} \\n"); } if ($warn_min != "") { $def[$KEY] .= rrd::hrule($warn_min, $_WARNRULE, "Warning (min) {$warn_min} \\n"); } if ($warn_max != "") { $def[$KEY] .= rrd::hrule($warn_max, $_WARNRULE, "Warning (max) {$warn_max} \\n"); } if ($critical != "") { $def[$KEY] .= rrd::hrule($critical, $_CRITRULE, "Critical {$critical} \\n"); } if ($crit_min != "") { $def[$KEY] .= rrd::hrule($crit_min, $_CRITRULE, "Critical (min) {$crit_min} \\n"); } if ($crit_max != "") { $def[$KEY] .= rrd::hrule($crit_max, $_CRITRULE, "Critical (max) {$crit_max} \\n"); } $def[$KEY] .= rrd::comment("Default Template\\r"); $def[$KEY] .= rrd::comment("Command " . $VAL['TEMPLATE'] . "\\r"); } }
$def[$gindex] .= rrd::comment("* Fragmentation Ratio (Allocated/Used) is \\g"); if ($vindex_fragmentation != -1) { $def[$gindex] .= rrd::def("fragmentation_data", $RRDFILE[$vindex_fragmentation], $DS[$vindex_fragmentation], "AVERAGE"); $def[$gindex] .= "GPRINT:fragmentation_calc:LAST:\" %2.2lf \\g\" "; $def[$gindex] .= "GPRINT:fragmentation_data:LAST:\" (actual %2.2lf)\\n\" "; } else { $def[$gindex] .= "GPRINT:fragmentation_calc:LAST:\"%2.2lf\\n\" "; } $def[$gindex] .= rrd::area("free_mb", "#00FF00", "Free Memory ", "STACK"); $def[$gindex] .= "GPRINT:free_mb:LAST:\"%6.1lfMB \\g\" "; $def[$gindex] .= "GPRINT:free_perc:LAST:\" (%2.1lf%%) Last\" "; $def[$gindex] .= "GPRINT:free_mb:MAX:\"%6.1lfMB \\g\" "; $def[$gindex] .= "GPRINT:free_perc:MAX:\" (%2.1lf%%) Max\" "; $def[$gindex] .= "GPRINT:free_mb:AVERAGE:\"%6.1lfMB \\g\" "; $def[$gindex] .= "GPRINT:free_perc:AVERAGE:\" (%2.1lf%%) Avg\\n\" "; $def[$gindex] .= rrd::comment("= Total Memory"); $def[$gindex] .= "GPRINT:total_mb:LAST:\"%6.1lfMB\\n\" "; } else { $def[$gindex] .= "GPRINT:memrss_mb:LAST:\"%6.1lfMB Last \" "; $def[$gindex] .= "GPRINT:memrss_mb:MAX:\"%6.1lfMB Max \" "; $def[$gindex] .= "GPRINT:memrss_mb:AVERAGE:\"%6.1lfMB Avg \\n\" "; } } $gindex++; } if ($VAR['used_cpu_sys'] != -1) { $vindex_cpumain_sys = $VAR['used_cpu_sys']; $vindex_cpumain_user = $VAR['used_cpu_user']; $vindex_cpuchild_sys = $VAR['used_cpu_sys_children']; $vindex_cpuchild_user = $VAR['used_cpu_user_children']; $ds_name[$gindex] = "CPU Use";
$def[$id_watt] = rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); } # calculate kWh and BTU $def[$id_watt] .= "VDEF:tot{$KEY}=var{$KEY},TOTAL "; # rrd:vdef is broken in pnp4nagios 0.6.13 # $def[$id_watt] .= rrd::vdef("tot$KEY","var$KEY,TOTAL"); $def[$id_watt] .= rrd::cdef("kwh{$KEY}", "var{$KEY},POP,tot{$KEY},1000,/,60,/,60,/"); $def[$id_watt] .= rrd::cdef("btu{$KEY}", "kwh{$KEY},3412.3,*"); # fancy graphing $def[$id_watt] .= rrd::gradient("var{$KEY}", "#800000", "#dc0000", "{$label}", 10, "50%"); # print avg, max and min $def[$id_watt] .= rrd::gprint("var{$KEY}", array("LAST", "MAX", "AVERAGE"), "%6.0lf W"); # print kWh and BTU for time period $def[$id_watt] .= rrd::comment("\\s"); $def[$id_watt] .= rrd::comment(" Total power used in time period\\:"); $def[$id_watt] .= rrd::gprint("kwh{$KEY}", "AVERAGE", "%10.2lf kWh\\l"); $def[$id_watt] .= rrd::comment(" "); $def[$id_watt] .= rrd::gprint("btu{$KEY}", "AVERAGE", "%10.2lf BTU\\l"); } # AMPERAGE PROBE if (preg_match('/^A/', $label)) { $first = 0; if ($visited_amp == 0) { $first = 1; $visited_amp = 1; } # Long label $label = preg_replace('/^A(\\d+)_(.+)/', '$2', $label); $label = preg_replace('/_/', ' ', $label); # Short label $label = preg_replace('/^A(\\d+)$/', 'Probe $1', $label); $ds_name[$id_amp] = "Amperage Probes";
$def[$casecount_int] .= rrd::def("tc_case" . $casecount . "_state", $v['RRDFILE'], $v['DS'], "MAX"); # determine when this case is warning/critical -> draw TICK line on top $def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_state_warning", "tc_case" . $casecount . "_state,1,EQ,1,0,IF "); # if incomplete data = 1 -> 0 = no crit TICK # else: if case$casecount_state = 2 -> 1 = crit TICK $def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_state_critical", "tc_case" . $casecount . "_incomplete,1,EQ,0,tc_case" . $casecount . "_state,2,EQ,2,0,IF,IF"); $def[$casecount_int] .= "TICK:tc_case" . $casecount . "_state_warning" . $col_warning . $tick_opacity_warn . ":" . $tick_frac . ":' case/step warning ' "; $def[$casecount_int] .= "TICK:tc_case" . $casecount . "_state_critical" . $col_critical . $tick_opacity_crit . ":" . $tick_frac . ":' case/step critical \\j' "; } } # Suite last check time: black vertical line ################################# $def[$casecount_int] .= "VRULE:" . $NAGIOS_TIMET . "#000000: "; # append CPU/MEM graph (defined above) ################################################ if ($graph_cpu or $graph_mem) { $def[$casecount_int] .= rrd::comment(" \\n"); $def[$casecount_int] .= rrd::comment("Host Statistics\\:\\n"); if ($graph_cpu == "load") { # Load is usually a much lower value than usage (%) -> scale the right axis with factor 10 $opt[$casecount_int] .= " --right-axis \"0.1:0\" --right-axis-label \"CPU Load\" "; } else { $opt[$casecount_int] .= " --right-axis \"1:0\" --right-axis-label \"CPU Usage\" "; } } if ($graph_cpu) { $def[$casecount_int] .= $rrddef_cpu; } if ($graph_mem) { $def[$casecount_int] .= $rrddef_mem; } } # if (preg_match('/^c_(\d+)_([a-zA-Z0-9].*)/', $VAL['LABEL'], $c_matches))
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # $VALUE_COUNT = 4; $name = $NAME; asort($name); $c = count($name); if ($c % $VALUE_COUNT != 0) { exit; } $interface_count = $c / $VALUE_COUNT; for ($i = 0; $i < $interface_count; $i++) { $index = $i * $VALUE_COUNT + 1; list($interface, $data_type) = explode(".", $name[$index + 2]); $interface = str_replace(";", "", $interface); $opt[$index + 1] = "--vertical-label \"Speed in Gbps\" -X 0 -l 0 -u 1 --title \"Network Interface Load for {$hostname} / {$interface}\" "; $ds_name[$index + 1] = "{$interface}:: Receiving and "; $def[$index + 1] = rrd::def("value1", $RRDFILE[$index + 2], $DS[$index + 2], "AVERAGE"); $def[$index + 1] .= rrd::cdef("value2", "value1,125000,/"); $def[$index + 1] .= rrd::line1("value2", "#008000", "Receiving "); $def[$index + 1] .= rrd::gprint("value2", array("LAST", "AVERAGE", "MAX"), "%6.4lf Gbps"); list($interface, $data_type) = explode(".", $name[$index + 3]); $interface = str_replace(";", "", $interface); $ds_name[$index + 1] .= "Transmission speed"; $def[$index + 1] .= rrd::def("value3", $RRDFILE[$index + 3], $DS[$index + 3], "AVERAGE"); $def[$index + 1] .= rrd::cdef("value4", "value3,125000,/"); $def[$index + 1] .= rrd::line1("value4", "#0000ff", "Transmission "); $def[$index + 1] .= rrd::gprint("value4", array("LAST", "AVERAGE", "MAX"), "%6.4lf Gbps"); $def[$index + 1] .= rrd::comment(" \\n"); $def[$index + 1] .= rrd::comment(" \\n"); $def[$index + 1] .= rrd::comment(" \\n"); }
<?php # # Copyright (c) 2006-2012 Joerg Linge (http://www.pnp4nagios.org) # Plugin: check_jmx4perl # Dataset: connector_nr_requests # Perfdata: nr_requests=152.8;900;1000 # $opt[1] = "-X0 --vertical-label \"Requets\" --title \"Requests {$hostname} / {$servicedesc}\" "; $def[1] = rrd::def("var1", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::gradient('var1', '#F5F5F5', '#C0C0C0'); $def[1] .= rrd::line1("var1", "#B80000", $LABEL[1]); $def[1] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%.0lf"); if ($WARN[1] != "") { $def[1] .= rrd::hrule($WARN[1], "#FFFF00", "Warning\\n"); } if ($CRIT[1] != "") { $def[1] .= rrd::hrule($CRIT[1], "#FF0000", "Critical"); } $def[1] .= rrd::comment("jolokia.org");
$def[4] .= "GPRINT:use_mb:AVERAGE:\"%6.1lfMB \\g\" "; $def[4] .= "GPRINT:use_perc:AVERAGE:\" (%2.1lf%%) Avg\\n\" "; $def[4] .= rrd::area("free_mb", "#00FFFF", "Free Memory ", "STACK"); $def[4] .= "GPRINT:free_mb:LAST:\"%6.1lfMB \\g\" "; $def[4] .= "GPRINT:free_perc:LAST:\" (%2.1lf%%) Last\" "; $def[4] .= "GPRINT:free_mb:MAX:\"%6.1lfMB \\g\" "; $def[4] .= "GPRINT:free_perc:MAX:\" (%2.1lf%%) Max\" "; $def[4] .= "GPRINT:free_mb:AVERAGE:\"%6.1lfMB \\g\" "; $def[4] .= "GPRINT:free_perc:AVERAGE:\" (%2.1lf%%) Avg\\n\" "; $def[4] .= rrd::comment("= Total Memory"); $def[4] .= "GPRINT:total_mb:LAST:\"%6.1lfMB\\n\" "; $ds_name[5] = "Data Items Store"; $opt[5] = "--vertical-label \"# items\" --title \"{$servicedesc} Data Items on {$hostname}\" "; $def[5] = rrd::def("curr_items", $RRDFILE[8], $DS[8], "AVERAGE"); $def[5] .= rrd::def("total_items", $RRDFILE[17], $DS[17], "AVERAGE"); $def[5] .= rrd::area("total_items", "#00FF00", "Items Added Per Sec"); $def[5] .= rrd::gprint("total_items", array("LAST", "MAX", "AVERAGE"), "%3.0lf "); $def[5] .= rrd::comment("- Total Current Items "); $def[5] .= rrd::gprint("curr_items", array("LAST"), "%6.0lf "); $ds_name[6] = "CPU Use"; $opt[6] = "--vertical-label \"cpu time in msec\" --title \"CPU Time Use for {$servicedesc} on {$hostname}\" "; $def[6] = rrd::def("rusage_system", $RRDFILE[10], $DS[10], "AVERAGE"); $def[6] .= rrd::def("rusage_user", $RRDFILE[19], $DS[19], "AVERAGE"); $def[6] = rrd::def("rusage_system_ms", $RRDFILE[24], $DS[24], "AVERAGE"); $def[6] .= rrd::def("rusage_user_ms", $RRDFILE[23], $DS[23], "AVERAGE"); $def[6] .= rrd::cdef("rusage_system_graph", "rusage_system_ms,1024,/"); $def[6] .= rrd::cdef("rusage_user_graph", "rusage_user_ms,1024,/"); $def[6] .= rrd::area("rusage_system_graph", "#FFFF00", "CPU System Mode Time"); $def[6] .= rrd::gprint("rusage_system_graph", array("LAST", "MAX", "AVERAGE"), "%3.2lf msec "); $def[6] .= rrd::area("rusage_user_graph", "#00FF00", "CPU User Mode Time ", "STACK"); $def[6] .= rrd::gprint("rusage_user_graph", array("LAST", "MAX", "AVERAGE"), "%3.2lf msec ");
foreach ($this->DS as $KEY => $VAL) { if ($VAL['TEMPLATE'] == "check_brick_usage") { $ds_name[$KEY] = "Brick Utilization"; } else { $ds_name[$KEY] = "Disk Utilization"; } $name[$KEY] = "Mount Path: "; $graph_type = $VAL['LABEL']; $max_limit = $VAL['MAX']; $unit = "GiB"; if (endsWith($graph_type, ".inode") || endsWith($graph_type, ".thinpool") || endsWith($graph_type, ".thinpool-metadata")) { list($brick, $data_type) = explode(".", $graph_type); $ds_name[$KEY] .= "("; $ds_name[$KEY] .= $data_type; $ds_name[$KEY] .= ")"; $name[$KEY] .= $brick; if ($data_type == "inode") { $unit = ""; } } else { $name[$KEY] .= $graph_type; $ds_name[$KEY] .= "(space)"; } $opt[$KEY] = "--vertical-label \"%(Total: {$max_limit} {$unit}) \" --lower-limit 0 --upper-limit 100 -r --title \"{$name[$KEY]}\" "; $def[$KEY] = rrd::def("var1", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); $def[$KEY] .= rrd::area("var1", "#008000", "Usage"); $def[$KEY] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%.3lf %%"); $def[$KEY] .= rrd::line2($VAL['WARN'], "#FFA500", "Warning\\n"); $def[$KEY] .= rrd::line2($VAL['CRIT'], "#FF0000", "Critical\\n"); $def[$KEY] .= rrd::comment(" \\n"); }
$def[$gkey] .= rrd::cdef("percent_softirq", "softirq,total,/,100,*"); $def[$gkey] .= rrd::cdef("user_area", $pre . "used"); $def[$gkey] .= rrd::cdef("nice_area_temp", "user_area," . $pre . "user,-"); $def[$gkey] .= rrd::cdef("nice_area", "nice_area_temp,0,LT,0,nice_area_temp,IF"); $def[$gkey] .= rrd::cdef("system_area_temp", "nice_area," . $pre . "nice,-"); $def[$gkey] .= rrd::cdef("system_area", "system_area_temp,0,LT,0,system_area_temp,IF"); $def[$gkey] .= rrd::cdef("irq_area_temp", "system_area," . $pre . "system,-"); $def[$gkey] .= rrd::cdef("irq_area", "irq_area_temp,0,LT,0,irq_area_temp,IF"); $def[$gkey] .= rrd::cdef("softirq_area_temp", "irq_area," . $pre . "irq,-"); $def[$gkey] .= rrd::cdef("softirq_area", "softirq_area_temp,0,LT,0,softirq_area_temp,IF"); $def[$gkey] .= rrd::cdef("iowait_area", $pre . "iowait"); $def[$gkey] .= rrd::comment("* Total Idle\\t"); $def[$gkey] .= rrd::gprint($pre . "idle", array("LAST", "MAX", "AVERAGE"), $unm); $def[$gkey] .= rrd::comment("* Total Used\\t"); $def[$gkey] .= rrd::gprint($pre . "used", array("LAST", "MAX", "AVERAGE"), $unm); $def[$gkey] .= rrd::comment("\\r"); $def[$gkey] .= rrd::area("user_area", "#40E0D0", "user\\t"); $def[$gkey] .= rrd::gprint($pre . "user", array("LAST", "AVERAGE", "MAX"), $unm); $def[$gkey] .= rrd::area("nice_area", "#87CEEB", "nice\\t"); $def[$gkey] .= rrd::gprint($pre . "nice", array("LAST", "AVERAGE", "MAX"), $unm); $def[$gkey] .= rrd::area("system_area", "#8B4513", "system\\t"); $def[$gkey] .= rrd::gprint($pre . "system", array("LAST", "AVERAGE", "MAX"), $unm); $def[$gkey] .= rrd::area("irq_area", "#FF0000", "irq \\t"); $def[$gkey] .= rrd::gprint($pre . "irq", array("LAST", "AVERAGE", "MAX"), $unm); $def[$gkey] .= rrd::area("softirq_area", "#FFFF00", "softirq\\t"); $def[$gkey] .= rrd::gprint($pre . "softirq", array("LAST", "AVERAGE", "MAX"), $unm); $def[$gkey] .= rrd::area("iowait_area", "#FFA500", "iowait\\t"); $def[$gkey] .= rrd::gprint($pre . "iowait", array("LAST", "AVERAGE", "MAX"), $unm); } if (isset($swap_paged_in) && isset($swap_paged_out) && isset($data_paged_in) && isset($data_paged_out)) { $gkey++;
# License along with GNU Make; see the file COPYING. If not, write # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301 USA. $opt[1] = "--vertical-label \"GC Count\" --title \" {$servicedesc} for {$hostname}\" "; $def[1] = "DEF:c={$RRDFILE['1']}:{$DS['1']}:AVERAGE "; $def[1] .= rrd::comment("{$NAME['1']}\\: \\n"); $def[1] .= "AREA:c#3bfcdf:\"\" "; $def[1] .= "LINE1:c#00b499:\"GC Count per Minute\" "; $def[1] .= "GPRINT:c:LAST:\"%3.4lg LAST \" "; $def[1] .= "GPRINT:c:AVERAGE:\"%3.4lg AVERAGE \" "; $def[1] .= "GPRINT:c:MAX:\"%3.4lg MAX \\n\" "; if ($WARN[1] != "") { $def[1] .= "HRULE:{$WARN['1']}#FFFF00:\"Warning at {$WARN['1']}{$UNIT['1']} \\n\" "; } if ($CRIT[1] != "") { $def[1] .= "HRULE:{$CRIT['1']}#FF0000:\"Critical at {$CRIT['1']}{$UNIT['1']} \\n\" "; } $opt[2] = "--vertical-label \"GC Time\" --title \" {$servicedesc} for {$hostname}\" "; $def[2] = "DEF:t={$RRDFILE['2']}:{$DS['2']}:AVERAGE "; $def[2] .= rrd::comment("{$NAME['2']}\\: \\n"); $def[2] .= "AREA:t#ffc7ac:\"\" "; $def[2] .= "LINE1:t#ff6d25:\"GC Time (ms) per Minute\" "; $def[2] .= "GPRINT:t:LAST:\"%3.0lf{$UNIT['2']} LAST \" "; $def[2] .= "GPRINT:t:AVERAGE:\"%3.2lf{$UNIT['2']} AVERAGE \" "; $def[2] .= "GPRINT:t:MAX:\"%3.2lf{$UNIT['2']} MAX \\n\" "; if ($WARN[2] != "") { $def[2] .= "HRULE:{$WARN['2']}#FFFF00:\"Warning at {$WARN['2']}{$UNIT['2']} \\n\" "; } if ($CRIT[2] != "") { $def[2] .= "HRULE:{$CRIT['2']}#FF0000:\"Critical at {$CRIT['2']}{$UNIT['2']} \\n\" "; }
# Boston, MA 02110-1301 USA. $opt[1] = "--vertical-label \"ThreadPool busy/count\" --title \" {$servicedesc} for {$hostname}\" "; $def[1] = "DEF:b={$RRDFILE['1']}:{$DS['1']}:AVERAGE "; $def[1] .= "DEF:c={$RRDFILE['2']}:{$DS['2']}:AVERAGE "; # BUSY $def[1] .= rrd::comment("{$NAME['2']}\\: "); $def[1] .= "AREA:c#00ff77:\"\" "; $def[1] .= "LINE1:c#00b454:\"busy\" "; $def[1] .= "GPRINT:c:LAST:\"%3.4lg LAST \" "; $def[1] .= "GPRINT:c:AVERAGE:\"%3.4lg AVERAGE \" "; $def[1] .= "GPRINT:c:MAX:\"%3.4lg MAX \\n\" "; if ($WARN[2] != "") { $def[1] .= "HRULE:{$WARN['2']}#FFFF00:\" Warning at {$WARN['2']}{$UNIT['2']} \" "; } if ($CRIT[2] != "") { $def[1] .= "HRULE:{$CRIT['2']}#FF0000:\" Critical at {$CRIT['2']}{$UNIT['2']} \" "; } # MAX $def[1] .= "HRULE:{$MAX['1']}#000000:\" Max at {$MAX['1']} \\n\" "; # COUNT $def[1] .= rrd::comment("{$NAME['1']}\\: "); $def[1] .= "LINE1:b#00aae8:\"count\" "; $def[1] .= "GPRINT:b:LAST:\"%3.4lg LAST \" "; $def[1] .= "GPRINT:b:AVERAGE:\"%3.4lg AVERAGE \" "; $def[1] .= "GPRINT:b:MAX:\"%3.4lg MAX \\n\" "; if ($WARN[1] != "") { $def[1] .= "HRULE:{$WARN['1']}#E5B200:\" Warning at {$WARN['1']}{$UNIT['1']} \" "; } if ($CRIT[1] != "") { $def[1] .= "HRULE:{$CRIT['1']}#E50066:\" Critical at {$CRIT['1']}{$UNIT['1']} \\n\" "; }