本文整理汇总了PHP中rrdtool_update_ng函数的典型用法代码示例。如果您正苦于以下问题:PHP rrdtool_update_ng函数的具体用法?PHP rrdtool_update_ng怎么用?PHP rrdtool_update_ng使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rrdtool_update_ng函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_port_etherlike
function process_port_etherlike(&$this_port, $device)
{
// Used to loop below for StatsD
$etherlike_oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingleCollisionFrames', 'dot3StatsMultipleCollisionFrames', 'dot3StatsSQETestErrors', 'dot3StatsDeferredTransmissions', 'dot3StatsLateCollisions', 'dot3StatsExcessiveCollisions', 'dot3StatsInternalMacTransmitErrors', 'dot3StatsCarrierSenseErrors', 'dot3StatsFrameTooLongs', 'dot3StatsInternalMacReceiveErrors', 'dot3StatsSymbolErrors');
// Overwrite ifDuplex with dot3StatsDuplexStatus if it exists
if (isset($this_port['dot3StatsDuplexStatus'])) {
// echo("dot3Duplex, ");
$this_port['ifDuplex'] = $this_port['dot3StatsDuplexStatus'];
}
if ($this_port['ifType'] == "ethernetCsmacd" && isset($this_port['dot3StatsIndex'])) {
// Check to make sure Port data is cached.
rrdtool_update_ng($device, 'port-dot3', array('dot3StatsAlignmentErrors' => $this_port['dot3StatsAlignmentErrors'], 'dot3StatsFCSErrors' => $this_port['dot3StatsFCSErrors'], 'dot3StatsSingleCollisionFrames' => $this_port['dot3StatsSingleCollisionFrames'], 'dot3StatsMultipleCollisionFrames' => $this_port['dot3StatsMultipleCollisionFrames'], 'dot3StatsSQETestErrors' => $this_port['dot3StatsSQETestErrors'], 'dot3StatsDeferredTransmissions' => $this_port['dot3StatsDeferredTransmissions'], 'dot3StatsLateCollisions' => $this_port['dot3StatsLateCollisions'], 'dot3StatsExcessiveCollisions' => $this_port['dot3StatsExcessiveCollisions'], 'dot3StatsInternalMacTransmitErrors' => $this_port['dot3StatsInternalMacTransmitErrors'], 'dot3StatsCarrierSenseErrors' => $this_port['dot3StatsCarrierSenseErrors'], 'dot3StatsFrameTooLongs' => $this_port['dot3StatsFrameTooLongs'], 'dot3StatsInternalMacReceiveErrors' => $this_port['dot3StatsInternalMacReceiveErrors'], 'dot3StatsSymbolErrors' => $this_port['dot3StatsSymbolErrors']), get_port_rrdindex($this_port));
if ($GLOBALS['config']['statsd']['enable'] == TRUE) {
foreach ($etherlike_oids as $oid) {
// Update StatsD/Carbon
StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'port' . '.' . $this_port['ifIndex'] . '.' . $oid, $this_port[$oid]);
}
}
}
}
示例2: process_port_adsl
function process_port_adsl(&$this_port, $device, $port)
{
// Check to make sure Port data is cached.
if (!isset($this_port['adslLineCoding'])) {
return;
}
// Used below for StatsD only
$adsl_oids = array('adslAtucCurrSnrMgn', 'adslAtucCurrAtn', 'adslAtucCurrOutputPwr', 'adslAtucCurrAttainableRate', 'adslAtucChanCurrTxRate', 'adslAturCurrSnrMgn', 'adslAturCurrAtn', 'adslAturCurrOutputPwr', 'adslAturCurrAttainableRate', 'adslAturChanCurrTxRate', 'adslAtucPerfLofs', 'adslAtucPerfLoss', 'adslAtucPerfLprs', 'adslAtucPerfESs', 'adslAtucPerfInits', 'adslAturPerfLofs', 'adslAturPerfLoss', 'adslAturPerfLprs', 'adslAturPerfESs', 'adslAtucChanCorrectedBlks', 'adslAtucChanUncorrectBlks', 'adslAturChanCorrectedBlks', 'adslAturChanUncorrectBlks');
$adsl_db_oids = array('adslLineCoding', 'adslLineType', 'adslAtucInvVendorID', 'adslAtucInvVersionNumber', 'adslAtucCurrSnrMgn', 'adslAtucCurrAtn', 'adslAtucCurrOutputPwr', 'adslAtucCurrAttainableRate', 'adslAturInvSerialNumber', 'adslAturInvVendorID', 'adslAturInvVersionNumber', 'adslAtucChanCurrTxRate', 'adslAturChanCurrTxRate', 'adslAturCurrSnrMgn', 'adslAturCurrAtn', 'adslAturCurrOutputPwr', 'adslAturCurrAttainableRate');
$adsl_tenth_oids = array('adslAtucCurrSnrMgn', 'adslAtucCurrAtn', 'adslAtucCurrOutputPwr', 'adslAturCurrSnrMgn', 'adslAturCurrAtn', 'adslAturCurrOutputPwr');
foreach ($adsl_tenth_oids as $oid) {
if (isset($this_port[$oid])) {
$this_port[$oid] = $this_port[$oid] / 10;
}
}
if (dbFetchCell("SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = ?", array($port['port_id'])) == "0") {
dbInsert(array('port_id' => $port['port_id']), 'ports_adsl');
}
$adsl_update = array('port_adsl_updated' => array('NOW()'));
foreach ($adsl_db_oids as $oid) {
$adsl_update[$oid] = $this_port[$oid];
}
dbUpdate($adsl_update, 'ports_adsl', '`port_id` = ?', array($port['port_id']));
if ($this_port['adslAtucCurrSnrMgn'] > "1280") {
$this_port['adslAtucCurrSnrMgn'] = "U";
}
if ($this_port['adslAturCurrSnrMgn'] > "1280") {
$this_port['adslAturCurrSnrMgn'] = "U";
}
rrdtool_update_ng($device, 'port-adsl', array('AtucCurrSnrMgn' => $this_port['adslAtucCurrSnrMgn'], 'AtucCurrAtn' => $this_port['adslAtucCurrAtn'], 'AtucCurrOutputPwr' => $this_port['adslAtucCurrOutputPwr'], 'AtucCurrAttainableR' => $this_port['adslAtucCurrAttainableR'], 'AtucChanCurrTxRate' => $this_port['adslAtucChanCurrTxRate'], 'AturCurrSnrMgn' => $this_port['adslAturCurrSnrMgn'], 'AturCurrAtn' => $this_port['adslAturCurrAtn'], 'AturCurrOutputPwr' => $this_port['adslAturCurrOutputPwr'], 'AturCurrAttainableR' => $this_port['adslAturCurrAttainableR'], 'AturChanCurrTxRate' => $this_port['adslAturChanCurrTxRate'], 'AtucPerfLofs' => $this_port['adslAtucPerfLofs'], 'AtucPerfLoss' => $this_port['adslAtucPerfLoss'], 'AtucPerfLprs' => $this_port['adslAtucPerfLprs'], 'AtucPerfESs' => $this_port['adslAtucPerfESs'], 'AtucPerfInits' => $this_port['adslAtucPerfInits'], 'AturPerfLofs' => $this_port['adslAturPerfLofs'], 'AturPerfLoss' => $this_port['adslAturPerfLoss'], 'AturPerfLprs' => $this_port['adslAturPerfLprs'], 'AturPerfESs' => $this_port['adslAturPerfESs'], 'AtucChanCorrectedBl' => $this_port['adslAtucChanCorrectedBl'], 'AtucChanUncorrectBl' => $this_port['adslAtucChanUncorrectBl'], 'AturChanCorrectedBl' => $this_port['adslAturChanCorrectedBl'], 'AturChanUncorrectBl' => $this_port['adslAturChanUncorrectBl']), get_port_rrdindex($port));
if ($GLOBALS['config']['statsd']['enable']) {
foreach ($adsl_oids as $oid) {
// Update StatsD/Carbon
StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'port' . '.' . $port['ifIndex'] . '.' . $oid, $this_port[$oid]);
}
}
//echo("ADSL (".$this_port['adslLineCoding']."/".formatRates($this_port['adslAtucChanCurrTxRate'])."/".formatRates($this_port['adslAturChanCurrTxRate']).")");
}
示例3: rrdtool_update_ng
$port['alert_array']['rx_ave_pktsize'] = $port['state']['ifInOctets_delta'] / ($port['state']['ifInUcastPkts_delta'] + $port['state']['ifInNUcastPkts_delta']);
$port['alert_array']['tx_ave_pktsize'] = $port['state']['ifOutOctets_delta'] / ($port['state']['ifOutUcastPkts_delta'] + $port['state']['ifOutNUcastPkts_delta']);
// Store aggregate in/out state
$port['state']['ifOctets_rate'] = $port['stats']['ifOutOctets_rate'] + $port['stats']['ifInOctets_rate'];
$port['state']['ifUcastPkts_rate'] = $port['stats']['ifOutUcastPkts_rate'] + $port['stats']['ifInUcastPkts_rate'];
$port['state']['ifErrors_rate'] = $port['stats']['ifOutErrors_rate'] + $port['stats']['ifInErrors_rate'];
// Send aggregate data to alerter too
$port['alert_array']['ifOctets_rate'] = $port['state']['ifOctets_rate'];
$port['alert_array']['ifUcastPkts_rate'] = $port['state']['ifUcastPkts_rate'];
$port['alert_array']['ifNUcastPkts_rate'] = $port['stats']['ifOutNUcastPkts_rate'] + $port['stats']['ifInNUcastPkts_rate'];
$port['alert_array']['ifErrors_rate'] = $port['state']['ifErrors_rate'];
$port['alert_array']['ifBroadcastPkts_rate'] = $port['stats']['ifOutBroadcastPkts_rate'] + $port['stats']['ifInBroadcastPkts_rate'];
$port['alert_array']['ifMulticastPkts_rate'] = $port['stats']['ifOutMulticastPkts_rate'] + $port['stats']['ifInMulticastPkts_rate'];
$port['alert_array']['ifDiscards_rate'] = $port['stats']['ifOutDiscards_rate'] + $port['stats']['ifInDiscards_rate'];
// Update RRDs
rrdtool_update_ng($device, 'port', array('INOCTETS' => $this_port['ifInOctets'], 'OUTOCTETS' => $this_port['ifOutOctets'], 'INERRORS' => $this_port['ifInErrors'], 'OUTERRORS' => $this_port['ifOutErrors'], 'INUCASTPKTS' => $this_port['ifInUcastPkts'], 'OUTUCASTPKTS' => $this_port['ifOutUcastPkts'], 'INNUCASTPKTS' => $this_port['ifInNUcastPkts'], 'OUTNUCASTPKTS' => $this_port['ifOutNUcastPkts'], 'INDISCARDS' => $this_port['ifInDiscards'], 'OUTDISCARDS' => $this_port['ifOutDiscards'], 'INUNKNOWNPROTOS' => $this_port['ifInUnknownProtos'], 'INBROADCASTPKTS' => $this_port['ifInBroadcastPkts'], 'OUTBROADCASTPKTS' => $this_port['ifOutBroadcastPkts'], 'INMULTICASTPKTS' => $this_port['ifInMulticastPkts'], 'OUTMULTICASTPKTS' => $this_port['ifOutMulticastPkts']), get_port_rrdindex($port));
// End Update IF-MIB
// Update additional MIBS and modules
foreach ($process_port_db as $port_module => $oids) {
$log_event = array();
foreach ($oids as $oid) {
if ($port[$oid] != $this_port[$oid]) {
if (isset($this_port[$oid])) {
$port['update'][$oid] = $this_port[$oid];
$msg = "[{$oid}] '" . $port[$oid] . "' -> '" . $this_port[$oid] . "'";
} else {
$port['update'][$oid] = array('NULL');
$msg = "[{$oid}] '" . $port[$oid] . "' -> NULL";
}
$log_event[] = $msg;
if (OBS_DEBUG) {
示例4: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['postfix_qshape'])) {
$app_id = discover_app($device, 'postfix_qshape');
foreach (explode("\n", $agent_data['app']['postfix_qshape']) as $line) {
list($item, $value) = explode(":", $line, 2);
$queue_data[trim($item)] = trim($value);
}
rrdtool_update_ng($device, 'postfix-qshape', $queue_data);
update_application($app_id, $queue_data);
unset($queue_data, $item, $value);
}
// EOF
示例5: dbInsert
$peer['c_update']['SuppressedPrefixes'] = $cbgpPeerSuppressedPrefixes;
$peer['c_update']['WithdrawnPrefixes'] = $cbgpPeerWithdrawnPrefixes;
if (dbFetchCell('SELECT COUNT(`cbgp_id`) FROM `bgpPeers_cbgp-state` WHERE `cbgp_id` = ?', array($peer_afi['cbgp_id'])) == 0) {
dbInsert(array('cbgp_id' => $peer_afi['cbgp_id']), 'bgpPeers_cbgp-state');
}
dbUpdate($peer['c_update'], 'bgpPeers_cbgp-state', '`cbgp_id` = ?', array($peer_afi['cbgp_id']));
// Update cbgp StatsD
if ($config['statsd']['enable'] == TRUE) {
foreach (array('AcceptedPrefixes', 'DeniedPrefixes', 'AdvertisedPrefixes', 'SuppressedPrefixes', 'WithdrawnPrefixes') as $oid) {
// Update StatsD/Carbon
$r_oid = 'cbgpPeer' . $oid;
StatsD::gauge(str_replace('.', '_', $device['hostname']) . '.' . 'bgp' . '.' . str_replace('.', '_', $peer_ip) . ".{$afi}.{$safi}" . '.' . $oid, ${$r_oid});
}
}
// Update RRD
rrdtool_update_ng($device, 'cbgp', array('AcceptedPrefixes' => $cbgpPeerAcceptedPrefixes, 'DeniedPrefixes' => $cbgpPeerDeniedPrefixes, 'AdvertisedPrefixes' => $cbgpPeerAdvertisedPrefixes, 'SuppressedPrefixes' => $cbgpPeerSuppressedPrefixes, 'WithdrawnPrefixes' => $cbgpPeerWithdrawnPrefixes), $peer_ip . ".{$afi}.{$safi}");
$graphs['bgp_prefixes_' . $afi . $safi] = TRUE;
$c_table_row = array();
$c_table_row[] = $peer_ip;
$c_table_row[] = $peer['bgpPeerRemoteAs'];
$c_table_row[] = $afi . "-" . $safi;
$c_table_row[] = $cbgpPeerAcceptedPrefixes;
$c_table_row[] = $cbgpPeerDeniedPrefixes;
$c_table_row[] = $cbgpPeerAdvertisedPrefixes;
$c_table_rows[] = $c_table_row;
unset($c_table_row);
}
# while
}
# os_group=cisco | vendors
}
示例6: foreach
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (is_array($agent_data['app']['openvpn'])) {
foreach ($agent_data['app']['openvpn'] as $key => $entry) {
if (substr($key, 0, 9) == 'loadstats') {
list(, $instance) = explode('-', $key, 2);
$loadstats[$instance] = array();
# SUCCESS: nclients=1,bytesin=484758,bytesout=180629
foreach (explode(',', str_replace('SUCCESS: ', '', $entry)) as $keyvalue) {
list($key, $value) = explode('=', $keyvalue, 2);
$loadstats[$instance][$key] = $value;
}
}
}
}
foreach ($loadstats as $instance => $data) {
$app_id = discover_app($device, 'openvpn', $instance);
update_application($app_id, $data);
rrdtool_update_ng($device, 'openvpn', $data, $instance);
}
unset($loadstats);
// EOF
示例7: rrdtool_update_ng
} else {
// Hrrmm.. it looks like empty snmp walk
continue;
}
}
}
}
}
$mempool['free'] = $mempool['total'] - $mempool['used'];
$hc = $mempool['mempool_hc'] ? ' (HC)' : '';
// Update StatsD/Carbon
if ($config['statsd']['enable'] == TRUE) {
StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'mempool' . '.' . $mempool['mempool_mib'] . "." . $mempool['mempool_index'] . ".used", $mempool['used']);
StatsD::gauge(str_replace(".", "_", $device['hostname']) . '.' . 'mempool' . '.' . $mempool['mempool_mib'] . "." . $mempool['mempool_index'] . ".free", $mempool['free']);
}
rrdtool_update_ng($device, 'mempool', array('used' => $mempool['used'], 'free' => $mempool['free']), $mempool['mempool_mib'] . "-" . $mempool['mempool_index']);
if (!is_numeric($mempool['mempool_polled'])) {
dbInsert(array('mempool_id' => $mempool['mempool_id']), 'mempools-state');
}
$mempool['state'] = array('mempool_polled' => time(), 'mempool_used' => $mempool['used'], 'mempool_perc' => $mempool['perc'], 'mempool_free' => $mempool['free'], 'mempool_total' => $mempool['total']);
dbUpdate($mempool['state'], 'mempools-state', '`mempool_id` = ?', array($mempool['mempool_id']));
$graphs['mempool'] = TRUE;
check_entity('mempool', $mempool, array('mempool_perc' => $mempool['perc'], 'mempool_free' => $mempool['free'], 'mempool_used' => $mempool['used']));
// print_message("Mempool ". $mempool['mempool_descr'] . ': '.$mempool['perc'].'%%'.$hc);
$table_row = array();
$table_row[] = $mempool['mempool_descr'];
$table_row[] = $mempool['mempool_mib'];
$table_row[] = $mempool['mempool_index'];
$table_row[] = formatStorage($mempool['total']);
$table_row[] = formatStorage($mempool['used']);
$table_row[] = formatStorage($mempool['free']);
示例8: poll_p2p_radio
function poll_p2p_radio($device, $mib, $index, $radio)
{
$params = array('radio_tx_freq', 'radio_rx_freq', 'radio_tx_power', 'radio_rx_level', 'radio_name', 'radio_bandwidth', 'radio_modulation', 'radio_total_capacity', 'radio_standard', 'radio_loopback', 'radio_tx_mute', 'radio_eth_capacity', 'radio_e1t1_channels', 'radio_cur_capacity');
if (is_array($GLOBALS['cache']['p2p_radios'][$mib][$index])) {
$radio_db = $GLOBALS['cache']['p2p_radios'][$mib][$index];
}
// Update the Database
if (!isset($radio_db['radio_id'])) {
$insert = array();
$insert['device_id'] = $device['device_id'];
$insert['radio_mib'] = $mib;
$insert['radio_index'] = $index;
foreach ($params as $param) {
$insert[$param] = $radio[$param];
if ($radio[$param] == NULL) {
$insert[$param] = array('NULL');
}
}
$radio_id = dbInsert($insert, 'p2p_radios');
echo "+";
} else {
// If we already have an entry, check if it needs updating
$update = array();
foreach ($params as $param) {
if ($radio[$param] != $radio_db[$param]) {
$update[$param] = $radio[$param];
}
}
if (count($update)) {
dbUpdate($update, 'p2p_radios', '`radio_id` = ?', array($radio_db['radio_id']));
echo 'U';
} else {
echo '.';
}
}
rrdtool_update_ng($device, 'p2p_radio', array('tx_power' => $radio['radio_tx_power'], 'rx_level' => $radio['radio_rx_level'], 'rmse' => $radio['radio_rmse'], 'agc_gain' => $radio['radio_agc_gain'], 'cur_capacity' => $radio['radio_cur_capacity'], 'sym_rate_tx' => $radio['radio_sym_rate_tx'], 'sym_rate_rx' => $radio['radio_sym_rate_tx']), "{$mib}-{$index}");
$GLOBALS['valid']['p2p_radio'][$mib][$index] = 1;
// FIXME. What? How it passed there?
}
示例9: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['ntpd'])) {
$app_id = discover_app($device, 'ntpd');
foreach (explode("\n", $agent_data['app']['ntpd']) as $line) {
list($item, $value) = explode(":", $line, 2);
$ntpd_data[trim($item)] = trim($value);
}
$ntpd_type = isset($ntpd_data['server']) ? "server" : "client";
switch ($ntpd_type) {
case 'server':
rrdtool_update_ng($device, 'ntpd-server', $ntpd_data, $app_id);
break;
case 'client':
rrdtool_update_ng($device, 'ntpd-client', $ntpd_data, $app_id);
break;
}
update_application($app_id, $ntpd_data);
unset($ntpd_type, $app_id, $ntpd_data);
}
// EOF
示例10: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['powerdns'])) {
$app_id = discover_app($device, 'powerdns');
foreach (explode(",", $agent_data['app']['powerdns']) as $line) {
list($key, $value) = explode("=", $line, 2);
$powerdns[$key] = $value;
}
$data = array('corruptPackets' => $powerdns['corrupt-packets'], 'def_cacheInserts' => $powerdns['deferred-cache-inserts'], 'def_cacheLookup' => $powerdns['deferred-cache-lookup'], 'latency' => $powerdns['latency'], 'pc_hit' => $powerdns['packetcache-hit'], 'pc_miss' => $powerdns['packetcache-miss'], 'pc_size' => $powerdns['packetcache-size'], 'qsize' => $powerdns['qsize-q'], 'qc_hit' => $powerdns['query-cache-hit'], 'qc_miss' => $powerdns['query-cache-miss'], 'rec_answers' => $powerdns['recursing-answers'], 'rec_questions' => $powerdns['recursing-questions'], 'servfailPackets' => $powerdns['servfail-packets'], 'q_tcpAnswers' => $powerdns['tcp-answers'], 'q_tcpQueries' => $powerdns['tcp-queries'], 'q_timedout' => $powerdns['timedout-packets'], 'q_udpAnswers' => $powerdns['udp-answers'], 'q_udpQueries' => $powerdns['udp-queries'], 'q_udp4Answers' => $powerdns['udp4-answers'], 'q_udp4Queries' => $powerdns['udp4-queries'], 'q_udp6Answers' => $powerdns['udp6-answers'], 'q_udp6Queries' => $powerdns['udp6-queries']);
update_application($app_id, $data);
rrdtool_update_ng($device, 'powerdns', $data, $app_id);
unset($powerdns);
}
// EOF
示例11: discover_app
# tcp-client-overflow 0
# tcp-questions 20830
# unauthorized-tcp 0
# unauthorized-udp 0
# unexpected-packets 0
# cache-entries 710696
# cache-hits 548700
# cache-misses 5155665
# concurrent-queries 1
# negcache-entries 45659
# nsspeeds-entries 3023
# packetcache-entries 271504
# packetcache-hits 5393402
# packetcache-misses 5683536
# sys-msec 1600408
# tcp-clients 0
# throttle-entries 56
# uptime 4231654
# user-msec 3423357
if (!empty($agent_data['app']['powerdns-recursor'])) {
$app_id = discover_app($device, 'powerdns-recursor');
foreach (explode("\n", $agent_data['app']['powerdns-recursor']) as $line) {
list($key, $value) = explode("\t", $line, 2);
$powerdns_recursor[$key] = $value;
}
$data = array('outQ_all' => $powerdns_recursor['all-outqueries'], 'outQ_dont' => $powerdns_recursor['dont-outqueries'], 'outQ_tcp' => $powerdns_recursor['tcp-outqueries'], 'outQ_throttled' => $powerdns_recursor['throttled-out'], 'outQ_ipv6' => $powerdns_recursor['ipv6-outqueries'], 'outQ_noEDNS' => $powerdns_recursor['noedns-outqueries'], 'outQ_noPing' => $powerdns_recursor['noping-outqueries'], 'drop_reqDlgOnly' => $powerdns_recursor['dlg-only-drops'], 'drop_overCap' => $powerdns_recursor['over-capacity-drops'], 'timeoutOutgoing' => $powerdns_recursor['outgoing-timeouts'], 'unreachables' => $powerdns_recursor['unreachables'], 'answers_1s' => $powerdns_recursor['answers-slow'], 'answers_1ms' => $powerdns_recursor['answers0-1'], 'answers_10ms' => $powerdns_recursor['answers1-10'], 'answers_100ms' => $powerdns_recursor['answers10-100'], 'answers_1000ms' => $powerdns_recursor['answers100-1000'], 'answers_noerror' => $powerdns_recursor['noerror-answers'], 'answers_nxdomain' => $powerdns_recursor['nxdomain-answers'], 'answers_servfail' => $powerdns_recursor['servfail-answers'], 'caseMismatch' => $powerdns_recursor['case-mismatches'], 'chainResends' => $powerdns_recursor['chain-resends'], 'clientParseErrors' => $powerdns_recursor['client-parse-errors'], 'ednsPingMatch' => $powerdns_recursor['edns-ping-matches'], 'ednsPingMismatch' => $powerdns_recursor['edns-ping-mismatches'], 'noPacketError' => $powerdns_recursor['no-packet-error'], 'nssetInvalidations' => $powerdns_recursor['nsset-invalidations'], 'qaLatency' => $powerdns_recursor['qa-latency'], 'questions' => $powerdns_recursor['questions'], 'resourceLimits' => $powerdns_recursor['resource-limits'], 'serverParseErrors' => $powerdns_recursor['server-parse-errors'], 'spoofPrevents' => $powerdns_recursor['spoof-prevents'], 'tcpClientOverflow' => $powerdns_recursor['tcp-client-overflow'], 'tcpQuestions' => $powerdns_recursor['tcp-questions'], 'tcpUnauthorized' => $powerdns_recursor['unauthorized-tcp'], 'udpUnauthorized' => $powerdns_recursor['unauthorized-udp'], 'cacheEntries' => $powerdns_recursor['cache-entries'], 'cacheHits' => $powerdns_recursor['cache-hits'], 'cacheMisses' => $powerdns_recursor['cache-misses'], 'negcacheEntries' => $powerdns_recursor['negcache-entries'], 'nsSpeedsEntries' => $powerdns_recursor['nsspeeds-entries'], 'packetCacheEntries' => $powerdns_recursor['packetcache-entries'], 'packetCacheHits' => $powerdns_recursor['packetcache-hits'], 'packetCacheMisses' => $powerdns_recursor['packetcache-misses'], 'unexpectedPkts' => $powerdns_recursor['unexpected-packets'], 'concurrentQueries' => $powerdns_recursor['concurrent-queries'], 'tcpClients' => $powerdns_recursor['tcp-clients'], 'throttleEntries' => $powerdns_recursor['throttle-entries'], 'uptime' => $powerdns_recursor['uptime'], 'cpuTimeSys' => $powerdns_recursor['sys-msec'], 'cpuTimeUser' => $powerdns_recursor['user-msec']);
rrdtool_update_ng($device, 'powerdns-recursor', $data, $app_id);
update_application($app_id, $data);
unset($powerdns_recursor);
}
// EOF
示例12: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['nginx'])) {
$nginx = $agent_data['app']['nginx'];
$app_id = discover_app($device, 'nginx');
echo ' nginx statistics' . PHP_EOL;
list($active, $reading, $writing, $waiting, $req) = explode("\n", $nginx);
$data = array('Requests' => $req, 'Active' => $active, 'Reading' => $reading, 'Writing' => $writing, 'Waiting' => $waiting);
rrdtool_update_ng($device, 'nginx', $data, $app_id);
update_application($app_id, $data);
unset($nginx, $active, $reading, $writing, $req);
}
// EOF
示例13: discover_app
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['mysql'])) {
$app_id = discover_app($device, 'mysql');
$map = array();
foreach (explode("\n", $agent_data['app']['mysql']) as $str) {
list($key, $value) = explode(":", $str);
$map[$key] = trim($value);
}
// General Stats
$mapping = array('IDBLBSe' => 'cr', 'IBLFh' => 'ct', 'IBLWn' => 'cu', 'IBLWn' => 'cu', 'SRows' => 'ck', 'SRange' => 'cj', 'SMPs' => 'ci', 'SScan' => 'cl', 'IBIRd' => 'ai', 'IBIWr' => 'aj', 'IBILg' => 'ak', 'IBIFSc' => 'ah', 'IDBRDd' => 'b2', 'IDBRId' => 'b0', 'IDBRRd' => 'b3', 'IDBRUd' => 'b1', 'IBRd' => 'ae', 'IBCd' => 'af', 'IBWr' => 'ag', 'TLIe' => 'b5', 'TLWd' => 'b4', 'IBPse' => 'aa', 'IBPDBp' => 'ac', 'IBPFe' => 'ab', 'IBPMps' => 'ad', 'TOC' => 'bc', 'OFs' => 'b7', 'OTs' => 'b8', 'OdTs' => 'b9', 'IBSRs' => 'ay', 'IBSWs' => 'ax', 'IBOWs' => 'az', 'QCs' => 'c1', 'QCeFy' => 'bu', 'MaCs' => 'bl', 'MUCs' => 'bf', 'ACs' => 'bd', 'AdCs' => 'be', 'TCd' => 'bi', 'Cs' => 'bn', 'IBTNx' => 'a5', 'KRRs' => 'a0', 'KRs' => 'a1', 'KWR' => 'a2', 'KWs' => 'a3', 'QCQICe' => 'bz', 'QCHs' => 'bv', 'QCIs' => 'bw', 'QCNCd' => 'by', 'QCLMPs' => 'bx', 'CTMPDTs' => 'cn', 'CTMPTs' => 'cm', 'CTMPFs' => 'co', 'IBIIs' => 'au', 'IBIMRd' => 'av', 'IBIMs' => 'aw', 'IBILog' => 'al', 'IBISc' => 'am', 'IBIFLg' => 'an', 'IBFBl' => 'aq', 'IBIIAo' => 'ap', 'IBIAd' => 'as', 'IBIAe' => 'at', 'SFJn' => 'cd', 'SFRJn' => 'ce', 'SRe' => 'cf', 'SRCk' => 'cg', 'SSn' => 'ch', 'SQs' => 'b6', 'BRd' => 'cq', 'BSt' => 'cp', 'CDe' => 'c6', 'CIt' => 'c4', 'CISt' => 'ca', 'CLd' => 'c8', 'CRe' => 'c7', 'CRSt' => 'cc', 'CSt' => 'c5', 'CUe' => 'c3', 'CUMi' => 'c9');
$values = array();
foreach ($mapping as $key => $value) {
$values[$key] = $map[$value];
}
rrdtool_update_ng($device, 'mysql', $values, $app_id);
// Process state statistics
// Derr, not sure what the key part of the array is for, apart from some documentation, as d* is passed from agent into RRD.
$mapping_status = array('State_closing_tables' => 'd2', 'State_copying_to_tmp_table' => 'd3', 'State_end' => 'd4', 'State_freeing_items' => 'd5', 'State_init' => 'd6', 'State_locked' => 'd7', 'State_login' => 'd8', 'State_preparing' => 'd9', 'State_reading_from_net' => 'da', 'State_sending_data' => 'db', 'State_sorting_result' => 'dc', 'State_statistics' => 'dd', 'State_updating' => 'de', 'State_writing_to_net' => 'df', 'State_none' => 'dg', 'State_other' => 'dh');
$valuesb = array();
foreach ($mapping_status as $key => $value) {
$valuesb[$value] = $map[$value];
}
update_application($app_id, array_merge($values, $valuesb));
rrdtool_update_ng($device, 'mysql-status', $valuesb, $app_id);
}
// EOF
示例14: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// Correct output of the agent script should look like this:
//<<<exim-mailqueue>>>
//frozen:173
//bounces:1052
//total:2496
//active:2323
if (!empty($agent_data['app']['exim-mailqueue'])) {
$app_id = discover_app($device, 'exim-mailqueue');
foreach (explode("\n", $agent_data['app']['exim-mailqueue']) as $line) {
list($item, $value) = explode(":", $line, 2);
$exim_data[trim($item)] = trim($value);
}
update_application($app_id, $exim_data);
rrdtool_update_ng($device, 'exim-mailqueue', $exim_data, $app_id);
unset($line, $item, $value, $exim_data, $app_id);
}
// EOF
示例15: discover_app
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!empty($agent_data['app']['apache'])) {
$app_id = discover_app($device, 'apache');
list($total_access, $total_kbyte, $cpuload, $uptime, $reqpersec, $bytespersec, $bytesperreq, $busyworkers, $idleworkers, $score_wait, $score_start, $score_reading, $score_writing, $score_keepalive, $score_dns, $score_closing, $score_logging, $score_graceful, $score_idle, $score_open) = explode("\n", $agent_data['app']['apache']);
update_application($app_id, array('access' => $total_access, 'kbyte' => $total_kbyte, 'cpu' => $cpuload, 'uptime' => $uptime, 'reqpersec' => $reqpersec, 'bytespersec' => $bytespersec, 'byesperreq' => $bytesperreq, 'busyworkers' => $busyworkers, 'idleworkers' => $idleworkers, 'sb_wait' => $score_wait, 'sb_start' => $score_start, 'sb_reading' => $score_reading, 'sb_writing' => $score_writing, 'sb_keepalive' => $score_keepalive, 'sb_dns' => $score_dns, 'sb_closing' => $score_closing, 'sb_logging' => $score_logging, 'sb_graceful' => $score_graceful, 'sb_idle' => $score_idle, 'sb_open' => $score_open));
rrdtool_update_ng($device, 'apache', array('access' => $total_access, 'kbyte' => $total_kbyte, 'cpu' => $cpuload, 'uptime' => $uptime, 'reqpersec' => $reqpersec, 'bytespersec' => $bytespersec, 'byesperreq' => $bytesperreq, 'busyworkers' => $busyworkers, 'idleworkers' => $idleworkers, 'sb_wait' => $score_wait, 'sb_start' => $score_start, 'sb_reading' => $score_reading, 'sb_writing' => $score_writing, 'sb_keepalive' => $score_keepalive, 'sb_dns' => $score_dns, 'sb_closing' => $score_closing, 'sb_logging' => $score_logging, 'sb_graceful' => $score_graceful, 'sb_idle' => $score_idle, 'sb_open' => $score_open), $app_id);
}
// EOF