本文整理汇总了PHP中rrd::color方法的典型用法代码示例。如果您正苦于以下问题:PHP rrd::color方法的具体用法?PHP rrd::color怎么用?PHP rrd::color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rrd
的用法示例。
在下文中一共展示了rrd::color方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']);
}
}
示例2: 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");
}
示例3: array
$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");
}
}
示例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: explode
<?php
# VmPeak:530255872,VmSize:530251776,VmLck:0,VmHWM:243642368,VmRSS:243634176,VmData:252669952,VmStk:397312,VmExe:2215936,VmLib:9801728,VmPTE:827392
# TODO: .../buildout/parts/instance/etc/zope.conf
$parts = explode("_", $servicedesc);
$instance = $parts[sizeof($parts) - 3];
$opt[1] = "--title \"Zope memory For {$hostname} / {$instance}\" ";
#
$def[1] = "" . "DEF:VmPeak={$RRDFILE['1']}:{$DS['1']}:AVERAGE " . "CDEF:VmPeak_mb=VmPeak,1048576,/ " . rrd::area("VmPeak_mb", rrd::color(1), "Peak ", "STACK") . "GPRINT:VmPeak_mb:LAST:\"%8.1lf MB LAST\" " . "GPRINT:VmPeak_mb:AVERAGE:\"%8.1lf MB AVERAGE\" " . "GPRINT:VmPeak_mb:MAX:\"%8.1lf MB MAX\\n\" " . "DEF:VmSize={$RRDFILE['2']}:{$DS['2']}:AVERAGE " . "CDEF:VmSize_mb=VmSize,1048576,/ " . rrd::area("VmSize_mb", rrd::color(2), "Size ", "STACK") . "GPRINT:VmSize_mb:LAST:\"%8.1lf MB LAST\" " . "GPRINT:VmSize_mb:AVERAGE:\"%8.1lf MB AVERAGE\" " . "GPRINT:VmSize_mb:MAX:\"%8.1lf MB MAX\\n\" " . "DEF:VmLck={$RRDFILE['3']}:{$DS['3']}:AVERAGE " . "CDEF:VmLck_mb=VmLck,1048576,/ " . rrd::area("VmLck_mb", rrd::color(3), "Lck ", "STACK") . "GPRINT:VmLck_mb:LAST:\"%8.1lf MB LAST\" " . "GPRINT:VmLck_mb:AVERAGE:\"%8.1lf MB AVERAGE\" " . "GPRINT:VmLck_mb:MAX:\"%8.1lf MB MAX\\n\" " . "DEF:VmHWM={$RRDFILE['4']}:{$DS['4']}:AVERAGE " . "CDEF:VmHWM_mb=VmHWM,1048576,/ " . rrd::area("VmHWM_mb", rrd::color(4), "HWM ", "STACK") . "GPRINT:VmHWM_mb:LAST:\"%8.1lf MB LAST\" " . "GPRINT:VmHWM_mb:AVERAGE:\"%8.1lf MB AVERAGE\" " . "GPRINT:VmHWM_mb:MAX:\"%8.1lf MB MAX\\n\" " . "DEF:VmRSS={$RRDFILE['5']}:{$DS['5']}:AVERAGE " . "CDEF:VmRSS_mb=VmRSS,1048576,/ " . rrd::area("VmRSS_mb", rrd::color(5), "RSS ", "STACK") . "GPRINT:VmRSS_mb:LAST:\"%8.1lf MB LAST\" " . "GPRINT:VmRSS_mb:AVERAGE:\"%8.1lf MB AVERAGE\" " . "GPRINT:VmRSS_mb:MAX:\"%8.1lf MB MAX\\n\" " . "DEF:VmData={$RRDFILE['6']}:{$DS['6']}:AVERAGE " . "CDEF:VmData_mb=VmData,1048576,/ " . rrd::area("VmData_mb", rrd::color(6), "Data ", "STACK") . "GPRINT:VmData_mb:LAST:\"%8.1lf MB\\n\" " . "DEF:VmStk={$RRDFILE['7']}:{$DS['7']}:AVERAGE " . "CDEF:VmStk_mb=VmStk,1048576,/ " . rrd::area("VmStk_mb", rrd::color(7), "Stk ", "STACK") . "GPRINT:VmStk_mb:LAST:\"%8.1lf MB\\n\" " . "DEF:VmExe={$RRDFILE['8']}:{$DS['8']}:AVERAGE " . "CDEF:VmExe_mb=VmExe,1048576,/ " . rrd::area("VmExe_mb", rrd::color(8), "Exe ", "STACK") . "GPRINT:VmExe_mb:LAST:\"%8.1lf MB\\n\" " . "DEF:VmLib={$RRDFILE['9']}:{$DS['9']}:AVERAGE " . "CDEF:VmLib_mb=VmLib,1048576,/ " . rrd::area("VmLib_mb", rrd::color(9), "Lib ", "STACK") . "GPRINT:VmLib_mb:LAST:\"%8.1lf MB\\n\" " . "DEF:VmPTE={$RRDFILE['10']}:{$DS['10']}:AVERAGE " . "CDEF:VmPTE_mb=VmPTE,1048576,/ " . rrd::area("VmPTE_mb", rrd::color(10), "PTE ", "STACK") . "GPRINT:VmPTE_mb:LAST:\"%8.1lf MB\\n\" " . "";
示例6: array
#
#
#$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]}");
}
示例7: foreach
}
#
# First graph with all data
#
$ds_name[$i] = "Connections";
$def[$i] = "";
$opt[$i] = " --vertical-label 'Connections' --title '{$hostname}: {$servicedesc}' -l 0";
$def[$i] .= "DEF:active={$RRD['active']} ";
$def[$i] .= "GPRINT:active:LAST:\" Active Last %5.0lf\" ";
$def[$i] .= "GPRINT:active:MAX:\"Max %5.0lf\" ";
$def[$i] .= "GPRINT:active:AVERAGE:\"Average %5.1lf\" ";
$def[$i] .= "COMMENT:\"\\n\" ";
foreach ($this->DS as $KEY => $VAL) {
if (preg_match('/^(reading|writing|waiting)$/', $VAL['NAME'])) {
$def[$i] .= "DEF:var{$KEY}={$VAL['RRDFILE']}:{$DS[$VAL['DS']]}:AVERAGE ";
$def[$i] .= "AREA:var{$KEY}" . rrd::color($KEY) . ":\"" . $VAL['NAME'] . "\":STACK ";
$def[$i] .= "GPRINT:var{$KEY}:LAST:\"Last %5.0lf\" ";
$def[$i] .= "GPRINT:var{$KEY}:MAX:\"Max %5.0lf\" ";
$def[$i] .= "GPRINT:var{$KEY}:AVERAGE:\"Average %5.1lf\" ";
$def[$i] .= "COMMENT:\"\\n\" ";
}
}
#
# Requests per Second
#
$i++;
$def[$i] = "";
$opt[$i] = " --title '{$hostname}: {$servicedesc} Requests/sec' -l 0";
$ds_name[$i] = "Requests/sec";
$color = '#000000';
foreach ($this->DS as $KEY => $VAL) {
示例8: 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");
}