当前位置: 首页>>代码示例>>PHP>>正文


PHP rrd类代码示例

本文整理汇总了PHP中rrd的典型用法代码示例。如果您正苦于以下问题:PHP rrd类的具体用法?PHP rrd怎么用?PHP rrd使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了rrd类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

        $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] = "";
        $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('/^sql_runtime$/', $VAL['NAME'])) {
        $ds_name[$defcnt] = "SQL runtime";
        $opt[$defcnt] = "--vertical-label \"Seconds\" --title \"Execution time of the SQL statement\" ";
        $def[$defcnt] = "";
        $def[$defcnt] .= rrd::def("runtime", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE:reduce=LAST");
        $def[$defcnt] .= rrd::area("runtime", "#111111");
        $def[$defcnt] .= rrd::gprint("runtime", array("LAST", "MAX", "AVERAGE"), "%3.2lf Seconds");
        $defcnt++;
    }
}
开发者ID:rbarraud,项目名称:pnp4nagios,代码行数:31,代码来源:check_mssql_health.php

示例2: array

# 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 :
开发者ID:khanchan,项目名称:monitoringplug,代码行数:31,代码来源:check_interface.php

示例3: foreach

}
#
# 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']);
    }
}
开发者ID:rbarraud,项目名称:pnp4nagios,代码行数:31,代码来源:check_apachestatus_auto.php

示例4: Copyright

<?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];
$DS_status = $this->DS[1];
$opt[1] = "-l0 --title \"{$hostname} / Openoffice server\" ";
$def[1] = rrd::def("var1", $DS_time['RRDFILE'], $DS_time['DS']);
$def[1] .= rrd::def("var2", $DS_status['RRDFILE'], $DS_status['DS']);
$def[1] .= rrd::gradient("var1", "#00FFFF", "#0000FF", "Time");
$def[1] .= rrd::gprint("var1", array("LAST", "AVERAGE", "MIN", "MAX"), "%4.2lfs");
$def[1] .= rrd::ticker("var2", 2, 1, -0.05, "ff", "#00ff00", "#ff8c00", "#ff0000");
开发者ID:pschuermann,项目名称:adminutils,代码行数:27,代码来源:check_snmp_openoffice.php

示例5: Copyright

<?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");
}
开发者ID:rockysays,项目名称:NagiosPlugins,代码行数:25,代码来源:check_iostat.php

示例6: prep_name

function prep_name($name)
{
    return rrd::cut(ucwords(str_replace('_', ' ', $name)), 15);
}
开发者ID:schatt,项目名称:nagios-mysql,代码行数:4,代码来源:check_mysql_selects.php

示例7: array

        } 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");
    }
}
开发者ID:NeilBryant,项目名称:check_mk,代码行数:31,代码来源:default.php

示例8: asort

# 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");
}
开发者ID:gluster,项目名称:nagios-server-plugins-gluster,代码行数:31,代码来源:check_interfaces.php

示例9: array

<?php

$alpha = 'CC';
$colors = array('#00FF00' . $alpha, '#0000FF' . $alpha);
$ds_name[1] = 'Duplication';
$opt[1] = "-T 55 --vertical-label \"Percent\" --title \"{$hostname} / PuppetDB Duplication\"";
$def[1] = '';
foreach ($DS as $i) {
    $def[1] .= rrd::def("var{$i}", $rrdfile, $DS[$i], 'AVERAGE');
    $def[1] .= rrd::line2("var{$i}", $colors[$i - 1], rrd::cut(ucfirst($NAME[$i]), 15));
    $def[1] .= rrd::gprint("var{$i}", array('LAST', 'AVERAGE', 'MAX'), "%4.2lf %s\\t");
}
开发者ID:Ensighten,项目名称:nagios-puppetdb,代码行数:12,代码来源:check_puppetdb_dups.php

示例10: array

$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 ");
开发者ID:jessecooper,项目名称:naglio-plugins,代码行数:30,代码来源:check_memcached.php

示例11: array

            $def[$i] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%6.1lf %sb/s");
        }
    }
}
#
# all other graphs
#
$i++;
foreach ($this->DS as $KEY => $VAL) {
    if (!preg_match('/(^State_)|(^ReqPerSec)|(^BytesPerSec)|(^Uptime)/', $VAL['NAME'])) {
        $def[$i] = "";
        $opt[$i] = " --title '{$hostname}: Apache - " . $VAL['NAME'] . " ' -l 0";
        $ds_name[$i] = $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");
        $i++;
    }
}
#
# Uptime Graph
#
$opt[$i] = "--vertical-label 'Uptime (d)' -l0 --title \"Uptime (time since last reboot)\" ";
$def[$i] = "";
$def[$i] .= rrd::def("sec", $RRDFILE[1], $DS[1], "MAX");
$ds_name[$i] = $LABEL[1];
$def[$i] .= "CDEF:uptime=sec,86400,/ ";
$def[$i] .= "AREA:uptime#80f000:\"Uptime (days)\" ";
$def[$i] .= "LINE:uptime#408000 ";
$def[$i] .= "GPRINT:uptime:LAST:\"%7.2lf %s LAST\" ";
$def[$i] .= "GPRINT:uptime:MAX:\"%7.2lf %s MAX\" ";
开发者ID:NeilBryant,项目名称:check_mk,代码行数:31,代码来源:check_mk-apache_status.php

示例12: array

<?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++;
}
开发者ID:lgbff,项目名称:check_mk-plugins,代码行数:24,代码来源:check_mk-jolokia_generic.php

示例13: preg_replace

 if (preg_match('/^(.*?)_usage_in/', $NAME[$i])) {
     $interface = preg_replace('/_.*$/', '', $LABEL[$i]);
     $ds_name[$num] = $interface . ' usage';
     $opt[$num] = "--vertical-label \"Usage\" -l 0 -u 100 --title \"Interface Usage for {$hostname} - " . $interface . "\" ";
     $def[$num] = "DEF:percin={$RRDFILE[$i]}:{$DS[$i]}:AVERAGE ";
     $def[$num] .= "DEF:percout=" . $RRDFILE[$i + 1] . ":" . $DS[$i + 1] . ":AVERAGE ";
     $def[$num] .= "LINE2:percin#00e060:\"in\t\" ";
     $def[$num] .= "GPRINT:percin:LAST:\"%10.1lf %% last\" ";
     $def[$num] .= "GPRINT:percin:AVERAGE:\"%7.1lf %% avg\" ";
     $def[$num] .= "GPRINT:percin:MAX:\"%7.1lf %% max\\n\" ";
     $def[$num] .= "LINE2:percout#0080e0:\"out\t\" ";
     $def[$num] .= "GPRINT:percout:LAST:\"%10.1lf %% last\" ";
     $def[$num] .= "GPRINT:percout:AVERAGE:\"%7.1lf %% avg\" ";
     $def[$num] .= "GPRINT:percout:MAX:\"%7.1lf %% max\"\\n ";
     $def[$num] .= rrd::hrule($WARN[$i], $_WARNRULE);
     $def[$num] .= rrd::hrule($CRIT[$i], $_CRITRULE);
     $num++;
 }
 # eth0_traffic_in / out
 # GigabitEthernet 0/0_traffic_in / out
 if (preg_match('/^(.*?)_traffic_in/', $NAME[$i])) {
     $interface = preg_replace('/_.*$/', '', $LABEL[$i]);
     $ds_name[$num] = $interface . ' traffic';
     $opt[$num] = "--vertical-label \"Traffic\" -b 1024 --title \"Interface Traffic for {$hostname} - {$interface}\" ";
     $def[$num] = "DEF:bitsin={$RRDFILE[$i]}:{$DS[$i]}:AVERAGE ";
     $def[$num] .= "DEF:bitsout=" . $RRDFILE[$i + 1] . ":" . $DS[$i + 1] . ":AVERAGE ";
     $def[$num] .= "AREA:bitsin#00e060:\"in\t\" ";
     $def[$num] .= "GPRINT:bitsin:LAST:\"%10.1lf %Sb/s last\" ";
     $def[$num] .= "GPRINT:bitsin:AVERAGE:\"%7.1lf %Sb/s avg\" ";
     $def[$num] .= "GPRINT:bitsin:MAX:\"%7.1lf %Sb/s max\\n\" ";
     $def[$num] .= "CDEF:bitsminusout=0,bitsout,- ";
开发者ID:dhoffend,项目名称:check_nwc_health,代码行数:31,代码来源:check_nwc_health.php

示例14:

$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\" ";
}
开发者ID:Worlor,项目名称:linux-check-mem-nagios-plugin,代码行数:31,代码来源:check_mem.php

示例15: foreach

# 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");
    }
}
开发者ID:rbarraud,项目名称:pnp4nagios,代码行数:31,代码来源:check_gearman.php


注:本文中的rrd类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。