Exemplo n.º 1
0
#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");
Exemplo n.º 2
0
 $vindex_memorypeak = $VAR['used_memory_peak'];
 $vindex_memoryrss = $VAR['used_memory_rss'];
 $vindex_fragmentation = $VAR['mem_fragmentation_ratio'];
 $vindex_utilization = $VAR['memory_utilization'];
 $ds_name[$gindex] = "Redis Memory";
 $opt[$gindex] = "--lower-limit=0 --vertical-label \"MB\" --title \"{$servicedesc} Memory Use on {$hostname}\" ";
 $def[$gindex] = rrd::def("bytes", $RRDFILE[$vindex_usedmemory], $DS[$vindex_usedmemory], "AVERAGE");
 $def[$gindex] .= rrd::def("maxbytes", $RRDFILE[$vindex_memorypeak], $DS[$vindex_memorypeak], "AVERAGE");
 $def[$gindex] .= rrd::cdef("use_mb", "bytes,1024,/,1024,/");
 $def[$gindex] .= rrd::cdef("maxuse_mb", "maxbytes,1024,/,1024,/");
 $def[$gindex] .= rrd::cdef("mfree_mb", "maxbytes,bytes,-,1024,/,1024,/");
 $def[$gindex] .= rrd::area("use_mb", "#00FFFF", "Used Memory     ");
 $def[$gindex] .= "GPRINT:use_mb:LAST:\"%6.1lfMB Last \" ";
 $def[$gindex] .= "GPRINT:use_mb:MAX:\"%6.1lfMB Max \" ";
 $def[$gindex] .= "GPRINT:use_mb:AVERAGE:\"%6.1lfMB Avg \\n\" ";
 $def[$gindex] .= rrd::line1("maxuse_mb", "#0000FF", "Max Used Memory ");
 $def[$gindex] .= "GPRINT:maxuse_mb:LAST:\"%6.1lfMB Last \" ";
 $def[$gindex] .= "GPRINT:maxuse_mb:MAX:\"%6.1lfMB Max \" ";
 $def[$gindex] .= "GPRINT:maxuse_mb:AVERAGE:\"%6.1lfMB Avg \\n\" ";
 if ($vindex_memoryrss != -1) {
     $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\" ";
Exemplo n.º 3
0
 public static function alerter_gr($vname = FALSE, $label = FALSE, $warning = FALSE, $critical = FALSE, $opacity = 'ff', $unit, $color_green = '#00ff00', $color_btw = '#ffff00', $color_red = '#ff0000', $line_col = '#0000ff', $start_color = "#ffffff")
 {
     if ($vname === FALSE) {
         throw new Kohana_exception("rrd::" . __FUNCTION__ . "() First Parameter 'vname' is missing");
     }
     if ($label === FALSE) {
         throw new Kohana_exception("rrd::" . __FUNCTION__ . "() Second Parameter 'label' is missing");
     }
     if ($warning === FALSE) {
         throw new Kohana_exception("rrd::" . __FUNCTION__ . "() Third Parameter 'warning' is missing");
     }
     if ($critical === FALSE) {
         throw new Kohana_exception("rrd::" . __FUNCTION__ . "() Fourth Parameter 'critical' is missing");
     }
     $line = "";
     $green_vname = "var" . substr(sha1(rand()), 1, 4);
     $btw_vname = "var" . substr(sha1(rand()), 1, 4);
     $blue_vname = "var" . substr(sha1(rand()), 1, 4);
     $red_vname = "var" . substr(sha1(rand()), 1, 4);
     $line = "";
     if ($warning < $critical) {
         $line .= "CDEF:" . $green_vname . "=" . $vname . "," . $warning . ",LT," . $vname . ",UNKN,IF ";
         $line .= "CDEF:" . $btw_vname . "=" . $vname . "," . $critical . ",LT," . $vname . ",UNKN,IF ";
         $line .= "CDEF:" . $blue_vname . "=" . $btw_vname . "," . $warning . ",GE," . $btw_vname . ",UNKN,IF ";
         $line .= "CDEF:" . $red_vname . "=" . $vname . "," . $critical . ",GE," . $vname . ",UNKN,IF ";
     } else {
         $line .= "CDEF:" . $green_vname . "=" . $vname . "," . $warning . ",GT," . $vname . ",UNKN,IF ";
         $line .= "CDEF:" . $btw_vname . "=" . $vname . "," . $critical . ",GE," . $vname . ",UNKN,IF ";
         $line .= "CDEF:" . $blue_vname . "=" . $btw_vname . "," . $warning . ",LE," . $btw_vname . ",UNKN,IF ";
         $line .= "CDEF:" . $red_vname . "=" . $vname . "," . $critical . ",LT," . $vname . ",UNKN,IF ";
     }
     $line .= rrd::gradient($green_vname, $start_color, $color_green . $opacity);
     $line .= rrd::gradient($blue_vname, $start_color, $color_btw . $opacity);
     $line .= rrd::gradient($red_vname, $start_color, $color_red . $opacity);
     $line .= rrd::line1($vname, $line_col, $label);
     return $line;
 }
Exemplo n.º 4
0
     $def[$casecount_int] .= rrd::line1("case_diff{$casecount}", $col_case_runtime_line, "", 1);
 } else {
     # no steps, no stacks
     $def[$casecount_int] .= rrd::area("case{$casecount}", $col_case_runtime_area, $casename);
     $def[$casecount_int] .= rrd::line1("case{$casecount}", $col_case_runtime_line, "");
 }
 $def[$casecount_int] .= rrd::gprint("case{$casecount}", "LAST", "%3.2lf s LAST");
 $def[$casecount_int] .= rrd::gprint("case{$casecount}", "MAX", "%3.2lf s MAX ");
 $def[$casecount_int] .= rrd::gprint("case{$casecount}", "AVERAGE", "%3.2lf s AVG \\j");
 $def[0] .= rrd::comment(" \\n");
 # Case graph, Warn/Crit LINE  ##########################################################
 foreach ($this->DS as $k => $v) {
     if (preg_match('/^c_' . $casecount . '__(warning|critical)/', $v['LABEL'], $matches)) {
         $threshold = $matches[1];
         $def[$casecount_int] .= rrd::def("case_" . $casecount . "__" . $threshold, $v["RRDFILE"], $v["DS"], "AVERAGE");
         $def[$casecount_int] .= rrd::line1("case_" . $casecount . "__" . $threshold, ${"col_" . $threshold}, $threshold . " at \\g", 0);
         $def[$casecount_int] .= rrd::gprint("case_" . $casecount . "__" . $threshold, "LAST", "%3.0lf s ");
     }
 }
 $def[$casecount_int] .= rrd::comment(" \\n");
 $def[$casecount_int] .= rrd::comment(" \\n");
 #######################
 # TICKS for case state
 #######################
 $def[$casecount_int] .= rrd::comment("State ticker legend\\:");
 $def[$casecount_int] .= rrd::comment(" \\n");
 # TICKS for incomplete data ("data" = step/case LINE) ######################################################
 # - complete data   -->  case_unknown_total == 0 --> no TICK (resp. warn/crit TICK)
 # - incomplete data -->  0 < case_unknown_total < case_data_count --> orange TICK (overwrites evt warn/crit TICKS)
 # - no data at all  -->  case_unknown_total == case_data_count --> no TICK
 # see comments in case tick
Exemplo n.º 5
0
        $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");
    }
}
Exemplo n.º 6
0
  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/>.
*/
$opt[1] = "--slope-mode --vertical-label Load -l0 --title \"CPU Load for {$hostname} / {$servicedesc}\" ";
$DS_1 = $this->DS[0];
$DS_5 = $this->DS[1];
$DS_15 = $this->DS[2];
$C15 = '#FF0000';
$C5 = '#0000FF';
$C1 = '#EACC00';
$def[1] = rrd::def("var1", $DS_1['RRDFILE'], $DS_1['DS']);
$def[1] .= rrd::def("var2", $DS_5['RRDFILE'], $DS_5['DS']);
$def[1] .= rrd::def("var3", $DS_15['RRDFILE'], $DS_15['DS']);
$def[1] .= rrd::area("var1", $C1, "Load 1");
$def[1] .= rrd::gprint("var1", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
$def[1] .= rrd::line1("var2", $C5, "Load 5");
$def[1] .= rrd::gprint("var2", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
$def[1] .= rrd::line1("var3", $C15, "Load 15");
$def[1] .= rrd::gprint("var3", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
Exemplo n.º 7
0
# http://labs.consol.de/nagios/mod-gearman
#
$i = 0;
$color['waiting'] = '#F46312';
$color['running'] = '#0354E4';
$color['worker'] = '#00C600';
foreach ($this->DS as $KEY => $VAL) {
    if (preg_match('/(.*)_([^_].*)$/', $VAL['LABEL'], $matches)) {
        $queue = $matches[1];
        $state = $matches[2];
        if ($state == "waiting") {
            $i++;
            $opt[$i] = '';
            $def[$i] = '';
        }
        $opt[$i] = "-l0 --title \"Gearman Queue '{$queue}'\" ";
        #
        $ds_name[$i] = "{$queue}";
        $def[$i] .= rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
        $def[$i] .= rrd::line1("var{$KEY}", $color[$state], rrd::cut($state, 16));
        $def[$i] .= rrd::gprint("var{$KEY}", array('LAST', 'MAX', 'AVERAGE'), "%6.2lf" . $VAL['UNIT']);
    } else {
        $i++;
        $opt[$i] = "-l0 --title \"Gearman Statistics\" ";
        #
        $ds_name[$i] = $VAL['NAME'];
        $def[$i] = rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
        $def[$i] .= rrd::line1("var{$KEY}", '#00C600', rrd::cut($VAL['NAME'], 16));
        $def[$i] .= rrd::gprint("var{$KEY}", array('LAST', 'MAX', 'AVERAGE'), "%6.2lf");
    }
}
Exemplo n.º 8
0
# Copyright (c) 2012 Anders Håål Ingenjörsbyn, based on check_load
# Plugin: check_bischeck
#
#
#
#
$index = 1;
foreach ($DS as $i => $VAL) {
    if (!isset($def[$index])) {
        $def[$index] = "";
    }
    $def[$index] .= "DEF:var{$i}={$RRDFILE[$i]}:{$DS[$i]}:AVERAGE ";
    if (!preg_match('/^threshold$/', $NAME[$i], $matches)) {
        $opt[$index] = "--title \"{$hostname} / {$servicedesc} / {$NAME[$i]} \" ";
        $def[$index] .= rrd::gradient("var{$i}", "ff5c00", "ffdc00", "{$NAME[$i]}", 20);
        $def[$index] .= rrd::line1("var{$i}", "#000000");
        $def[$index] .= rrd::gprint("var{$i}", "LAST", "%6.0lf \\n");
    } else {
        $def[$index] .= rrd::line2("var{$i}", "#555210", "{$NAME[$i]}");
        $def[$index] .= rrd::gprint("var{$i}", "LAST", "%6.0lf \\n");
        $val = $i - 1;
        if ($WARN[$val] != "") {
            $def[$index] .= rrd::hrule($WARN[$val], "#FFFF00", "Warning   " . $WARN[$val] . $UNIT[$val] . "\\n");
        }
        if ($CRIT[$val] != "") {
            $def[$index] .= rrd::hrule($CRIT[$val], "#FF0000", "Critical  " . $CRIT[$val] . $UNIT[$val] . "\\n");
        }
        $index = $index + 1;
    }
}
?>
Exemplo n.º 9
0
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# $Id$
#
$ds_name[1] = "Memory Usage";
$opt[1] = "-l0  --title \"Memory Usage for {$hostname}\" ";
$def[1] = rrd::def("tot", $RRDFILE[1], $DS[1], "AVERAGE");
$def[1] .= rrd::def("slab", $RRDFILE[1], $DS[2], "AVERAGE");
$def[1] .= rrd::def("swapcached", $RRDFILE[1], $DS[3], "AVERAGE");
$def[1] .= rrd::def("pagetables", $RRDFILE[1], $DS[4], "AVERAGE");
$def[1] .= rrd::def("apps", $RRDFILE[1], $DS[5], "AVERAGE");
$def[1] .= rrd::def("memfree", $RRDFILE[1], $DS[6], "AVERAGE");
$def[1] .= rrd::def("buffers", $RRDFILE[1], $DS[7], "AVERAGE");
$def[1] .= rrd::def("cached", $RRDFILE[1], $DS[8], "AVERAGE");
$def[1] .= rrd::def("swap", $RRDFILE[1], $DS[9], "AVERAGE");
$def[1] .= rrd::line1("tot", "#000000", "Total memory");
$def[1] .= rrd::gprint("tot", array("LAST"), "%6.2lf%s");
$def[1] .= rrd::area("apps", "#FF0000", "Applications");
$def[1] .= rrd::gprint("apps", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s");
$def[1] .= rrd::area("pagetables", "#0000FF", "Page Table  ", true);
$def[1] .= rrd::gprint("pagetables", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s");
$def[1] .= rrd::area("slab", "#00FFFF", "Slab        ", true);
$def[1] .= rrd::gprint("slab", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s");
$def[1] .= rrd::area("swapcached", "#FF8000", "Swap Cache  ", true);
$def[1] .= rrd::gprint("swapcached", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s");
$def[1] .= rrd::area("cached", "#FFFF00", "Cache       ", true);
$def[1] .= rrd::gprint("cached", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s");
$def[1] .= rrd::area("buffers", "#80FF00", "Buffer      ", true);
$def[1] .= rrd::gprint("buffers", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s");
$def[1] .= rrd::area("memfree", "#00FF00", "Free        ", true);
$def[1] .= rrd::gprint("memfree", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s");
Exemplo n.º 10
0
#
#
#$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\" ";
#
#
#
$ds_name[2] = "Errors and updates";
$def[2] = '';
for ($i = 2; $i <= sizeof($DS); $i++) {
    $def[2] .= rrd::def("var{$i}", $RRDFILE[$i], $DS[$i], "AVERAGE");
    $def[2] .= rrd::line1("var{$i}", rrd::color($i), rrd::cut(ucfirst($LABEL[$i]), 12));
    $def[2] .= rrd::gprint("var{$i}", array('LAST', 'MAX', 'AVERAGE'), "%4.0lf{$UNIT[$i]}");
}
<?php

#
# Copyright (c) 2006-2012 Joerg Linge (http://www.pnp4nagios.org)
# Plugin: check_jmx4perl
# Dataset: connector_errors
# Perfdata: errors=0;90;100
#
$opt[1] = "--force-rules-legend -X0 --vertical-label \"Errors\" --title \"Connector Errors {$hostname} / {$servicedesc}\" ";
$def[1] = rrd::def("var1", $RRDFILE[1], $DS[1], "AVERAGE");
$def[1] .= rrd::area("var1", "#D9D9D9");
$def[1] .= rrd::line1("var1", "#B10026", $LABEL[1]);
if ($WARN[1] != "") {
    $def[1] .= "HRULE:{$WARN['1']}#FFFF00 ";
}
if ($CRIT[1] != "") {
    $def[1] .= "HRULE:{$CRIT['1']}#FF0000 ";
}
$def[1] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%.0lf");
$def[1] .= rrd::comment("jolokia.org\\r");
Exemplo n.º 12
0
  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/>.
*/
//$fp = fopen('/tmp/test', 'a');
//ob_start();
//print_r($this->DS);
$DS_gc1_count = $this->DS[0];
$DS_gc2_count = $this->DS[1];
$DS_gc1_time = $this->DS[2];
$DS_gc2_time = $this->DS[3];
$opt[1] = "--vertical-label \"GC usage\" -l 0 --title \"{$hostname} - GC usage\" ";
$def[1] = rrd::def("var1", $DS_gc1_count['RRDFILE'], $DS_gc1_count['DS']);
$def[1] .= rrd::def("var2", $DS_gc2_count['RRDFILE'], $DS_gc2_count['DS']);
$def[1] .= rrd::def("var3", $DS_gc1_time['RRDFILE'], $DS_gc1_time['DS']);
$def[1] .= rrd::def("var4", $DS_gc2_time['RRDFILE'], $DS_gc2_time['DS']);
$def[1] .= rrd::line1("var1", "#00FF00", $DS_gc1_count['NAME']);
$def[1] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%3.2lfcount/s");
$def[1] .= rrd::line1("var2", "#0000FF", $DS_gc2_count['NAME']);
$def[1] .= rrd::gprint("var2", array("LAST", "MAX", "AVERAGE"), "%3.2lfcount/s");
$def[1] .= rrd::line2("var3", "#FFFF00", $DS_gc1_time['NAME']);
$def[1] .= rrd::gprint("var3", array("LAST", "MAX", "AVERAGE"), "%3.2lfms/s");
$def[1] .= rrd::line2("var4", "#FF00FF", $DS_gc2_time['NAME']);
$def[1] .= rrd::gprint("var4", array("LAST", "MAX", "AVERAGE"), "%3.2lfms/s");
// Debug
//$content = ob_get_clean();
//fwrite($fp, "$content\n");
//fclose($fp);
Exemplo n.º 13
0
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* This file is part of the nagios-puppet bundle that can be found
* at https://github.com/jasonhancock/nagios-memory
*/
$alpha = 'CC';
$colors = array('#00FF00' . $alpha, '#000066' . $alpha, '#25345C' . $alpha, '#88008A' . $alpha, '#4F7774' . $alpha);
$opt[1] = sprintf('-T 55 -l 0 --vertical-label "Bytes" --title "%s / Network Traffic"', $hostname);
$def[1] = '';
$count = 0;
foreach ($DS as $i) {
    $def[1] .= rrd::def("var{$i}", $rrdfile, $DS[$i], 'AVERAGE');
    if ($i == '1') {
        $def[1] .= rrd::area("var{$i}", $colors[$count], rrd::cut(ucfirst($NAME[$i]), 15));
    } else {
        $def[1] .= rrd::line1("var{$i}", $colors[$count], rrd::cut(ucfirst($NAME[$i]), 15), 'STACK');
    }
    $def[1] .= rrd::gprint("var{$i}", array('LAST', 'MAX', 'AVERAGE'), "%4.2lf %s\t");
    $count++;
}
Exemplo n.º 14
0
<?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");
# 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");
}
Exemplo n.º 16
0
     $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");
 }
 # create critical line and legend
 if ($VAL['CRIT'] != "") {
<?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");
Exemplo n.º 18
0
 public static function alerter($vname = FALSE, $label = FALSE, $warning = FALSE, $critical = FALSE, $opacity = 'ff', $unit, $color_green = '#00ff00', $color_btw = '#ffff00', $color_red = '#ff0000', $line_col = '#0000ff')
 {
     if ($vname === FALSE) {
         throw new Kohana_exception("rrd::" . __FUNCTION__ . "() First Parameter 'vname' is missing");
     }
     if ($label === FALSE) {
         throw new Kohana_exception("rrd::" . __FUNCTION__ . "() Second Parameter 'label' is missing");
     }
     if ($warning === FALSE) {
         throw new Kohana_exception("rrd::" . __FUNCTION__ . "() Third Parameter 'warning' is missing");
     }
     if ($critical === FALSE) {
         throw new Kohana_exception("rrd::" . __FUNCTION__ . "() Fourth Parameter 'critical' is missing");
     }
     $line = "";
     $line .= "CDEF:green=" . $vname . "," . $warning . ",LT," . $vname . ",UNKN,IF ";
     $line .= "CDEF:btw=" . $vname . "," . $critical . ",LT," . $vname . ",UNKN,IF ";
     $line .= "CDEF:blue=btw," . $warning . ",GE,btw,UNKN,IF ";
     $line .= "CDEF:red=" . $vname . "," . $critical . ",GE," . $vname . ",UNKN,IF ";
     $line .= rrd::area("green", $color_green . $opacity);
     $line .= rrd::area("blue", $color_btw . $opacity);
     $line .= rrd::area("red", $color_red . $opacity);
     $line .= rrd::line1($vname, $line_col, $label);
     return $line;
 }
<?php

$ds_name[1] = "Cisco Current Rate";
$opt[1] = "--vertical-label 'Rate' -l0 --title \"Current Rate for {$hostname}\" ";
$def[1] = rrd::def("Download", $RRDFILE[1], $DS[1], "AVERAGE");
$def[1] .= rrd::line1("Download", "#11dd33", "Download");
$def[1] .= rrd::gprint("Download", array("LAST", "MAX", "AVERAGE"), "%6.0lf");
$def[1] .= rrd::def("Upload", $RRDFILE[2], $DS[1], "AVERAGE");
$def[1] .= rrd::line1("Upload", "#ff33b9", "Upload");
$def[1] .= rrd::gprint("Upload", array("LAST", "MAX", "AVERAGE"), "%6.0lf");
?>

Exemplo n.º 20
0
// 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::area("v_swused", "#3D3D3D", "Swap used", true);
$def[1] .= rrd::gprint("v_swused", array("AVERAGE", "MAX", "LAST"), "{$fmt}{$unit_scale}");
$def[1] .= rrd::area("v_swfree", "#DDDDDD", "Swap free", true);
$def[1] .= rrd::gprint("v_swfree", "LAST", "{$fmt}{$unit_scale}\\n");
$def[1] .= rrd::line1("v_real_used", "#000000");
// Draw total
$def[1] .= rrd::line1("v_total", "#009900", "Total");
$def[1] .= rrd::gprint("v_total", "LAST", "{$fmt}{$unit_scale}\\n");
// Debug
//fwrite($fp, ob_get_clean());
//fclose($fp);
Exemplo n.º 21
0
            if (isset($def[$id_fan])) {
                $def[$id_fan] .= rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
            } else {
                $def[$id_fan] = rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
            }
            $def[$id_fan] .= rrd::line1("var{$KEY}", "#" . $colors[$f++], rrd::cut($label, 18));
            $def[$id_fan] .= rrd::gprint("var{$KEY}", array("LAST", "MAX", "AVERAGE"), "%6.0lf RPM");
        }
        # ENCLOSURE TEMPERATURES (Celsius)
        if (preg_match('/^E(?P<encl>.+?)_t(emp_)?(?P<probe>\\d+)/', $label, $matches)) {
            $this_id = $matches['encl'];
            $probe_index = $matches['probe'];
            if ($enclosure_id != $this_id) {
                $e = 0;
                $id_enc++;
                $enclosure_id = $this_id;
            }
            # Label
            $label = "Probe {$probe_index}";
            $ds_name[$id_enc] = "Enclosure {$enclosure_id} Temperatures";
            $opt[$id_enc] = "--slope-mode --vertical-label \"Celsius\" --title \"{$def_title}: Enclosure {$enclosure_id} Temperatures\" ";
            if (isset($def[$id_enc])) {
                $def[$id_enc] .= rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
            } else {
                $def[$id_enc] = rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
            }
            $def[$id_enc] .= rrd::line1("var{$KEY}", "#" . $colors[$e++], rrd::cut($label, 14));
            $def[$id_enc] .= rrd::gprint("var{$KEY}", array("LAST", "MAX", "AVERAGE"), "%6.1lf C");
        }
    }
}
Exemplo n.º 22
0
     $ds_name[1] = "DB Freespace %";
     $def[1] .= rrd::def("var" . $KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
     $def[1] .= rrd::line1("var" . $KEY, rrd::color($KEY), rrd::cut($dsname, 12));
     $def[1] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%3.2lf%%");
 }
 if (preg_match('/^db_(.*)_free$/', $VAL['NAME'], $match)) {
     $dsname = $match[1];
     if (empty($opt[2])) {
         $opt[2] = "--vertical-label \"MB\" --title \"DB Freespace MB\" ";
     }
     if (empty($def[2])) {
         $def[2] = "";
     }
     $ds_name[2] = "DB Freespace MB";
     $def[2] .= rrd::def("var" . $KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
     $def[2] .= rrd::line1("var" . $KEY, rrd::color($KEY), rrd::cut($dsname, 12));
     $def[2] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%3.2lf %SM");
 }
 if (preg_match('/^select$/', $VAL['NAME'])) {
     $ds_name[$defcnt] = "Output from sql-query for {$servicedesc}";
     $opt[$defcnt] = "--vertical-label \"Counts\" --title \"Output from sql-query for {$servicedesc} on {$hostname}\" ";
     $def[$defcnt] = "";
     $def[$defcnt] .= rrd::def("var" . $KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE:reduce=LAST");
     $def[$defcnt] .= rrd::area("var" . $KEY, "#111111");
     $def[$defcnt] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%3.2lf Counts");
     $defcnt++;
 }
 if (preg_match('/^(.*)bck_age$/', $VAL['NAME'])) {
     $ds_name[$defcnt] = "Last DB Backup";
     $opt[$defcnt] = "--vertical-label \"Hours\" --title \"Last DB Backup\" ";
     $def[$defcnt] = "";
Exemplo n.º 23
0
 }
 if ($VAL['MAX'] != "" && is_numeric($VAL['MAX'])) {
     $maximum = $VAL['MAX'];
 }
 if ($VAL['UNIT'] == "%%") {
     $vlabel = "%";
     $upper = " --upper=101 ";
     $lower = " --lower=0 ";
 } 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");
$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] != "") {
    $def[1] .= "HRULE:{$WARN['2']}#ffff00:\"Warning threshold for Processes\\j\" ";
}
if ($CRIT[2] != "") {
    $def[1] .= "HRULE:{$CRIT['2']}#ff0000:\"Critical threshold for Processes\" ";
}
Exemplo n.º 25
0
<?php

#
# Copyright (c) 2006-2010 Joerg Linge (http://www.pnp4nagios.org)
# Plugin: check_iostat.php
#
#
$ds_name[1] = "check iostat";
$opt[1] = "--lower-limit 0 --vertical-label \"check iostat\"  --title \"check iostat\" ";
$def[1] = rrd::def("var1", $RRDFILE[1], $DS[1], "AVERAGE");
$def[1] .= rrd::gradient("var1", "ff5c00", "ffdc00", "check iostat", 10);
$def[1] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%.0lf {$UNIT['1']}");
$def[1] .= rrd::line1("var1", "#000000");
if ($WARN[1] != "") {
    if ($UNIT[1] == "%%") {
        $UNIT[1] = "%";
    }
    $def[1] .= rrd::hrule($WARN[1], "#FFFF00", "Warning  " . $WARN[1] . $UNIT[1] . "\\n");
}
if ($CRIT[1] != "") {
    if ($UNIT[1] == "%%") {
        $UNIT[1] = "%";
    }
    $def[1] .= rrd::hrule($CRIT[1], "#FF0000", "Critical " . $CRIT[1] . $UNIT[1] . "\\n");
}
<?php

$_WARNRULE = '#FFFF00';
$_CRITRULE = '#FF0000';
$_AREA = '#256aef';
$_LINE = '#3152A5';
$_MAXRULE = '#000000';
$colors = array("#FF0000", "#336600", "#6600FF", "#FF3300", "#339900", "#6633FF", "#FF6600", "#6600FF", "#6666FF", "#FF9900", "#33FF00", "#6699FF", "#FFCC00", "#33FF33", "#66CCFF", "#FFFF00", "#66CC00", "#66FFFF");
$j = 0;
$opt[1] = '--slope-mode -l0 --title "' . $this->MACRO['DISP_HOSTNAME'] . ' / ' . $this->MACRO['DISP_SERVICEDESC'] . '"';
$def[1] = '';
# Debugging Code
# throw new Kohana_exception(print_r($this->DS,true));
# sort by ACT (Last) Value. Highest Value goes into Background.
usort($this->DS, function ($a, $b) {
    return $b['ACT'] - $a['ACT'];
});
foreach ($this->DS as $KEY => $VAL) {
    $def[1] .= rrd::def("var{$KEY}", $this->DS[$KEY]['RRDFILE'], $this->DS[$KEY]['DS'], "AVERAGE");
    $def[1] .= rrd::area("var{$KEY}", $colors[$j] . "70", rrd::cut($this->DS[$KEY]["NAME"], 40));
    $def[1] .= rrd::line1("var{$KEY}", "#000");
    $def[1] .= rrd::gprint("var{$KEY}", array("AVERAGE", "MAX", "LAST"), "%5.0lf");
    $j++;
}
Exemplo n.º 27
0
# 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, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# $Id$
#
$opt[1] = "--vertical-label \"bits per second\" --title \"Traffic {$hostname} / {$servicedesc}\" ";
$opt[2] = "--vertical-label \"errors per second\" --title \"Error {$hostname} / {$servicedesc}\" ";
$ds_name[1] = "Traffic";
$ds_name[2] = "Error";
$def[1] = rrd::def("ifInOctets", $RRDFILE[1], $DS[1], "AVERAGE");
$def[1] .= rrd::def("ifOutOctets", $RRDFILE[3], $DS[3], "AVERAGE");
$def[1] .= rrd::def("ifSpeed", $RRDFILE[5], $DS[5], "AVERAGE");
$def[1] .= rrd::vdef('ifSpeedLast', 'ifSpeed,LAST');
$def[2] = rrd::def("ifInErrors", $RRDFILE[2], $DS[2], "AVERAGE");
$def[2] .= rrd::def("ifOutErrors", $RRDFILE[4], $DS[4], "AVERAGE");
$def[1] .= rrd::hrule("ifSpeedLast", "#000000", rrd::cut("Speed", 10));
$def[1] .= rrd::gprint("ifSpeed", array("LAST"), "%6.2lf%sbit/s");
$def[1] .= rrd::area("ifInOctets", "#00FF00", rrd::cut("Inbound", 10));
$def[1] .= rrd::gprint("ifInOctets", array("LAST", "MAX", "AVERAGE"), "%6.2lf%sbit/s");
$def[1] .= rrd::line1("ifOutOctets", "#0000FF", rrd::cut("Outbound", 10));
$def[1] .= rrd::gprint("ifOutOctets", array("LAST", "MAX", "AVERAGE"), "%6.2lf%sbit/s");
$def[2] .= rrd::area("ifInErrors", "#800000", rrd::cut("Inbound", 10));
$def[2] .= rrd::gprint("ifInErrors", array("LAST", "MAX", "AVERAGE"), "%4.2lf%s errors/s");
$def[2] .= rrd::area("ifOutErrors", "#FF0000", rrd::cut("Outbound", 10), true);
$def[2] .= rrd::gprint("ifOutErrors", array("LAST", "MAX", "AVERAGE"), "%4.2lf%s errors/s");
# vim: set ts=4 sw=4 et syn=php :
Exemplo n.º 28
0
$def[0] .= "AREA:sp8#0000C0: ";
$def[0] .= "AREA:sp7#0010F0: ";
$def[0] .= "AREA:sp6#0040F0: ";
$def[0] .= "AREA:sp5#0070F0: ";
$def[0] .= "AREA:sp4#00A0F0: ";
$def[0] .= "AREA:sp3#00D0F0: ";
$def[0] .= "AREA:sp2#A0F0F0: ";
$def[0] .= "AREA:sp1#F0F0F0: ";
$ds_name[1] = "Memcached Client Connections";
$opt[1] = "--lower-limit=0 --vertical-label \"connections\" --title \"{$servicedesc} Connections to {$hostname}\" ";
$def[1] = rrd::def("curr_conn", $RRDFILE[4], $DS[4], "AVERAGE");
$def[1] .= rrd::def("conn_rate", $RRDFILE[12], $DS[12], "AVERAGE");
$def[1] .= rrd::def("conn_struct", $RRDFILE[16], $DS[16], "AVERAGE");
$def[1] .= rrd::area("curr_conn", "#00FF00", "Current Number of Connections");
$def[1] .= rrd::gprint("curr_conn", array("LAST", "MAX", "AVERAGE"), "%3.0lf ");
$def[1] .= rrd::line1("conn_rate", "#0000FF", "New Connnections Per Second  ");
$def[1] .= rrd::gprint("conn_rate", array("LAST", "MAX", "AVERAGE"), "%3.0lf ");
# $def[1] .= rrd::line1("conn_struct", "#000000", "Connection Structures");
$def[1] .= rrd::comment("- Total Connection Structures ");
$def[1] .= rrd::gprint("conn_struct", array("LAST", "MAX", "AVERAGE"), "%3.0lf ");
$ds_name[2] = "Data Traffic";
$opt[2] = " --vertical-label \"bits/sec\" -b 1000 --title \"{$servicedesc} Net Traffic on {$hostname}\" ";
$def[2] = "DEF:bytes_read={$RRDFILE['21']}:{$DS['21']}:AVERAGE ";
$def[2] .= "DEF:bytes_written={$RRDFILE['7']}:{$DS['7']}:AVERAGE ";
$def[2] .= "CDEF:out_bits=bytes_written,8,* ";
$def[2] .= "AREA:out_bits#00ff00:\"out\" ";
$def[2] .= "GPRINT:out_bits:LAST:\"%7.2lf %Sbit/s last\" ";
$def[2] .= "GPRINT:out_bits:AVERAGE:\"%7.2lf %Sbit/s avg\" ";
$def[2] .= "GPRINT:out_bits:MAX:\"%7.2lf %Sbit/s max\\n\" ";
$def[2] .= "CDEF:in_bits=bytes_read,8,* ";
$def[2] .= "LINE1:in_bits#0000ff:\"in \" ";
Exemplo n.º 29
0
}
#
# Bytes per Second
#
$i++;
$def[$i] = "";
$opt[$i] = " --title 'Bytes per Second'";
$ds_name[$i] = "Bytes/s";
$regex = '/BytesPerSec/';
foreach ($this->DS as $KEY => $VAL) {
    if (preg_match($regex, $VAL['NAME'])) {
        $def[$i] .= rrd::def("var" . $KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
        $def[$i] .= rrd::line1("var" . $KEY, rrd::color($KEY), rrd::cut($VAL['NAME'], 16), 'STACK');
        $def[$i] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%6.1lf %sb/s");
    }
}
#
# Stats
#
$i++;
$def[$i] = "";
$opt[$i] = " --title 'Worker States'";
$ds_name[$i] = "Worker States";
$regex = '/Starting|DNS|Reading|Sending|Keepalive|Closing|Logging|Finishing/';
foreach ($this->DS as $KEY => $VAL) {
    if (preg_match($regex, $VAL['NAME'])) {
        $def[$i] .= rrd::def("var" . $KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
        $def[$i] .= rrd::line1("var" . $KEY, rrd::color($KEY), rrd::cut($VAL['NAME'], 16), 'STACK');
        $def[$i] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%6.0lf" . $VAL['UNIT']);
    }
}
#-------------------------------------------------------------------------------
#   Label and Titel settings
#-------------------------------------------------------------------------------
$ifname = str_replace("Test_Network_Traffic_", "", $servicedesc);
$ifname = str_replace("_", "/", $ifname);
$ds_name[1] = "Interface Utilization for {$hostname}";
$opt[1] .= "--vertical-label \"bps\" ";
$opt[1] .= "--slope-mode --lower=0 ";
$opt[1] .= "--title \"Interface Utilization in bits per second for {$ifname}\" ";
$opt[1] .= "--watermark=\"Template: " . $TEMPLATE[1] . " by Marek Zavesicky\" ";
$ds_name[2] = "Interface Errors and Discards for {$hostname}";
$opt[2] .= "--vertical-label \"{$UNIT['3']}\" ";
$opt[2] .= "--slope-mode --lower=0 ";
$opt[2] .= "--title \"Interface Utilization in packets per second for {$ifname}\" ";
$opt[2] .= "--watermark=\"Template: " . $TEMPLATE[1] . " by Marek Zavesicky\" ";
#
#   Body definition graph
#-------------------------------------------------------------------------------
foreach ($DS as $I) {
    if (preg_match('/.*octets/', $NAME[$I]) ? true : false) {
        $def[1] .= rrd::def("var{$I}", $rrdfile, $DS[$I], 'AVERAGE');
        $def[1] .= rrd::area("var{$I}", $A_COLORS[$I], rrd::cut($LABELS[$I], $slen));
        $def[1] .= rrd::line1("var{$I}", $L_COLORS[$I]);
        $def[1] .= rrd::gprint("var{$I}", array("AVERAGE", "MAX", "LAST"), "%8.2lf%s");
    } else {
        $def[2] .= rrd::def("var{$I}", $rrdfile, $DS[$I], 'AVERAGE');
        $def[2] .= rrd::area("var{$I}", $A_COLORS[$I], rrd::cut($LABELS[$I], $slen));
        $def[2] .= rrd::line1("var{$I}", $L_COLORS[$I]);
        $def[2] .= rrd::gprint("var{$I}", array("AVERAGE", "MAX", "LAST"), "%8.2lf%s");
    }
}