$opt[$defcnt] = "--vertical-label \"Bytes\" --title \"Total sql server memory on {$hostname}\" "; $def[$defcnt] = ""; $def[$defcnt] .= rrd::def("mem", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE:reduce=LAST"); $def[$defcnt] .= rrd::area("mem", "#c3c3c3", "Memory"); $def[$defcnt] .= rrd::line1("mem", "#111111"); $def[$defcnt] .= rrd::gprint("mem", array("MAX", "AVERAGE", "LAST"), "%.1lf %SB"); $defcnt++; } if (preg_match('/^buffer_cache_hit_ratio$/', $VAL['NAME'])) { $ds_name[$defcnt] = "Buffer Cache Hit Ratio"; $opt[$defcnt] = "--vertical-label \"%\" --title \"Buffer cache hit ratio on {$hostname}\" "; $def[$defcnt] = ""; $def[$defcnt] .= rrd::def("bufcahitrat", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE:reduce=LAST"); $def[$defcnt] .= rrd::cdef("ar", "bufcahitrat," . $VAL['CRIT_MIN'] . ",LE,bufcahitrat,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,bufcahitrat,0,IF"); $def[$defcnt] .= rrd::cdef("ay", "bufcahitrat," . $VAL['WARN_MIN'] . ",LE,bufcahitrat," . $VAL['CRIT_MIN'] . ",GT,INF,UNKN,IF,UNKN,IF,ISINF,bufcahitrat,0,IF"); $def[$defcnt] .= rrd::cdef("ag", "bufcahitrat,100,LE,bufcahitrat," . $VAL['WARN_MIN'] . ",GT,INF,UNKN,IF,UNKN,IF,ISINF,bufcahitrat,0,IF"); $def[$defcnt] .= rrd::area("ag", "#{$green}"); $def[$defcnt] .= rrd::area("ay", "#{$yellow}"); $def[$defcnt] .= rrd::area("ar", "#{$red}"); $def[$defcnt] .= rrd::line1("bufcahitrat", "#000000:"); $def[$defcnt] .= rrd::gprint("bufcahitrat", "LAST", "Hit ratio is %3.2lf percent\\n"); $defcnt++; } if (preg_match('/^(.*)_lock_timeouts_per_sec/', $VAL['NAME'], $match)) { $dsname = $match[1]; if (empty($opt[1])) { $opt[1] = "--vertical-label \"Lock timeouts/s\" -l0 --title \"Locks timeouts / sec\" "; } if (empty($def[1])) { $def[1] = ""; }
if ($VAL['MAX'] != "") { # adjust value and unit, details in .../helpers/pnp.php $max = pnp::adjust_unit($VAL['MAX'] . $unit, 1024, $fmt); $upper = "-u {$max['1']} "; $maximum = "of {$max['1']} {$max['2']}{$pct} used"; $label = $max[2]; $divis = $max[3]; $return = ''; } $ds_name[$KEY] = str_replace("_", "/", $VAL['NAME']); # set graph labels $opt[$KEY] = "--vertical-label {$label} -l 0 {$upper} --title \"Filesystem {$ds_name[$KEY]}\" "; # Graph Definitions $def[$KEY] = rrd::def("var1", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); # "normalize" graph values $def[$KEY] .= rrd::cdef("v_n", "var1,{$divis},/"); $def[$KEY] .= rrd::area("v_n", "#c6c6c6", $ds_name[$KEY]); $def[$KEY] .= rrd::line1("v_n", "#003300"); # show values in legend $def[$KEY] .= rrd::gprint("v_n", "LAST", "{$fmt} {$label}{$pct} {$maximum} "); $def[$KEY] .= rrd::gprint("v_n", "AVERAGE", "{$fmt} {$label}{$pct} avg used {$return}"); # create max line and legend if ($VAL['MAX'] != "") { $def[$KEY] .= rrd::gprint("v_n", "MAX", "{$fmt} {$label}{$pct} max used \\n"); $def[$KEY] .= rrd::hrule($max[1], "#003300", "Size of FS {$max['0']} \\n"); } # create warning line and legend if ($VAL['WARN'] != "") { $warn = pnp::adjust_unit($VAL['WARN'] . $unit, 1024, $fmt); $def[$KEY] .= rrd::hrule($warn[1], "#ffff00", "Warning on {$warn['0']} \\n"); }
$def[1] .= rrd::def("var4", $ds['buffered']['RRDFILE'], $ds['buffered']['DS']); $def[1] .= rrd::def("var5", $ds['cached']['RRDFILE'], $ds['cached']['DS']); $def[1] .= rrd::def("var6", $ds['free']['RRDFILE'], $ds['free']['DS']); $def[1] .= rrd::def("var7", $ds['swap_total']['RRDFILE'], $ds['swap_total']['DS']); $def[1] .= rrd::def("var8", $ds['swap_free']['RRDFILE'], $ds['swap_free']['DS']); $def[1] .= rrd::cdef("v_real_used", "var1,{$divis},/"); $def[1] .= rrd::cdef("v_total", "var2,{$divis},/"); $def[1] .= rrd::cdef("v_shared", "var3,{$divis},/"); $def[1] .= rrd::cdef("v_buffered", "var4,{$divis},/"); $def[1] .= rrd::cdef("v_cached", "var5,{$divis},/"); $def[1] .= rrd::cdef("v_used", "var2,var6,-,{$divis},/"); // total - used / $divis $def[1] .= rrd::cdef("v_free", "var6,{$divis},/"); $def[1] .= rrd::cdef("v_swtotal", "var7,{$divis},/"); $def[1] .= rrd::cdef("v_swfree", "var8,{$divis},/"); $def[1] .= rrd::cdef("v_swused", "var7,var8,-,{$divis},/"); // Stacking all other values (used, cached, buffered, cached $def[1] .= rrd::gradient("v_real_used", "#FF9900", "#FF5555", "Real used"); $def[1] .= rrd::line1("v_real_used", "#00000000"); // Invisible to be able to stack with gradient #$def[1] .= rrd::area("v_real_used", "#FF9900", "Real used"); $def[1] .= rrd::gprint("v_real_used", array("AVERAGE", "MIN", "MAX", "LAST"), "{$fmt}{$unit_scale}"); $def[1] .= rrd::area("v_cached", "#FFAAFF", "Cached", true); $def[1] .= rrd::gprint("v_cached", "LAST", "{$fmt}{$unit_scale}\\n"); $def[1] .= rrd::area("v_shared", "#0000FF", "Shared", true); $def[1] .= rrd::gprint("v_shared", "LAST", "{$fmt}{$unit_scale}\\n"); $def[1] .= rrd::area("v_buffered", "#AAFFFF", "Buffered", true); $def[1] .= rrd::gprint("v_buffered", "LAST", "{$fmt}{$unit_scale}\\n"); $def[1] .= rrd::area("v_free", "#FAFAAA", "Free", true); $def[1] .= rrd::gprint("v_free", "LAST", "{$fmt}{$unit_scale}\\n"); // Stack swap on the same graph
$def[1] .= rrd::line1("var{$KEY}", rrd::color($i), rrd::cut($label, 10)); $def[1] .= rrd::gprint("var{$KEY}", array("LAST", "MAX", "AVERAGE"), "%8.2lf"); } } $opt[2] = '--title "Host Stats"'; $ds_name[2] = "Host Stats"; $def[2] = ""; $i = 0; foreach ($this->DS as $KEY => $VAL) { if (preg_match('/^NUMHST(.*)$/', $VAL['NAME'], $matches)) { $i++; $label = ucfirst(strtolower($matches[1])); $def[2] .= rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); $def[2] .= rrd::line1("var{$KEY}", rrd::color($i), rrd::cut($label, 10)); $def[2] .= rrd::gprint("var{$KEY}", array("LAST", "MAX", "AVERAGE"), "%8.2lf"); } } $opt[3] = '--title "Check Execution Time"'; $ds_name[3] = "Execution Time"; $def[3] = ""; $i = 0; foreach ($this->DS as $KEY => $VAL) { if (preg_match('/(.*)EXT$/', $VAL['NAME'], $matches)) { $i++; $label = ucfirst(strtolower($matches[1])); $def[3] .= rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); $def[3] .= rrd::cdef("var_sec{$KEY}", "var{$KEY},1000,/"); $def[3] .= rrd::line1("var_sec{$KEY}", rrd::color($i), rrd::cut($label, 10)); $def[3] .= rrd::gprint("var_sec{$KEY}", array("LAST", "MAX", "AVERAGE"), "%8.2lf"); } }
<?php $color = '#0000FFCC'; $ds_name[1] = 'resources / nodes'; $opt[1] = sprintf('-T 55 -l 0 --vertical-label "Resources/Node" --title "%s / PuppetDB Average Resources Per Node"', $hostname); $def[1] = rrd::def('var1', $rrdfile, $DS[1], 'AVERAGE'); $def[1] .= rrd::def('var2', $rrdfile, $DS[2], 'AVERAGE'); $def[1] .= rrd::cdef('math1', 'var2,var1,/'); $def[1] .= rrd::area('math1', $color, 'Resources Per Node'); $def[1] .= rrd::gprint('math1', array('LAST'), "%4.0lf %s"); $ds_name[2] = 'nodes'; $opt[2] = sprintf('-T 55 -l 0 --vertical-label "# Nodes" --title "%s / PuppetDB Node Count"', $hostname); $def[2] = rrd::def('var1', $rrdfile, $DS[1], 'AVERAGE'); $def[2] .= rrd::area('var1', $color, 'Nodes'); $def[2] .= rrd::gprint('var1', array('LAST'), "%4.0lf %s"); $ds_name[3] = 'resources'; $opt[3] = sprintf('-T 55 -l 0 --vertical-label "# Resources" --title "%s / PuppetDB Resource Count"', $hostname); $def[3] = rrd::def('var1', $rrdfile, $DS[2], 'AVERAGE'); $def[3] .= rrd::area('var1', $color, 'Resources'); $def[3] .= rrd::gprint('var1', array('LAST'), "%4.2lf %s");
# 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"); }
$def[$id_amp] .= rrd::cdef("tier{$KEY}", "var{$KEY},10,/"); $def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "b7::STACK "; $def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "bf::STACK "; $def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "c7::STACK "; $def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "cf::STACK "; $def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "d7::STACK "; $def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "df::STACK "; $def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "e7::STACK "; $def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "ef::STACK "; $def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "f7::STACK "; $def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "ff:\"{$label}{$space}\":STACK "; $a++; if ($first) { $def[$id_amp] .= rrd::cdef("sum{$KEY}", "var{$KEY},0,+"); } else { $def[$id_amp] .= rrd::cdef("sum{$KEY}", "sum" . ($KEY - 1) . ",var{$KEY},+"); } $def[$id_amp] .= rrd::line1("sum{$KEY}", "#555555"); $def[$id_amp] .= rrd::gprint("var{$KEY}", array("LAST", "MAX", "AVERAGE"), "%6.1lf A last"); } # VOLTAGE PROBE if (preg_match('/^V/', $label)) { # Long label $label = preg_replace('/^V(\\d+)_(.+)/', '$2', $label); $label = preg_replace('/_/', ' ', $label); # Short label $label = preg_replace('/^V(\\d+)$/', 'Probe $1', $label); $ds_name[$id_volt] = "Voltage Probes"; $vlabel = "Volts"; $title = $ds_name[$id_volt]; $opt[$id_volt] = "--slope-mode --vertical-label \"{$vlabel}\" --title \"{$def_title}: {$title}\" ";
} if (isset($swap_paged_in) && isset($swap_paged_out) && isset($data_paged_in) && isset($data_paged_out)) { $gkey++; $opt[$gkey] = '--vertical-label # --title "Memory and Swap Operations on ' . $this->MACRO['DISP_HOSTNAME'] . '"'; $ds_name[$gkey] = "Memory and Swap Operations"; $def[$gkey] = rrd::def("data_paged_in", $data_paged_in['RRDFILE'], $data_paged_in['DS'], "AVERAGE"); $def[$gkey] .= rrd::def("data_paged_out", $data_paged_out['RRDFILE'], $data_paged_out['DS'], "AVERAGE"); $def[$gkey] .= rrd::def("swap_paged_in", $swap_paged_in['RRDFILE'], $swap_paged_in['DS'], "AVERAGE"); $def[$gkey] .= rrd::def("swap_paged_out", $swap_paged_out['RRDFILE'], $swap_paged_out['DS'], "AVERAGE"); $def[$gkey] .= "AREA:data_paged_in#00CF00:\"Data Paged In \\: \t\\g\" "; $def[$gkey] .= rrd::gprint("data_paged_in", array("LAST", "AVERAGE", "MAX"), '%6.2lf '); $def[$gkey] .= "AREA:data_paged_out#FF8C0:\"Data Paged Out\\: \t\\g\":STACK "; $def[$gkey] .= rrd::gprint("data_paged_out", array("LAST", "AVERAGE", "MAX"), '%6.2lf '); $def[$gkey] .= "LINE2:swap_paged_in#FF0000:\"Swap Paged In \\: \t\\g\" "; $def[$gkey] .= rrd::gprint("swap_paged_in", array("LAST", "AVERAGE", "MAX"), '%6.2lf '); $def[$gkey] .= rrd::cdef("swap_paged_out_line", "swap_paged_out,data_paged_in,+"); $def[$gkey] .= "LINE2:swap_paged_out_line#0000FF:\"Swap Paged Out\\: \t\\g\" "; $def[$gkey] .= rrd::gprint("swap_paged_out", array("LAST", "AVERAGE", "MAX"), '%6.2lf '); } if (isset($num_intr) && isset($ctxt)) { $gkey++; $opt[$gkey] = '--vertical-label "events per sec" --title "Interrupts and Context Switches on ' . $this->MACRO['DISP_HOSTNAME'] . '"'; $ds_name[$gkey] = "Interrupts and Context Switches"; $def[$gkey] = rrd::def("ctxt", $ctxt['RRDFILE'], $ctxt['DS'], "AVERAGE"); $def[$gkey] .= rrd::def("num_intr", $num_intr['RRDFILE'], $num_intr['DS'], "AVERAGE"); $def[$gkey] .= "AREA:ctxt#00CF00:\"Context Switches (per second)\\: \t\\g\" "; $def[$gkey] .= rrd::gprint("ctxt", array("LAST", "AVERAGE", "MAX"), '%6.2lf '); $def[$gkey] .= "LINE1:num_intr#FF0000:\"Interrupts (per second) \\: \t\\g\" "; $def[$gkey] .= rrd::gprint("num_intr", array("LAST", "AVERAGE", "MAX"), '%6.2lf '); } if (isset($processes) && isset($procs_running) && isset($procs_blocked)) {
#third graph - open slots count $ds_name[3] = "Open slots"; $opt[3] = " --vertical-label \"Workers\" --title \"Apache open slots on {$hostname} / {$servicedesc}\" "; $opt[3] .= " --slope-mode "; $def[3] = rrd::def("var1", $RRDFILE[1], $DS[11], "AVERAGE"); $def[3] .= rrd::area("var1", "#e0e0e0", "open slots"); $def[3] .= rrd::line1("var1", "#858585"); $def[3] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%7.0lf"); #fourth graph - server's traffic total and per request $ds_name[4] = "Apache Traffic"; $opt[4] = " --vertical-label \"Traffic\" -b 1024 --title \"Apache Traffic for {$hostname} / {$servicedesc}\" "; $opt[4] .= " --slope-mode "; $def[4] = rrd::def("var1", $RRDFILE[1], $DS[13], "AVERAGE"); $def[4] .= rrd::cdef("trbytes", "var1,1024,*"); $def[4] .= rrd::def("var2", $RRDFILE[1], $DS[14], "AVERAGE"); $def[4] .= rrd::cdef("negperreq", "var2,-1,*"); $def[4] .= "VDEF:totalbytes=trbytes,TOTAL "; $def[4] .= rrd::area("trbytes", "#b0c0fb", "throughput"); $def[4] .= rrd::line1("trbytes", "#3c63ff"); $def[4] .= rrd::gprint("trbytes", array("LAST", "MAX", "AVERAGE"), "%7.2lf %sB/sec"); $def[4] .= rrd::line2("negperreq", "#00ff00", "kB/request"); $def[4] .= rrd::gprint("var2", array("LAST", "MAX", "AVERAGE"), "%7.2lf %s{$UNIT['14']}"); $def[4] .= "GPRINT:totalbytes:\"%3.0lf %sB total\\n\" "; #fifth graph - requests per sec ( rate is calculated by apache, time smoothed, very averaged, shouldn't be believed) $ds_name[5] = "Apache requests"; $opt[5] = " --vertical-label \"Request/sec\" --title \"Apache request/sec for {$hostname} / {$servicedesc}\" "; $opt[5] .= " --slope-mode "; $def[5] = rrd::def("var1", $RRDFILE[1], $DS[12], "AVERAGE"); $def[5] .= rrd::area("var1", "#b7ff9e", "Requests / sec"); $def[5] .= rrd::line1("var1", "#2eae00"); $def[5] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%7.2lf %s");
} if ($CRIT[1] != "") { $def[1] .= "HRULE:{$CRIT['1']}#FF0000 "; } $def[1] .= rrd::area("readmbps", "#40c080", "Read "); $def[1] .= rrd::gprint("readmbps", "LAST", "%6.1lf MB/s last "); $def[1] .= rrd::gprint("readmbps", "AVERAGE", "%6.1lf MB/s avg "); $def[1] .= rrd::gprint("readmbps", "MAX", "%6.1lf MB/s max\\n"); $def[1] .= rrd::area("writembps_neg", "#4080c0", "Write "); $def[1] .= rrd::gprint("writembps", "LAST", "%6.1lf MB/s last "); $def[1] .= rrd::gprint("writembps", "AVERAGE", "%6.1lf MB/s avg "); $def[1] .= rrd::gprint("writembps", "MAX", "%6.1lf MB/s max\\n"); $opt[2] = "--vertical-label 'Throughput (ops/s)' --title \"Disk throughput {$hostname} - disk {$disk}\" "; $def[2] = rrd::def("readps", $RRDFILE[$INDEX['readps']], $DS[$INDEX['readps']], "AVERAGE"); $def[2] .= rrd::def("writeps", $RRDFILE[$INDEX['writeps']], $DS[$INDEX['writeps']], "AVERAGE"); $def[2] .= rrd::cdef("writeps_neg", "writeps,-1,*"); $def[2] .= rrd::area("readps", "#40c080", "Read "); $def[2] .= rrd::gprint("readps", array("LAST", "AVERAGE", "MAX"), "%6.2lf "); $def[2] .= rrd::area("writeps_neg", "#4080c0", "Write "); $def[2] .= rrd::gprint("writeps", array("LAST", "AVERAGE", "MAX"), "%6.2lf "); $ds_name[3] = "{$NAGIOS_AUTH_SERVICEDESC}"; $opt[3] = "--vertical-label 'Duration (ms)' --title \"Transaction Duration {$hostname} - disk {$disk}\" "; $def[3] = rrd::def("svc_t", $RRDFILE[$INDEX['svc_t']], $DS[$INDEX['svc_t']], "AVERAGE"); $def[3] .= rrd::line1("svc_t", "#FF2211", "Duration"); $def[3] .= rrd::gprint("svc_t", array("LAST", "AVERAGE", "MAX"), "%6.2lf "); $ds_name[4] = "{$NAGIOS_AUTH_SERVICEDESC}"; $opt[4] = "--vertical-label '% Busy' --title \"% of time transaction were blocked {$hostname} - disk {$disk}\" "; $def[4] = rrd::def("busy", $RRDFILE[$INDEX['busy']], $DS[$INDEX['busy']], "AVERAGE"); $def[4] .= rrd::area("busy", "#3366FF", "Busy"); $def[4] .= rrd::gprint("busy", array("LAST", "AVERAGE", "MAX"), "%6.2lf "); $ds_name[5] = "{$NAGIOS_AUTH_SERVICEDESC}";
//ob_start(); $DS_mem = $this->DS[0]; $DS_pool = $this->DS[1]; $fmt = '%4.2lf'; $unit = $DS_mem['UNIT']; $max = pnp::adjust_unit($DS_mem['MAX'] . $unit, 1024, $fmt); $upper = "-u {$max['1']}"; # set graph labels $opt[1] = "--vertical-label {$unit} -l 0 {$upper} --title \"JVM " . $DS_mem['NAME'] . "\" "; # Graph Definitions $def[1] = rrd::def("var1", $DS_mem['RRDFILE'], $DS_mem['DS']); $def[1] .= rrd::def("var2", $DS_pool['RRDFILE'], $DS_pool['DS']); # "normalize" graph values $divis = $max[3]; $def[1] .= rrd::cdef("v_n", "var1,{$divis},/"); $def[1] .= rrd::cdef("v_pool", "var2,{$divis},/"); $def[1] .= rrd::gradient("v_n", "00FF33", "339900", $DS_mem['NAME']); $def[1] .= rrd::line1("v_n", "#003300"); $def[1] .= rrd::gprint("v_n", array("LAST", "MAX", "AVERAGE"), "{$fmt} {$unit}"); $def[1] .= rrd::gradient("v_pool", "00FFDD", "3399DD", $DS_pool['NAME']); $def[1] .= rrd::line1("v_pool", "#003300"); $def[1] .= rrd::gprint("v_pool", "LAST", "{$fmt} {$unit}\\n"); # create max line and legend //$def[1] .= rrd::gprint("v_n", "MAX", "$fmt $unit max used \\n"); $def[1] .= rrd::hrule($max[1], "#003300", "Max size ({$max['0']}) \\n"); # create warning line and legend $warn = pnp::adjust_unit($DS_mem['WARN'] . $unit, 1024, $fmt); $def[1] .= rrd::hrule($warn[1], "#ffff00", "Warning ({$warn['0']}) \\n"); # create critical line and legend $crit = pnp::adjust_unit($DS_mem['CRIT'] . $unit, 1024, $fmt); $def[1] .= rrd::hrule($crit[1], "#ff0000", "Critical ({$crit['0']})\\n");
<?php /* adminutils - Scripts and resources for admins Copyright (C) 2012 nmaupu_at_gmail_dot_com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ $DS_time = $this->DS[0]; $opt[1] = "--vertical-label \"Response time\" -l0 --title \"HTTP response time for {$hostname} / {$servicedesc}\" "; $def[1] = rrd::def("var1", $DS_time['RRDFILE'], $DS_time['DS']); $def[1] .= rrd::cdef("v_n", "var1,1000,*"); // display in ms $def[1] .= rrd::gradient("v_n", "#33CCFF", "#3300FF", "time"); $def[1] .= rrd::line1("v_n", "#000000"); $def[1] .= rrd::gprint("v_n", array("LAST", "AVERAGE", "MIN", "MAX"), "%6.3lfms");
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ //$fp = fopen('/tmp/test', 'a'); //ob_start(); $DS_in = $this->DS[0]; $DS_out = $this->DS[1]; $unit = 'B'; $fmt = "%6.2lf"; $max_in = pnp::adjust_unit($DS_in['ACT'] . $unit, 1024, $fmt); $max_out = pnp::adjust_unit($DS_out['ACT'] . $unit, 1024, $fmt); $max = $max_in; $opt[1] = "--slope-mode --vertical-label \"bytes/s\" -u {$max['1']} -l0 --title \"Interface traffic / {$hostname}\""; $divis = $max[3]; $def[1] = rrd::def("var1", $DS_in['RRDFILE'], $DS_in['DS'], "AVERAGE"); $def[1] .= rrd::def("var2", $DS_out['RRDFILE'], $DS_out['DS'], "AVERAGE"); $def[1] .= rrd::cdef("v_in", "var1,-1,*"); $def[1] .= rrd::cdef("v_out", "var2,1,*"); $def[1] .= rrd::cdef("v_in_f", "var1,1024,/"); // KiB $def[1] .= rrd::cdef("v_out_f", "var2,1024,/"); // KiB $def[1] .= rrd::gradient("v_out", "#33CCFF", "#0000FF", $DS_out['NAME']); $def[1] .= rrd::gprint("v_out_f", array("LAST", "AVERAGE", "MAX"), "{$fmt} KiB/s"); $def[1] .= rrd::gradient("v_in", "#FFCC66", "#FF0000", $DS_in['NAME']); $def[1] .= rrd::gprint("v_in_f", array("LAST", "AVERAGE", "MAX"), "{$fmt} KiB/s"); // Debug //$content = ob_get_clean(); //fwrite($fp, "$content\n"); //fclose($fp);
$DS_readdir = $this->DS[10]; $DS_readdirp = $this->DS[11]; $opt[1] = "--vertical-label \"Requests / s\" -l0 --title \"{$hostname} - NFS statistics\" "; $def[1] = rrd::def("var_status", $DS_status['RRDFILE'], $DS_status['DS']); $def[1] .= rrd::def("var_read", $DS_read['RRDFILE'], $DS_read['DS']); $def[1] .= rrd::def("var_write", $DS_write['RRDFILE'], $DS_write['DS']); //$def[1] .= rrd::def("var_create", $DS_create['RRDFILE'], $DS_create['DS']); //$def[1] .= rrd::def("var_mkdir", $DS_mkdir['RRDFILE'], $DS_mkdir['DS']); //$def[1] .= rrd::def("var_symlink", $DS_symlink['RRDFILE'], $DS_symlink['DS']); //$def[1] .= rrd::def("var_mknod", $DS_mknod['RRDFILE'], $DS_mknod['DS']); //$def[1] .= rrd::def("var_remove", $DS_remove['RRDFILE'], $DS_remove['DS']); //$def[1] .= rrd::def("var_rmdir", $DS_rmdir['RRDFILE'], $DS_rmdir['DS']); //$def[1] .= rrd::def("var_rename", $DS_rename['RRDFILE'], $DS_rename['DS']); //$def[1] .= rrd::def("var_readdir", $DS_readdir['RRDFILE'], $DS_readdir['DS']); //$def[1] .= rrd::def("var_readdirp", $DS_readdirp['RRDFILE'], $DS_readdirp['DS']); $def[1] .= rrd::cdef("v_read", "var_read,-1,*"); $def[1] .= rrd::gradient("v_read", "#33CCFF", "#0000FF", "Read"); $def[1] .= rrd::gprint("var_read", array("LAST", "AVERAGE", "MAX"), "%6.2lfreq/s"); $def[1] .= rrd::gradient("var_write", "#FFCC66", "#FF0000", "Write"); $def[1] .= rrd::gprint("var_write", array("LAST", "AVERAGE", "MAX"), "%6.2lfreq/s"); $def[1] .= rrd::hrule(0, "#838383"); //$def[1] .= rrd::line1("var_create", "#0000AA", "Create"); //$def[1] .= rrd::gprint("var_create", array("LAST", "AVERAGE", "MAX"), "%6.2lf"); // //$def[1] .= rrd::line1("var_mkdir", "#0000FF", "Mkdir"); //$def[1] .= rrd::gprint("var_mkdir", array("LAST", "AVERAGE", "MAX"), "%6.2lf"); // //$def[1] .= rrd::line1("var_symlink", "#005500", "Symlink"); //$def[1] .= rrd::gprint("var_symlink", array("LAST", "AVERAGE", "MAX"), "%6.2lf"); // //$def[1] .= rrd::line1("var_mknod", "#00AA00", "Mknod");
# Total Memory $def[1] = "DEF:mem_total={$RRDFILE['1']}:{$DS['1']}:AVERAGE "; # Used Memory $def[1] .= "DEF:mem_used={$RRDFILE['1']}:{$DS['2']}:AVERAGE "; # Cache $def[1] .= "DEF:mem_cache={$RRDFILE['1']}:{$DS['3']}:AVERAGE "; # Buffer $def[1] .= "DEF:mem_buffer={$RRDFILE['1']}:{$DS['4']}:AVERAGE "; # Memory Cache $def[1] .= rrd::cdef("mem_cache_tmp", "mem_cache,mem_buffer,+,mem_used,+"); $def[1] .= rrd::area("mem_cache_tmp", "#DCDDD5", "Disk Cache"); $def[1] .= "GPRINT:mem_cache:LAST:\"%3.2lf %sB Last \" "; $def[1] .= "GPRINT:mem_cache:MAX:\"%3.2lf %sB Max \" "; $def[1] .= "GPRINT:mem_cache" . ':AVERAGE:"%3.2lf %sB Average \\j" '; # Memory Buffer $def[1] .= rrd::cdef("mem_buffer_tmp", "mem_buffer,mem_used,+"); $def[1] .= rrd::area("mem_buffer_tmp", "#3E606F", "I/O Buffers"); $def[1] .= "GPRINT:mem_buffer:LAST:\"%3.2lf %sB Last \" "; $def[1] .= "GPRINT:mem_buffer:MAX:\"%3.2lf %sB Max \" "; $def[1] .= "GPRINT:mem_buffer" . ':AVERAGE:"%3.2lf %sB Average \\j" '; # Memory Used $def[1] .= rrd::area("mem_used", "#193441", "Processes"); $def[1] .= "GPRINT:mem_used:LAST:\"%3.2lf %sB Last \" "; $def[1] .= "GPRINT:mem_used:MAX:\"%3.2lf %sB Max \" "; $def[1] .= "GPRINT:mem_used" . ':AVERAGE:"%3.2lf %sB Average \\j" '; # Memory Total $def[1] .= rrd::line1("mem_total", "#000000", "Total"); $def[1] .= "GPRINT:mem_total:LAST:\"%3.2lf %sB Last \" "; $def[1] .= "GPRINT:mem_total:MAX:\"%3.2lf %sB Max \" "; $def[1] .= "GPRINT:mem_total" . ':AVERAGE:"%3.2lf %sB Average \\j" '; if ($WARN[2] != "") {
<?php # # Plugin for check_uptime adapted from template for check_icmp # $ds_name[1] = "Uptime"; $opt[1] = "--vertical-label \"days\" --title \"Uptime for {$hostname}\" --slope-mode "; $def[1] = rrd::def("minutes", $RRDFILE[2], $DS[2], "AVERAGE"); $def[1] .= rrd::cdef("days", "minutes,60,/,24,/"); #$def[1] .= rrd::gradient("days", "228b22", "adff2f", "Uptime", 20) ; $def[1] .= rrd::gradient("days", "00ff2f", "00ffff", "Uptime", 20); $def[1] .= rrd::gprint("days", array("LAST", "AVERAGE", "MAX"), "%6.2lf Days"); $def[1] .= rrd::line1("days", "#000000");
$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 ");
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++; } }
// Set this to true if you want to see the open slots on the graph. I have it // disabled by default because my web servers aren't heavily trafficed, so it // dwarfs all of the other data $include_open_slot = false; $alpha = 'AA'; $color = '#006699' . $alpha; $scoreboard = array('Waiting for connection', 'Starting up', 'Reading request', 'Sending reply', 'Keepalive', 'DNS lookup', 'Closing connection', 'Logging', 'Gracefully finishing', 'Idle cleanup', 'Open slot'); $ds_name[1] = 'Hits'; $opt[1] = "-T 55 -l 0 --vertical-label 'hits/s' --title \"{$hostname} / Apache Hits Per Second\""; $def[1] = rrd::def('var0', $rrdfile, $DS[1], 'AVERAGE'); $def[1] .= rrd::area('var0', rrd::color(2), 'Hits'); $def[1] .= rrd::gprint('var0', array('LAST', 'MAX', 'AVERAGE'), '%4.1lf %s'); $ds_name[2] = 'Network Traffic'; $opt[2] = "-T 55 -l 0 --vertical-label 'bit/s' --title \"{$hostname} / Apache Outbound Bandwidth\""; $def[2] = rrd::def('var0', $rrdfile, $DS[2], 'AVERAGE'); $def[2] .= rrd::cdef('var0_bits', 'var0,8,*'); $def[2] .= rrd::area('var0_bits', rrd::color(3), 'Network'); $def[2] .= rrd::gprint('var0_bits', array('LAST', 'MAX', 'AVERAGE'), '%4.1lf %s'); $ds_name[3] = 'Workers'; $opt[3] = "-T 55 -l 0 --vertical-label 'Workers' --title \"{$hostname} / Apache Workers\""; $def[3] = rrd::def('var0', $rrdfile, $DS[3], 'AVERAGE'); $def[3] .= rrd::area('var0', rrd::color(3), 'Workers Busy'); $def[3] .= rrd::gprint('var0', array('LAST', 'MAX', 'AVERAGE'), '%4.0lf %s'); $def[3] .= rrd::def('var1', $rrdfile, $DS[4], 'AVERAGE'); $def[3] .= rrd::area('var1', rrd::color(4), 'Workers Idle', 'STACK'); $def[3] .= rrd::gprint('var1', array('LAST', 'MAX', 'AVERAGE'), '%4.0lf %s'); $ds_name[4] = 'Scoreboard'; $opt[4] = "-T 55 -l 0 --vertical-label 'Workers' --title \"{$hostname} / Apache Scoreboard\""; $def[4] = ''; for ($i = 0; $i < count($scoreboard) - ($include_open_slot ? 0 : 1); $i++) { $def[4] .= rrd::def("var{$i}", $rrdfile, $DS[$i + 5], 'AVERAGE');
<?php # # Copyright (c) 2006-2010 Joerg Linge (http://www.pnp4nagios.org) # PNP Runtime Informations # # Runtime # $opt[1] = "--vertical-label \"{$UNIT['1']}\" --title \"Runtime of process_perfdata.pl\" "; # # # #$s=$this->STRUCT['TIMERANGE']['end']; $ds_name[1] = "Runtime"; $def[1] = rrd::def("var1", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::cdef("t_var1", "var1,14400,TREND"); if ($WARN[1] != "") { $def[1] .= rrd::hrule($WARN[1], "#FFFF00"); } if ($CRIT[1] != "") { $def[1] .= rrd::hrule($CRIT[1], "#FF0000"); } $def[1] .= rrd::gradient("var1", "ffffff", "#33cccc", rrd::cut("Runtime", 10)); $def[1] .= rrd::line1("var1", "#339999"); $def[1] .= rrd::gprint("var1", array('LAST', 'MAX', 'AVERAGE'), "%6.2lf{$UNIT['1']}"); $def[1] .= rrd::line1("t_var1", "#ff9999", rrd::cut("4h trend", 10)); $def[1] .= rrd::gprint("t_var1", array('LAST', 'MAX', 'AVERAGE'), "%6.2lf{$UNIT['1']}"); # # Lines processed and RRD errors # $opt[2] = "--vertical-label \"Counter\" --title \"Number of updates\" ";
$def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_incomplete_gt0", "tc_case" . $casecount . "_unknown_total_" . $case_data_count . ",0,GT,1,0,IF"); $def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_incomplete_ltdatacount", "tc_case" . $casecount . "_unknown_total_" . $case_data_count . "," . $case_data_count . ",LT,1,0,IF"); # if the sum of both comparisons is 2, both conditions are true and we really have incomplete data. This is when we want to have the TICK. $def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_incomplete", "tc_case" . $casecount . "_incomplete_gt0,tc_case" . $casecount . "_incomplete_ltdatacount,+,2,EQ,1,0,IF"); $def[$casecount_int] .= "TICK:tc_case" . $casecount . "_incomplete" . $col_INCOMPL . $tick_opacity_incompl . ":" . $tick_frac . ":' incomplete run' "; # TICKS for warning/critical -> yellow/red ############################################## # - warning/critical -> yellow/red TICK line on top foreach ($this->DS as $k => $v) { # matches only once = for c_$casecount__state if (preg_match('/^c_' . $casecount . '__state/', $v['LABEL'], $state_matches)) { $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\" ";
<?php # # Copyright (c) 2006-2012 Joerg Linge (http://www.pnp4nagios.org) # Plugin: check_jmx4perl # Dataset: connector_proc_time # Perfdata: proc_time=1671.9;40000;50000 # $opt[1] = "--vertical-label \"s\" --title \"Processing Time {$hostname} / {$servicedesc}\" "; $def[1] = rrd::def("var1a", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::cdef("var1", "var1a,1000,/"); $def[1] .= rrd::gradient('var1', '#F5F5F5', '#C0C0C0'); $def[1] .= rrd::line1("var1", "#8B0000", $LABEL[1]); $def[1] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%6.3lf %ss"); $def[1] .= rrd::comment("jolokia.org\\r");
$def[$gindex] .= rrd::def("memoryrss", $RRDFILE[$vindex_memoryrss], $DS[$vindex_memoryrss], "AVERAGE"); $def[$gindex] .= rrd::cdef("memrss_mb", "memoryrss,1024,/,1024,/"); $def[$gindex] .= rrd::cdef("fragmented_mb", "memrss_mb,use_mb,-"); $def[$gindex] .= rrd::area("fragmented_mb", "#FFD700", "Allocated Memory", "STACK"); if ($vindex_utilization != -1) { $def[$gindex] .= rrd::def("use_perc", $RRDFILE[$vindex_utilization], $DS[$vindex_utilization], "AVERAGE"); $def[$gindex] .= rrd::cdef("free_perc", "100,use_perc,-"); $def[$gindex] .= rrd::cdef("total_mb", "memrss_mb,use_perc,/,100,*"); $def[$gindex] .= rrd::cdef("free_mb", "total_mb,memrss_mb,-"); $def[$gindex] .= "GPRINT:memrss_mb:LAST:\"%6.1lfMB \\g\" "; $def[$gindex] .= "GPRINT:use_perc:LAST:\" (%2.1lf%%) Last\" "; $def[$gindex] .= "GPRINT:memrss_mb:MAX:\"%6.1lfMB \\g\" "; $def[$gindex] .= "GPRINT:use_perc:MAX:\" (%2.1lf%%) Max\" "; $def[$gindex] .= "GPRINT:memrss_mb:AVERAGE:\"%6.1lfMB \\g\" "; $def[$gindex] .= "GPRINT:use_perc:AVERAGE:\" (%2.1lf%%) Avg\\n\" "; $def[$gindex] .= rrd::cdef("fragmentation_calc", "memrss_mb,use_mb,/"); $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[$def_n] .= rrd::line1("var_{$gr_ndx}", $palette[$palette_ndx][2], sprintf('%-15s', $LABEL[$ds_ndx]), $TYPE); } $def[$def_n] .= rrd::gprint("var_{$gr_ndx}", array("LAST", "AVERAGE", "MAX"), "%6.3lg %s"); $ds_name[$def_n] .= "{$LABEL[$ds_ndx]} "; if (strlen($ds_name[$def_n]) > 70) { $ds_name[$def_n] = substr($ds_name[$def_n], 0, 66) . "..."; } # Line # Draw a line, too, for each area graph, as an outline # These lines go last, so they don't get drawn over by the area graphs # The label is set to '' so these lines do not appear in the legend # The cdef is there to omit line segments with value 0, to prevent 'uninteresting' lines from overwriting the previous line # The value 'UNKN' is plotted as an empty space if ($FILL) { if (!isset($STACK) || $STACK == true) { $cdef_line .= rrd::cdef("line_{$gr_ndx}", "var_{$gr_ndx},var_{$gr_ndx},UNKN,IF"); $cdef_line .= rrd::line1("line_{$gr_ndx}", $palette[$palette_ndx][2], '', $TYPE); } else { $cdef_line .= rrd::line1("var_{$gr_ndx}", $palette[$palette_ndx][2], '', $TYPE); } } } if ($cdef_line != '') { $def[$def_n] .= $cdef_line; } # Put the execution time graph last if (isset($ds_ndx_time)) { $def_n++; $opt[$def_n] = "--title \"Execution time for {$servicedesc} on {$hostname}\" -l 0 "; $ds_name[$def_n] = $LABEL[$ds_ndx_time]; $def[$def_n] = rrd::def('exec_time', $RRDFILE[$ds_ndx_time], $DS[$ds_ndx_time], $MIN_MAX_AVERAGE);