/** * 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
<?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']['asterisk'])) { $app_id = discover_app($device, 'asterisk'); foreach (explode("\n", $agent_data['app']['asterisk']) as $line) { list($key, $val) = explode(":", $line); $asterisk_data[trim($key)] = intval(trim($val)); } update_application($app_id, $asterisk_data); rrdtool_update_ng($device, 'asterisk', $asterisk_data, $app_id); unset($key, $line, $val, $asterisk_data, $app_id); } // EOF
num.ednserr=0 num.udp=0 num.udp6=0 num.tcp=0 num.tcp6=0 num.answer_wo_aa=0 num.rxerr=0 num.txerr=0 num.raxfr=0 num.truncated=0 num.dropped=0 zone.master=3 zone.slave=0 */ if (!empty($agent_data['app']['nsd'])) { $app_id = discover_app($device, 'nsd'); foreach (explode("\n", $agent_data['app']['nsd']) as $line) { list($key, $value) = explode("=", $line, 2); $nsd[$key] = $value; } // Memory $rrd_filename = "app-nsd-memory.rrd"; rrdtool_create($device, $rrd_filename, " \\\n DS:memDBDisk:GAUGE:600:0:125000000000 \\\n DS:memDBMem:GAUGE:600:0:125000000000 \\\n DS:memXFRDMem:GAUGE:600:0:125000000000 \\\n DS:memConfDisk:GAUGE:600:0:125000000000 \\\n DS:memConfMem:GAUGE:600:0:125000000000 "); foreach (array("size.db.disk", "size.db.mem", "size.xfrd.mem", "size.config.disk", "size.config.disk") as $key) { $rrd_values[] = $nsd[$key]; } rrdtool_update($device, $rrd_filename, "N:" . implode(':', $rrd_values)); unset($rrd_values); // Zones $rrd_filename = "app-nsd-zones.rrd"; rrdtool_create($device, $rrd_filename, " \\\n DS:zoneMaster:GAUGE:600:0:125000000000 \\\n DS:zoneSlave:GAUGE:600:0:125000000000 ");
/** * 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']['memcached'])) { foreach ($agent_data['app']['memcached'] as $memcached_host => $memcached_data) { // Only run if we have a valid host with a : separating host:port if (strpos($memcached_host, ":")) { echo " memcached(" . $memcached_host . ") "; $app_id = discover_app($device, 'memcached', $memcached_host); // These are the keys we expect. If we fall back to the old value-only // data (instead of the new key:value data) we expect them exactly in // this order. $keys = array('accepting_conns', 'auth_cmds', 'auth_errors', 'bytes', 'bytes_read', 'bytes_written', 'cas_badval', 'cas_hits', 'cas_misses', 'cmd_flush', 'cmd_get', 'cmd_set', 'conn_yields', 'connection_structures', 'curr_connections', 'curr_items', 'decr_hits', 'decr_misses', 'delete_hits', 'delete_misses', 'evictions', 'get_hits', 'get_misses', 'incr_hits', 'incr_misses', 'limit_maxbytes', 'listen_disabled_num', 'pid', 'pointer_size', 'rusage_system', 'rusage_user', 'threads', 'time', 'total_connections', 'total_items', 'uptime', 'version'); // Initialise the expected values $values = array(); foreach ($keys as $key) { $values[$key] = '0'; } // Parse the data, first try key:value format $lines = explode("\n", $memcached_data); $fallback_to_values_only = False; foreach ($lines as $line) { // Fall back to values only if we don't see a : separator if (!strstr($line, ':')) {
<?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
<?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']['zimbra'])) { $app_id = discover_app($device, 'zimbra'); update_application($app_id, array()); foreach ($agent_data['app']['zimbra'] as $key => $value) { # key is "vm", "mysql" etc, value is the csv output $zimbra[$key] = parse_csv($value); } if (is_array($zimbra['mtaqueue'])) { /* timestamp, KBytes, requests 04/23/2013 18:19:30, 0, 0 */ rrdtool_update_ng($device, 'zimbra-mtaqueue', array('kBytes' => $zimbra['mtaqueue'][0]['KBytes'], 'requests' => $zimbra['mtaqueue'][0]['requests'])); } if (is_array($zimbra['fd'])) { /* timestamp, fd_count, mailboxd_fd_count 04/23/2013 18:40:53, 5216, 1451 */
<?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']['bind']['global'])) { $app_id = discover_app($device, 'bind'); // Prepare data arrays // ------------------- $rrtypes = array('SOA', 'ANY', 'A', 'AAAA', 'NS', 'MX', 'CNAME', 'DNAME', 'TXT', 'SPF', 'SRV', 'SSHFP', 'TLSA', 'IPSECKEY', 'PTR', 'DNSKEY', 'RRSIG', 'NSEC', 'NSEC3', 'NSEC3PARAM', 'DS', 'DLV', 'IXFR', 'AXFR'); // Requests incoming $req_in = array('QUERY' => 0, 'STATUS' => 0, 'NOTIFY' => 0, 'UPDATE' => 0); // Query incoming $query_in = array(); foreach ($rrtypes as $rrtype) { $query_in[$rrtype] = 0; } // Query outgoing $query_out = array(); // Name server statistics $ns_stats_field_mapping = array("IPv4 requests received" => 'Requestv4', "IPv6 requests received" => 'Requestv6', "requests with EDNS(0) received" => 'ReqEdns0', "requests with unsupported EDNS version received" => 'ReqBadEDNSVer', "requests with TSIG received" => 'ReqTSIG', "requests with SIG(0) received" => 'ReqSIG0', "requests with invalid signature" => 'ReqBadSIG', "TCP requests received" => 'ReqTCP', "auth queries rejected" => 'AuthQryRej', "recursive queries rejected" => 'RecQryRej', "transfer requests rejected" => 'XfrRej', "update requests rejected" => 'UpdateRej', "responses sent" => 'Response', "truncated responses sent" => 'TruncatedResp', "responses with EDNS(0) sent" => 'RespEDNS0', "responses with TSIG sent" => 'RespTSIG', "responses with SIG(0) sent" => 'RespSIG0', "queries resulted in successful answer" => 'QrySuccess', "queries resulted in authoritative answer" => 'QryAuthAns', "queries resulted in non authoritative answer" => 'QryNoauthAns', "queries resulted in referral answer" => 'QryReferral', "queries resulted in nxrrset" => 'QryNxrrset', "queries resulted in SERVFAIL" => 'QrySERVFAIL', "queries resulted in FORMERR" => 'QryFORMERR', "queries resulted in NXDOMAIN" => 'QryNXDOMAIN', "queries caused recursion" => 'QryRecursion', "duplicate queries received" => 'QryDuplicate', "queries dropped" => 'QryDropped', "other query failures" => 'QryFailure', "requested transfers completed" => 'XfrReqDone', "update requests forwarded" => 'UpdateReqFwd', "update responses forwarded" => 'UpdateRespFwd', "update forward failed" => 'UpdateFwdFail', "updates completed" => 'UpdateDone', "updates failed" => 'UpdateFail', "updates rejected due to prerequisite failure" => 'UpdateBadPrereq', "response policy zone rewrites" => 'RPZRewrites'); $ns_stats_fields = array_values($ns_stats_field_mapping); array_sort($ns_stats_fields); $ns_stats = array();
<?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']['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) {
<?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']['crashplan'])) { $app_id = discover_app($device, 'crashplan'); $crashplan_data = json_decode($agent_data['app']['crashplan']['server'], TRUE); if (is_array($crashplan_data['data']['servers'])) { # [serverName] => crashplan.luciad.com # [totalBytes] => 16995951050752 # [usedBytes] => 16322661449728 # [usedPercentage] => 96 # [freeBytes] => 673289601024 # [freePercentage] => 4 # [coldBytes] => 3762904182328 # [coldPercentageOfUsed] => 23 # [coldPercentageOfTotal] => 22 # [archiveBytes] => 11678769817966 # [selectedBytes] => 19313807393642 # [remainingBytes] => 379281681813 # [inboundBandwidth] => 53 # [outboundBandwidth] => 67 # [orgCount] => 1
*/ /* echo "totalaccesses:$totalaccesses" echo "totalkbytes:$totalkbytes" echo "uptime:$uptime" echo "busyservers:$busyservers" echo "idleservers:$idleservers" echo "connectionsp:$connectionsp" echo "connectionsC:$connectionsC" echo "connectionsE:$connectionsE" echo "connectionsk:$connectionsk" echo "connectionsr:$connectionsr" echo "connectionsR:$connectionsR" echo "connectionsW:$connectionsW" echo "connectionsh:$connectionsh" echo "connectionsq:$connectionsq" echo "connectionsQ:$connectionsQ" echo "connectionss:$connectionss" echo "connectionsS:$connectionsS" */ if (!empty($agent_data['app']['lighttpd'])) { $app_id = discover_app($device, 'lighttpd'); foreach (explode("\n", $agent_data['app']['lighttpd']) as $line) { list($key, $val) = explode(":", $line); $data[trim($key)] = intval(trim($val)); } update_application($app_id, $data); rrdtool_update_ng($device, 'lighttpd', $data, $app_id); unset($app_id, $line, $data); } // EOF
<?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']['kamailio'])) { $app_id = discover_app($device, 'kamailio'); $key_trans_table = array('core:bad_URIs_rcvd' => 'corebadURIsrcvd', 'core:bad_msg_hdr' => 'corebadmsghdr', 'core:drop_replies' => 'coredropreplies', 'core:drop_requests' => 'coredroprequests', 'core:err_replies' => 'coreerrreplies', 'core:err_requests' => 'coreerrrequests', 'core:fwd_replies' => 'corefwdreplies', 'core:fwd_requests' => 'corefwdrequests', 'core:rcv_replies' => 'corercvreplies', 'core:rcv_requests' => 'corercvrequests', 'core:unsupported_methods' => 'coreunsupportedmeth', 'dns:failed_dns_request' => 'dnsfaileddnsrequest', 'mysql:driver_errors' => 'mysqldrivererrors', 'registrar:accepted_regs' => 'registraraccregs', 'registrar:default_expire' => 'registrardefexpire', 'registrar:default_expires_range' => 'registrardefexpirer', 'registrar:max_contacts' => 'registrarmaxcontact', 'registrar:max_expires' => 'registrarmaxexpires', 'registrar:rejected_regs' => 'registrarrejregs', 'shmem:fragments' => 'shmemfragments', 'shmem:free_size' => 'shmemfreesize', 'shmem:max_used_size' => 'shmemmaxusedsize', 'shmem:real_used_size' => 'shmemrealusedsize', 'shmem:total_size' => 'shmemtotalsize', 'shmem:used_size' => 'shmemusedsize', 'siptrace:traced_replies' => 'siptracetracedrepl', 'siptrace:traced_requests' => 'siptracetracedreq', 'sl:1xx_replies' => 'sl1xxreplies', 'sl:200_replies' => 'sl200replies', 'sl:202_replies' => 'sl202replies', 'sl:2xx_replies' => 'sl2xxreplies', 'sl:300_replies' => 'sl300replies', 'sl:301_replies' => 'sl301replies', 'sl:302_replies' => 'sl302replies', 'sl:3xx_replies' => 'sl3xxreplies', 'sl:400_replies' => 'sl400replies', 'sl:401_replies' => 'sl401replies', 'sl:403_replies' => 'sl403replies', 'sl:404_replies' => 'sl404replies', 'sl:407_replies' => 'sl407replies', 'sl:408_replies' => 'sl408replies', 'sl:483_replies' => 'sl483replies', 'sl:4xx_replies' => 'sl4xxreplies', 'sl:500_replies' => 'sl500replies', 'sl:5xx_replies' => 'sl5xxreplies', 'sl:6xx_replies' => 'sl6xxreplies', 'sl:failures' => 'slfailures', 'sl:received_ACKs' => 'slreceivedACKs', 'sl:sent_err_replies' => 'slsenterrreplies', 'sl:sent_replies' => 'slsentreplies', 'sl:xxx_replies' => 'slxxxreplies', 'tcp:con_reset' => 'tcpconreset', 'tcp:con_timeout' => 'tcpcontimeout', 'tcp:connect_failed' => 'tcpconnectfailed', 'tcp:connect_success' => 'tcpconnectsuccess', 'tcp:current_opened_connections' => 'tcpcurrentopenedcon', 'tcp:current_write_queue_size' => 'tcpcurrentwrqsize', 'tcp:established' => 'tcpestablished', 'tcp:local_reject' => 'tcplocalreject', 'tcp:passive_open' => 'tcppassiveopen', 'tcp:send_timeout' => 'tcpsendtimeout', 'tcp:sendq_full' => 'tcpsendqfull', 'tmx:2xx_transactions' => 'tmx2xxtransactions', 'tmx:3xx_transactions' => 'tmx3xxtransactions', 'tmx:4xx_transactions' => 'tmx4xxtransactions', 'tmx:5xx_transactions' => 'tmx5xxtransactions', 'tmx:6xx_transactions' => 'tmx6xxtransactions', 'tmx:UAC_transactions' => 'tmxUACtransactions', 'tmx:UAS_transactions' => 'tmxUAStransactions', 'tmx:inuse_transactions' => 'tmxinusetransaction', 'tmx:local_replies' => 'tmxlocalreplies', 'usrloc:location-contacts' => 'usrlocloccontacts', 'usrloc:location-expires' => 'usrloclocexpires', 'usrloc:location-users' => 'usrloclocusers', 'usrloc:registered_users' => 'usrlocregusers'); $data = array(); foreach (explode("\n", $agent_data['app']['kamailio']) as $line) { list($key, $val) = explode("=", $line); $key = trim($key); if (substr($key, 0, 6) == 'usrloc') { $tmp = substr($key, strpos($key, '-') + 1); switch ($tmp) { case 'contacts': case 'expires': case 'users': $key = 'usrloc:location-' . $tmp; break; } } if (isset($key_trans_table[$key])) { $data[$key_trans_table[$key]] = (int) trim($val);
<?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']['nfs'])) { $app_id = discover_app($device, 'nfs'); $rrd_filename = "app-nfs-{$app_id}.rrd"; /* Based DIRECTLY on nfsstats.c labels */ $nfsLabel = array(); $nfsLabel['proc2'] = array("null", "getattr", "setattr", "root", "lookup", "readlink", "read", "wrcache", "write", "create", "remove", "rename", "link", "symlink", "mkdir", "rmdir", "readdir", "fsstat"); $nfsLabel['proc3'] = array("null", "getattr", "setattr", "lookup", "access", "readlink", "read", "write", "create", "mkdir", "symlink", "mknod", "remove", "rmdir", "rename", "link", "readdir", "readdirplus", "fsstat", "fsinfo", "pathconf", "commit"); $nfsLabel['proc4'] = array("null", "read", "write", "commit", "open", "open_conf", "open_noat", "open_dgrd", "close", "setattr", "fsinfo", "renew", "setclntid", "confirm", "lock", "lockt", "locku", "access", "getattr", "lookup", "lookup_root", "remove", "rename", "link", "symlink", "create", "pathconf", "statfs", "readlink", "readdir", "server_caps", "delegreturn", "getacl", "setacl", "fs_locations", "rel_lkowner", "secinfo", "exchange_id", "create_ses", "destroy_ses", "sequence", "get_lease_t", "reclaim_comp", "layoutget", "getdevinfo", "layoutcommit", "layoutreturn", "secinfo_noname", "test_stateid", "free_stateid", "getdevlist", "bind_contoses", "dstr_clientid"); foreach ($nfsLabel as $key => $values) { foreach ($values as $name) { $definition .= " DS:" . ($key . $name) . ":DERIVE:600:0:12500000 "; } } rrdtool_create($device, $rrd_filename, $definition . " "); $datas = array(); foreach ($nfsLabel as $key => $values) { foreach ($values as $name) { $datas[$key . $name] = "U"; }
} // CPU Usage $wql = "SELECT * FROM Win32_PerfRawData_PerfProc_Process WHERE IDProcess=" . $instance['ProcessId']; $wmi['mssql'][$instance['Name']]['cpu'] = wmi_parse(wmi_query($wql, $override), TRUE); // Windows measures CPU usage using the PERF_100NSEC_TIMER_INV counter type, meaning measurements are in 100 nanosecond increments // http://msdn.microsoft.com/en-us/library/ms803963.aspx $cpu_ntime = sprintf('%u', utime() * 100000000); if ($wmi['mssql'][$instance['Name']]['cpu']) { $app_found['mssql'] = TRUE; echo "CPU; "; $app_data['cpu']['proc'] = $wmi['mssql'][$instance['Name']]['cpu']['PercentProcessorTime']; $app_data['cpu']['time'] = $cpu_ntime; rrdtool_update_ng($device, 'mssql-cpu', array('percproctime' => $wmi['mssql'][$instance['Name']]['cpu']['PercentProcessorTime'], 'threads' => $wmi['mssql'][$instance['Name']]['cpu']['ThreadCount'], 'lastpoll' => $cpu_ntime), $instance['Name']); } if ($app_found['mssql'] == TRUE) { $app_id = discover_app($device, 'mssql', $instance['Name']); update_application($app_id, $app_data); } // FIXME state gone $sql = "SELECT * FROM `applications` AS A LEFT JOIN `applications-state` AS S ON `A`.`app_id`=`S`.`application_id` WHERE `A`.`device_id` = ? AND `A`.`app_instance` = ? AND `A`.`app_type` = 'mssql'"; $app_state = dbFetchRow($sql, array($device['device_id'], $instance['Name'])); $app_data = serialize($app_data); if (empty($app_state['app_state'])) { dbInsert(array('application_id' => $app_state['app_id'], 'app_last_polled' => time(), 'app_status' => 1, 'app_state' => $app_data), 'applications-state'); } else { dbUpdate(array('app_last_polled' => time(), 'app_status' => 1, 'app_state' => $app_data), 'applications-state', "`application_id` = ?", array($app_state['application_id'])); } echo "\n"; } unset($wmi['mssql']); // EOF
<?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
<?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']['varnish'])) { $app_id = discover_app($device, 'varnish'); // Varnish specific output from agent $data = explode(";", $agent_data['app']['varnish']); $stats = array('backend_req' => $data[0], 'backend_unhealthy' => $data[1], 'backend_busy' => $data[2], 'backend_fail' => $data[3], 'backend_reuse' => $data[4], 'backend_toolate' => $data[5], 'backend_recycle' => $data[6], 'backend_retry' => $data[7], 'cache_hitpass' => $data[8], 'cache_hit' => $data[9], 'cache_miss' => $data[10], 'lru_nuked' => $data[11], 'lru_moved' => $data[12]); rrdtool_update_ng($device, 'varnish', $stats, $app_id); update_application($app_id, $stats); unset($data); } // EOF
<?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
<?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_mailgraph'])) { $app_id = discover_app($device, 'postfix_mailgraph'); foreach (explode("\n", $agent_data['app']['postfix_mailgraph']) as $line) { list($item, $value) = explode(":", $line, 2); $queue_data[trim($item)] = trim($value); } rrdtool_update_ng($device, 'postfix-mailgraph', $queue_data); update_application($app_id, $queue_data); unset($queue_data, $item, $value); } // EOF
# 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
if ($wmi['exchange']['transport']['smtp']) { $app_found['exchange'] = TRUE; echo "SMTP; "; rrdtool_update_ng($device, 'exchange-smtp', array('currentconnections' => $wmi['exchange']['transport']['smtp']['ConnectionsCurrent'], 'msgsentpersec' => $wmi['exchange']['transport']['smtp']['MessagesSentPersec'])); unset($wmi['exchange']['transport']['queues']); } // Exchange Information Store $wql = "SELECT * FROM Win32_PerfFormattedData_MSExchangeIS_MSExchangeIS"; $wmi['exchange']['mailbox']['is'] = wmi_parse(wmi_query($wql, $override), TRUE); if ($wmi['exchange']['mailbox']['is']) { $app_found['exchange'] = TRUE; echo "IS; "; rrdtool_update_ng($device, 'exchange-is', array('activeconcount' => $wmi['exchange']['mailbox']['is']['ActiveConnectionCount'], 'usercount' => $wmi['exchange']['mailbox']['is']['UserCount'], 'rpcrequests' => $wmi['exchange']['mailbox']['is']['RPCRequests'], 'rpcavglatency' => $wmi['exchange']['mailbox']['is']['RPCAveragedLatency'], 'clientrpcfailbusy' => $wmi['exchange']['mailbox']['is']['ClientRPCsFailedServerTooBusy'])); unset($wmi['exchange']['mailbox']['is']); } // Exchange Information Store - Mailbox Data $wql = "SELECT * FROM Win32_PerfFormattedData_MSExchangeIS_MSExchangeISMailbox WHERE Name='_total'"; $wmi['exchange']['mailbox']['mailbox'] = wmi_parse(wmi_query($wql, $override), TRUE); if ($wmi['exchange']['mailbox']['mailbox']) { $app_found['exchange'] = TRUE; echo "Mailbox; "; rrdtool_update_ng($device, 'exchange-mailbox', array('rpcavglatency' => $wmi['exchange']['mailbox']['mailbox']['RPCAverageLatency'], 'msgqueued' => $wmi['exchange']['mailbox']['mailbox']['MessagesQueuedForSubmission'], 'msgsentsec' => $wmi['exchange']['mailbox']['mailbox']['MessagesSentPersec'], 'msgdeliversec' => $wmi['exchange']['mailbox']['mailbox']['MessagesDeliveredPersec'], 'msgsubmitsec' => $wmi['exchange']['mailbox']['mailbox']['MessagesSubmittedPersec'])); } echo "\n"; } if ($app_found['exchange'] == TRUE) { $app_id = discover_app($device, 'exchange'); update_application($app_id, array()); } unset($wmi['exchange']); // EOF
<?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
<?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']['postgresql'])) { $app_id = discover_app($device, 'postgresql'); foreach (explode("\n", $agent_data['app']['postgresql']) as $line) { list($item, $value) = explode(":", $line, 2); $pgsql_data[trim($item)] = trim($value); } // there are differences between stats in postgresql 8.x and 9.x // if $pgsql_data['version'] rrdtool_update_ng($device, 'postgresql', $pgsql_data, $app_id); update_application($app_id, $pgsql_data); unset($app_id, $pgsql_data, $item, $value, $line); } // EOF
<?php /** * Observium Network Management and Monitoring System * * @package observium * @subpackage poller * @author Sander Steffann <*****@*****.**> * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ foreach ($agent_data['app']['dhcpkit'] as $collection => $collection_data) { $lines = explode("\n", $agent_data['app']['dhcpkit'][$collection]); $data = array(); foreach ($lines as $line) { // Line format is "key:value" list($key, $value) = explode(':', $line, 2); // Adjust naming $key = preg_replace('/\\.information_request$/', '.inf_req', $key); $key = preg_replace('/^messages_(in|out)\\./', 'msg_$1_', $key); $data[$key] = intval($value); } $app_id = discover_app($device, 'dhcpkit', $collection); update_application($app_id, $data); rrdtool_update_ng($device, 'dhcpkit-stats', $data, $app_id); unset($lines); unset($data); } /* End of file dhcpkit.inc.php */
num.query.flags.Z=0 num.query.flags.AD=0 num.query.flags.CD=0 num.query.edns.present=0 num.query.edns.DO=0 num.answer.rcode.NOERROR=2778 num.answer.rcode.NXDOMAIN=12 num.answer.rcode.nodata=128 num.answer.secure=2 num.answer.bogus=0 num.rrset.bogus=0 unwanted.queries=0 unwanted.replies=0 */ if (!empty($agent_data['app']['unbound'])) { $app_id = discover_app($device, 'unbound'); foreach (explode("\n", $agent_data['app']['unbound']) as $line) { list($key, $value) = explode("=", $line, 2); $unbound[$key] = $value; } while (1) { if (!isset($threadnum)) { $thread = 'total'; $threadnum = -1; # Incremented below, we want to check thread0 next, so we put this to -1. Yes, ugly... ;-( } else { $thread = 'thread' . $threadnum; } if (isset($unbound["{$thread}.num.queries"])) { rrdtool_update_ng($device, 'unbound-thread', array('numQueries' => $unbound["{$thread}.num.queries"], 'cacheHits' => $unbound["{$thread}.num.cachehits"], 'cacheMiss' => $unbound["{$thread}.num.cachemiss"], 'prefetch' => $unbound["{$thread}.num.prefetch"], 'recursiveReplies' => $unbound["{$thread}.num.recursivereplies"], 'reqListAvg' => $unbound["{$thread}.requestlist.avg"], 'reqListMax' => $unbound["{$thread}.requestlist.max"], 'reqListOverwritten' => $unbound["{$thread}.requestlist.overwritten"], 'reqListExceeded' => $unbound["{$thread}.requestlist.exceeded"], 'reqListCurrentAll' => $unbound["{$thread}.requestlist.current.all"], 'reqListCurrentUser' => $unbound["{$thread}.requestlist.current.user"], 'recursionTimeAvg' => $unbound["{$thread}.recursion.time.avg"], 'recursionTimeMedian' => $unbound["{$thread}.recursion.time.median"]), "{$app_id}-{$thread}"); $threadnum++;
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ // FIXME - INSTANCES if (!empty($agent_data['app']['shoutcast'])) { $app_id = discover_app($device, 'shoutcast'); // Polls shoutcast statistics from agent script $servers = explode("\n", $agent_data['app']['shoutcast']); $data = array(); foreach ($servers as $item => $server) { $server = trim($server); if (!empty($server)) { $data = explode(";", $server); list($host, $port) = explode(":", $data[0], 2); $stats[$data[0]] = array('bitrate' => $data[1], 'traf_in' => $data[2], 'traf_out' => $data[3], 'current' => $data[4], 'status' => $data[5], 'peak' => $data[6], 'max' => $data[7], 'unique' => $data[8]); rrdtool_update_ng($device, 'shoutcast', $stats[$data[0]], "{$app_id}-" . $host . "_" . $port); } } update_application($app_id, $stats); unset($app_id, $host, $port, $data, $servers, $server, $item); } // EOF
<?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']['freeradius'])) { $app_id = discover_app($device, 'freeradius'); $data = explode("\n", $agent_data['app']['freeradius']); $map = array(); foreach ($data as $str) { list($key, $value) = explode(":", $str); $map[$key] = (double) trim($value); } $data = array('AccessAccepts' => $map['FreeRADIUS-Total-Access-Accepts'], 'AccessChallenges' => $map['FreeRADIUS-Total-Access-Challenges'], 'AccessRejects' => $map['FreeRADIUS-Total-Access-Rejects'], 'AccessReqs' => $map['FreeRADIUS-Total-Access-Requests'], 'AccountingReqs' => $map['FreeRADIUS-Total-Accounting-Requests'], 'AccountingResponses' => $map['FreeRADIUS-Total-Accounting-Responses'], 'AcctDroppedReqs' => $map['FreeRADIUS-Total-Acct-Dropped-Requests'], 'AcctDuplicateReqs' => $map['FreeRADIUS-Total-Acct-Duplicate-Requests'], 'AcctInvalidReqs' => $map['FreeRADIUS-Total-Acct-Invalid-Requests'], 'AcctMalformedReqs' => $map['FreeRADIUS-Total-Acct-Malformed-Requests'], 'AcctUnknownTypes' => $map['FreeRADIUS-Total-Acct-Unknown-Types'], 'AuthDroppedReqs' => $map['FreeRADIUS-Total-Auth-Dropped-Requests'], 'AuthDuplicateReqs' => $map['FreeRADIUS-Total-Auth-Duplicate-Requests'], 'AuthInvalidReqs' => $map['FreeRADIUS-Total-Auth-Invalid-Requests'], 'AuthMalformedReqs' => $map['FreeRADIUS-Total-Auth-Malformed-Requests'], 'AuthResponses' => $map['FreeRADIUS-Total-Auth-Responses'], 'AuthUnknownTypes' => $map['FreeRADIUS-Total-Auth-Unknown-Types']); update_application($app_id, $data); rrdtool_update_ng($device, 'freeradius', $data, $app_id); unset($map); } // EOF
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @author Kresimir Jurasovic, Tom Laermans * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ if (!empty($agent_data['app']['jvmoverjmx'])) { foreach ($agent_data['app']['jvmoverjmx'] as $instance => $jvmoverjmx) { $app_id = discover_app($device, 'jvmoverjmx', $instance); echo " jvmoverjmx statistics" . PHP_EOL; foreach (explode("\n", $jvmoverjmx) as $jmxdataValue) { list($key, $value) = explode(':', $jmxdataValue); $jvmoverjmx_data[trim($key)] = trim($value); } $data = array('UpTime' => $jvmoverjmx_data['UpTime'], 'HeapMemoryMaxUsage' => $jvmoverjmx_data['HeapMemoryMaxUsage'], 'HeapMemoryUsed' => $jvmoverjmx_data['HeapMemoryUsed'], 'NonHeapMemoryMax' => $jvmoverjmx_data['NonHeapMemoryMax'], 'NonHeapMemoryUsed' => $jvmoverjmx_data['NonHeapMemoryUsed'], 'EdenSpaceMax' => $jvmoverjmx_data['EdenSpaceMax'], 'EdenSpaceUsed' => $jvmoverjmx_data['EdenSpaceUsed'], 'PermGenMax' => $jvmoverjmx_data['PermGenMax'], 'PermGenUsed' => $jvmoverjmx_data['PermGenUsed'], 'OldGenMax' => $jvmoverjmx_data['OldGenMax'], 'OldGenUsed' => $jvmoverjmx_data['OldGenUsed'], 'DaemonThreads' => $jvmoverjmx_data['DaemonThreads'], 'TotalThreads' => $jvmoverjmx_data['TotalThreads'], 'LoadedClassCount' => $jvmoverjmx_data['LoadedClassCount'], 'UnloadedClassCount' => $jvmoverjmx_data['UnloadedClassCount'], 'G1OldGenCount' => $jvmoverjmx_data['G1OldGenCollectionCount'], 'G1OldGenTime' => $jvmoverjmx_data['G1OldGenCollectionTime'], 'G1YoungGenCount' => $jvmoverjmx_data['G1YoungGenCollectionCount'], 'G1YoungGenTime' => $jvmoverjmx_data['G1YoungGenCollectionTime'], 'CMSCount' => $jvmoverjmx_data['CMSCollectionCount'], 'CMSTime' => $jvmoverjmx_data['CMSCollectionTime'], 'ParNewCount' => $jvmoverjmx_data['ParNewCollectionCount'], 'ParNewTime' => $jvmoverjmx_data['ParNewCollectionTime'], 'CopyCount' => $jvmoverjmx_data['CopyCollectionCount'], 'CopyTime' => $jvmoverjmx_data['CopyCollectionTime'], 'PSMarkSweepCount' => $jvmoverjmx_data['PSMarkSweepCollectionCount'], 'PSMarkSweepTime' => $jvmoverjmx_data['PSMarkSweepCollectionTime'], 'PSScavengeCount' => $jvmoverjmx_data['PSScavengeCollectionCount'], 'PSScavengeTime' => $jvmoverjmx_data['PSScavengeCollectionTime']); update_application($app_id, $data); rrdtool_update_ng($device, 'jvmoverjmx', $data, $app_id); unset($jvmoverjmx_data, $jmxdataValue); } } // EOF
<?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
* Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ //<<<app-vmwaretools>>> //vmtotalmem:2051 //vmswap:117 //vmballoon:1302 //vmmemres:256 //vmmemlimit:U //vmspeed:2660000000 //vmcpulimit:U //vmcpures:0 if (!empty($agent_data['app']['vmwaretools'])) { $app_id = discover_app($device, 'vmwaretools'); // Parse the data, first try key:value format foreach (explode("\n", $agent_data['app']['vmwaretools']) as $line) { // Parse key:value line list($key, $value) = explode(':', $line, 2); $values[$key] = $value; } rrdtool_update_ng($device, 'vmwaretools', $values, $app_id); update_application($app_id, $values); unset($values, $app_id); } // EOF
ep:(?P<ep>\\S+)\\s+ wo:(?P<wo>\\S+)\\s+ oos:(?P<oos>\\S+)\\R ~xm'; $outerkeys = array("version", "api", "proto", "srcversion"); $innerkeys = array("devno", "cs", "ro", "ds", "rep", "io", 'ns', 'nr', 'dw', 'dr', 'al', 'bm', 'lo', 'pe', 'ua', 'ap', 'ep', 'wo', 'oos'); $output = array(); preg_match_all($outerregex, $agent_data['app']['drbd'] . PHP_EOL, $matches, PREG_SET_ORDER); foreach ($matches as $match) { foreach ($outerkeys as $key) { $arr[$key] = $match[$key]; } preg_match_all($innerregex, $match["devices"], $innermatches, PREG_SET_ORDER); $arr["devices"] = array(); foreach ($innermatches as $innermatch) { $tmp = array(); foreach ($innerkeys as $key) { $tmp[$key] = $innermatch[$key]; } $arr["devices"][] = $tmp; } $output = $arr; } foreach ($output['devices'] as $drbd_dev) { $app_instance = "drbd" . $drbd_dev['devno']; $app_id = discover_app($device, 'drbd', $app_instance); update_application($app_id, $drbd_dev); rrdtool_update_ng($device, 'drbd', $drbd_dev, $app_instance); unset($drbd_dev); } // EOF