本文整理汇总了PHP中rrd::cut方法的典型用法代码示例。如果您正苦于以下问题:PHP rrd::cut方法的具体用法?PHP rrd::cut怎么用?PHP rrd::cut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rrd
的用法示例。
在下文中一共展示了rrd::cut方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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++;
}
示例2: 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");
}
示例3: foreach
#
# $Id$
#
foreach ($this->DS as $KEY => $VAL) {
list($type, $name) = explode('_', $VAL['NAME']);
$unit = $VAL['UNIT'];
if ($type == 'temp') {
$unit = "°{$unit}";
$ds_name[$KEY] = "Temperatur {$name}";
$opt[$KEY] = "--vertical-label \"Temperatur in {$unit}\" --title \"Temperatur {$hostname} / {$name}\" ";
$def[$KEY] = rrd::def("temp", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
$def[$KEY] .= rrd::gradient("temp", "A55231", "DEC6BD", rrd::cut($name, 16), 20);
$def[$KEY] .= rrd::gprint("temp", array("LAST", "MAX", "AVERAGE"), "%5.1lf {$unit}");
$def[$KEY] .= rrd::line1("temp", "#000000");
} else {
if ($type == 'hum') {
$unit = "%";
$ds_name[$KEY] = "Humidity {$name}";
$opt[$KEY] = "--vertical-label \"Humidity in %\" --title \"Humidity {$hostname} / {$name}\" ";
$def[$KEY] = rrd::def("hum", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
$def[$KEY] .= rrd::gradient("hum", "3152A5", "BDC6DE", rrd::cut($name, 16), 20);
$def[$KEY] .= rrd::gprint("hum", array("LAST", "MAX", "AVERAGE"), "%5.1lf%%");
$def[$KEY] .= rrd::line1("hum", "#000000");
}
}
$def[$KEY] .= rrd::hrule($VAL['WARN_MIN'], "#FFFF00", "Warning lower\\: " . $VAL['WARN_MIN'] . "{$unit} upper\\: " . $VAL['WARN_MAX'] . "{$unit} \\n");
$def[$KEY] .= rrd::hrule($VAL['WARN_MAX'], "#FFFF00");
$def[$KEY] .= rrd::hrule($VAL['CRIT_MIN'], "#FF0000", "Critical lower\\: " . $VAL['CRIT_MIN'] . "{$unit} upper\\: " . $VAL['CRIT_MAX'] . "{$unit} \\n");
$def[$KEY] .= rrd::hrule($VAL['CRIT_MIN'], "#FF0000");
}
# vim: set ts=4 sw=4 et syn=php :
示例4: array
$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] = "";
示例5: array
$minimum = $VAL['MIN'];
}
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 != "") {
示例6: 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 :
示例7: array
* 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++;
}
示例8: array
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");
}
}
}
示例9: Copyright
#
# Copyright (C) 2012 Marius Rieder <marius.rieder@durchmesser.ch>
#
# 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 2 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, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# $Id$
#
# Some Config
$COLORS = array("tcp_v3" => "#800000", "tcp_v4" => "#FF0000", "udp_v3" => "#008000", "udp_v4" => "#00FF00", "tcp6_v3" => "#000080", "tcp6_v4" => "#0000FF", "udp6_v3" => "#804000", "udp6_v4" => "#FF8000");
$NAMES = array("tcp_v3" => "NFSv3 TCP", "tcp_v4" => "NFSv4 TCP", "udp_v3" => "NFSv3 UDP", "udp_v4" => "NFSv4 UDP", "tcp6_v3" => "NFSv3 TCP6", "tcp6_v4" => "NFSv4 TCP6", "udp6_v3" => "NFSv3 UDP6", "udp6_v4" => "NFSv4 UDP6");
$opt[1] = "--vertical-label \"{$UNIT['1']}\" --title \"Response Times {$hostname} / {$servicedesc}\" ";
$ds_name[1] = "NFS Response Time";
$def[1] = "";
foreach ($this->DS as $KEY => $VAL) {
$def[1] .= rrd::def("var_{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
$def[1] .= rrd::line1("var_{$KEY}", $COLORS[$VAL['NAME']], rrd::cut($NAMES[$VAL['NAME']], 12));
$def[1] .= rrd::gprint("var_{$KEY}", array("LAST", "MAX", "AVERAGE"), "%6.3lf %S" . $VAL['UNIT']);
}
# vim: set ts=4 sw=4 et syn=php :
示例10: str_replace
#-------------------------------------------------------------------------------
# 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");
}
}
示例11: sprintf
$alpha = 'CC';
$colors_allowed = '#AAAAAA' . $alpha;
$colors_used = '#ffd660' . $alpha;
$colors_current = '#ff7d00' . $alpha;
$colors_connected = '#0000FF' . $alpha;
$colors_abrt_client = '#FF0000' . $alpha;
$colors_abrt_conn = '#00FF00' . $alpha;
$ds_name[1] = 'Connections';
$opt[1] = sprintf('-T 55 -l 0 --vertical-label "Connections" --title "%s / MySQL Connections"', $hostname);
$def[1] = '';
$def[1] .= rrd::def('var1', $rrdfile, $DS[1], 'AVERAGE');
$def[1] .= rrd::area('var1', $colors_allowed, rrd::cut('Max Connections', 20));
$def[1] .= rrd::gprint('var1', array('LAST'), '%4.0lf %s');
$def[1] .= rrd::def('var2', $rrdfile, $DS[2], 'AVERAGE');
$def[1] .= rrd::area('var2', $colors_used, rrd::cut('Max Used Connections', 20));
$def[1] .= rrd::gprint('var2', array('LAST'), '%4.0lf %s');
$def[1] .= rrd::def('var3', $rrdfile, $DS[3], 'AVERAGE');
$def[1] .= rrd::line2('var3', $colors_current, rrd::cut('Current Connections', 20));
$def[1] .= rrd::gprint('var3', array('LAST', 'AVERAGE', 'MAX'), '%4.0lf %s');
$ds_name[2] = 'Connections Per Second';
$opt[2] = sprintf('-T 55 -l 0 --vertical-label "Connections/Second" --title "%s / MySQL Connections Per Second"', $hostname);
$def[2] = '';
$def[2] .= rrd::def('var1', $rrdfile, $DS[6], 'AVERAGE');
$def[2] .= rrd::line2('var1', $colors_connected, rrd::cut('Connections', 20));
$def[2] .= rrd::gprint('var1', array('LAST', 'AVERAGE', 'MAX'), '%4.0lf %s');
$def[2] .= rrd::def('var2', $rrdfile, $DS[4], 'AVERAGE');
$def[2] .= rrd::line2('var2', $colors_abrt_client, rrd::cut('Aborted Clients', 20));
$def[2] .= rrd::gprint('var2', array('LAST', 'AVERAGE', 'MAX'), '%4.0lf %s');
$def[2] .= rrd::def('var3', $rrdfile, $DS[5], 'AVERAGE');
$def[2] .= rrd::line2('var3', $colors_abrt_conn, rrd::cut('Aborted Connections', 20));
$def[2] .= rrd::gprint('var3', array('LAST', 'AVERAGE', 'MAX'), '%4.0lf %s');
示例12: array
<?php
$alpha = 'CC';
$descs = array('select' => 'Select', 'insert' => 'Insert', 'update' => 'Update', 'delete' => 'Delete', 'replace' => 'Replace', 'load' => 'Load Data', 'deletemulti' => 'Delete Multi', 'insertselect' => 'Insert Select', 'updatemulti' => 'Update Multi', 'replaceselect' => 'Replace Select');
$opt[1] = "-T 55 -l 0 --vertical-label Commands --title \"{$hostname} / MySQL Commands\"";
$def[1] = '';
foreach ($DS as $i) {
$def[1] .= rrd::def("var{$i}", $rrdfile, $DS[$i], 'AVERAGE');
if ($i == '1') {
$def[1] .= rrd::area("var{$i}", rrd::color($i, $alpha), rrd::cut($descs[$NAME[$i]], 15));
} else {
$def[1] .= rrd::area("var{$i}", rrd::color($i, $alpha), rrd::cut($descs[$NAME[$i]], 15), 'STACK');
}
$def[1] .= rrd::gprint("var{$i}", array('LAST', 'MAX', 'AVERAGE'), "%4.0lf %s\\t");
}
示例13: array
$colors = array('#941342' . $alpha, '#435247' . $alpha, '#00CBF6' . $alpha, '#BFBD82' . $alpha, '#C5031A' . $alpha, '#F39034' . $alpha, '#3D282A' . $alpha, '#33369E' . $alpha, '#08A000' . $alpha);
$vlabel = 'Percent';
$opt[1] = sprintf('-T 55 -l 0 --vertical-label "%s" --title "%s / CPU Usage"', $vlabel, $hostname);
$def[1] = '';
$ds_name[1] = 'CPU Usage';
foreach ($DS as $i) {
$def[1] .= rrd::def("var{$i}", $rrdfile, $DS[$i], 'AVERAGE');
if ($i == '1') {
$def[1] .= rrd::area("var{$i}", $colors[$i - 1], rrd::cut(ucfirst($NAME[$i]), 15));
} else {
$def[1] .= rrd::area("var{$i}", $colors[$i - 1], rrd::cut(ucfirst($NAME[$i]), 15), 'STACK');
}
$def[1] .= rrd::gprint("var{$i}", array('LAST', 'MAX', 'AVERAGE'), "%4.0lf %s\\t");
}
$def[1] .= 'COMMENT:"' . $TEMPLATE[$i] . '\\r" ';
$opt[2] = sprintf('-T 55 -l 0 --vertical-label "%s" --title "%s / CPU Usage (sans idle)"', $vlabel, $hostname);
$def[2] = '';
$ds_name[2] = 'CPU Usage (sans idle)';
foreach ($DS as $i) {
$def[2] .= rrd::def("var{$i}", $rrdfile, $DS[$i], 'AVERAGE');
if ($i == 4) {
continue;
}
if ($i == '1') {
$def[2] .= rrd::area("var{$i}", $colors[$i - 1], rrd::cut(ucfirst($NAME[$i]), 15));
} else {
$def[2] .= rrd::area("var{$i}", $colors[$i - 1], rrd::cut(ucfirst($NAME[$i]), 15), 'STACK');
}
$def[2] .= rrd::gprint("var{$i}", array('LAST', 'MAX', 'AVERAGE'), "%4.0lf %s\\t");
}
$def[2] .= 'COMMENT:"' . $TEMPLATE[$i] . '\\r" ';
示例14: array
$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');
if ($i == '1') {
$def[4] .= rrd::area("var{$i}", rrd::color($i), rrd::cut($scoreboard[$i], 20));
} else {
$def[4] .= rrd::area("var{$i}", rrd::color($i), rrd::cut($scoreboard[$i], 20), 'STACK');
}
$def[4] .= rrd::gprint("var{$i}", array('LAST', 'MAX', 'AVERAGE'), "%4.0lf %s");
}
示例15: Copyright
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#
# Copyright (c) 2006-2010 Joerg Linge (http://www.pnp4nagios.org)
# Default Template used if no other template is found.
# Don`t delete this file !
#
# Define some colors ..
#
$_AREA = '#256aef';
$_LINE = '#000000';
$_start_color = array("808005", "000080", "000000");
$_end_color = array("C0C0C0", "BDC6DE", "BDC6DE");
foreach ($this->DS as $KEY => $VAL) {
$vlabel = " ";
$lower = "";
$upper = "";
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", $_start_color[$KEY], $_end_color[$KEY], rrd::cut($VAL['NAME'], 16), 20);
$def[$KEY] .= rrd::line1("var1", $_LINE);
$def[$KEY] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%3.2lf %S" . $VAL['UNIT']);
}