$uptime = $snmpEngineTime; $uptime_msg = "Using SNMP Agent snmpEngineTime"; } } } } print_debug("{$uptime_msg} ({$uptime} seconds)"); if (is_numeric($uptime)) { // Notify only if current uptime less than one month (eg if changed from sysUpTime to snmpEngineTime) if ($uptime < $device['uptime'] && $uptime < 2628000) { notify($device, "Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($uptime) . " ago."); log_event('Device rebooted after ' . formatUptime($device['uptime']), $device, 'reboot', $device['uptime']); } $uptime_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/uptime.rrd"; if (!is_file($uptime_rrd)) { rrdtool_create($uptime_rrd, "DS:uptime:GAUGE:600:0:U "); } rrdtool_update($uptime_rrd, "N:" . $uptime); $graphs['uptime'] = TRUE; print_message("Uptime: " . formatUptime($uptime)); $update_array['uptime'] = $uptime; $cache['devices']['uptime'][$device['device_id']]['uptime'] = $uptime; $cache['devices']['uptime'][$device['device_id']]['polled'] = $polled; } $poll_device['sysLocation'] = str_replace("\"", "", $poll_device['sysLocation']); // Rewrite sysLocation if there is a mapping array (database too?) if (!empty($poll_device['sysLocation'])) { $poll_device['sysLocation'] = rewrite_location($poll_device['sysLocation']); } $poll_device['sysContact'] = str_replace("\"", "", $poll_device['sysContact']); if ($poll_device['sysLocation'] == "not set") {
foreach (dbFetchRows("SELECT * FROM mempools WHERE device_id = ?", array($device['device_id'])) as $mempool) { echo "Mempool " . $mempool['mempool_descr'] . ": "; $mempool_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("mempool-" . $mempool['mempool_type'] . "-" . $mempool['mempool_index'] . ".rrd"); $file = $config['install_dir'] . "/includes/polling/mempools/" . $mempool['mempool_type'] . ".inc.php"; if (is_file($file)) { include $file; } else { // Do we need a generic mempool poller? } if ($mempool['total']) { $percent = round($mempool['used'] / $mempool['total'] * 100, 2); } else { $percent = 0; } echo $percent . "% "; if (!is_file($mempool_rrd)) { rrdtool_create($mempool_rrd, "--step 300 DS:used:GAUGE:600:0:U DS:free:GAUGE:600:0:U " . $config['rrd_rra']); } rrdtool_update($mempool_rrd, "N:" . $mempool['used'] . ":" . $mempool['free']); $mempool['state'] = array('mempool_used' => $mempool['used'], 'mempool_perc' => $percent, 'mempool_free' => $mempool['free'], 'mempool_total' => $mempool['total'], 'mempool_largestfree' => $mempool['largestfree'], 'mempool_lowestfree' => $mempool['lowestfree']); if ($config['memcached']['enable']) { if ($debug) { print_r($mempool['state']); } $memcache->set('mempool-' . $mempool['mempool_id'] . '-value', $mempool['state']); } else { dbUpdate($mempool['state'], 'mempools', '`mempool_id` = ?', array($mempool['mempool_id'])); } echo "\n"; } unset($mempool_cache);
function rrd_create_update($device, $name, $def, $val, $step = 300) { global $config; $rrd = rrd_name($device['hostname'], $name); if (!is_file($rrd) && $def != null) { // add the --step and the rra definitions to the array $newdef = "--step {$step} " . implode(' ', $def) . $config['rrd_rra']; rrdtool_create($rrd, $newdef); } rrdtool_update($rrd, $val); }
// FIXME THESE FIELDS DO NOT EXIST IN THE DATABASE! $update = 'UPDATE bgpPeers_cbgp SET'; $peer['c_update']['AcceptedPrefixes'] = $cbgpPeerAcceptedPrefixes; $peer['c_update']['DeniedPrefixes'] = $cbgpPeerDeniedPrefixes; $peer['c_update']['PrefixAdminLimit'] = $cbgpPeerAdminLimit; $peer['c_update']['PrefixThreshold'] = $cbgpPeerPrefixThreshold; $peer['c_update']['PrefixClearThreshold'] = $cbgpPeerPrefixClearThreshold; $peer['c_update']['AdvertisedPrefixes'] = $cbgpPeerAdvertisedPrefixes; $peer['c_update']['SuppressedPrefixes'] = $cbgpPeerSuppressedPrefixes; $peer['c_update']['WithdrawnPrefixes'] = $cbgpPeerWithdrawnPrefixes; dbUpdate($peer['c_update'], 'bgpPeers_cbgp', '`device_id` = ? AND bgpPeerIdentifier = ? AND afi = ? AND safi = ?', array($device['device_id'], $peer['bgpPeerIdentifier'], $afi, $safi)); $cbgp_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('cbgp-' . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}.rrd"); if (!is_file($cbgp_rrd)) { $rrd_create = 'DS:AcceptedPrefixes:GAUGE:600:U:100000000000 DS:DeniedPrefixes:GAUGE:600:U:100000000000 DS:AdvertisedPrefixes:GAUGE:600:U:100000000000 DS:SuppressedPrefixes:GAUGE:600:U:100000000000 DS:WithdrawnPrefixes:GAUGE:600:U:100000000000 ' . $config['rrd_rra']; rrdtool_create($cbgp_rrd, $rrd_create); } $fields = array('AcceptedPrefixes' => $cbgpPeerAcceptedPrefixes, 'DeniedPrefixes' => $cbgpPeerDeniedPrefixes, 'AdvertisedPrefixes' => $cbgpPeerAdvertisedPrefixes, 'SuppressedPrefixes' => $cbgpPeerSuppressedPrefixes, 'WithdrawnPrefixes' => $cbgpPeerWithdrawnPrefixes); rrdtool_update("{$cbgp_rrd}", $fields); } //end foreach } //end if echo "\n"; } //end foreach } //end if
$uptime = $secs; } } // Use snmpEngineTime (68 year rollover) to cross-reference for false positives in device rebooting due to sysUpTime rollover issues $snmpEngineTime = (int) snmp_get($device, "snmpEngineTime.0", "-OUqv", "SNMP-FRAMEWORK-MIB"); if (!is_numeric($snmpEngineTime)) { $snmpEngineTime = 0; } if (is_numeric($uptime)) { if ($uptime < $device['uptime'] && $uptime >= $snmpEngineTime) { notify($device, "Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($uptime) . " ago."); log_event('Device rebooted after ' . formatUptime($device['uptime']), $device, 'reboot', $device['uptime']); } $uptime_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/uptime.rrd"; if (!is_file($uptime_rrd)) { rrdtool_create($uptime_rrd, "DS:uptime:GAUGE:600:0:U " . $config['rrd_rra']); } rrdtool_update($uptime_rrd, "N:" . $uptime); $graphs['uptime'] = TRUE; echo "Uptime: " . formatUptime($uptime) . "\n"; $update_array['uptime'] = $uptime; } $poll_device['sysLocation'] = str_replace("\"", "", $poll_device['sysLocation']); // Remove leading & trailing backslashes added by VyOS/Vyatta/EdgeOS $poll_device['sysLocation'] = trim($poll_device['sysLocation'], "\\"); // Rewrite sysLocation if there is a mapping array (database too?) if (!empty($poll_device['sysLocation']) && is_array($config['location_map'])) { $poll_device['sysLocation'] = rewrite_location($poll_device['sysLocation']); } $poll_device['sysContact'] = str_replace("\"", "", $poll_device['sysContact']); // Remove leading & trailing backslashes added by VyOS/Vyatta/EdgeOS
} echo ' powerdns'; list($corrupt, $def_cacheInserts, $def_cacheLookup, $latency, $pc_hit, $pc_miss, $pc_size, $qsize, $qc_hit, $qc_miss, $rec_answers, $rec_questions, $servfail, $tcp_answers, $tcp_queries, $timedout, $udp_answers, $udp_queries, $udp4_answers, $udp4_queries, $udp6_answers, $udp6_queries) = explode("\n", $powerdns); if (!is_file($rrd_filename)) { rrdtool_create($rrd_filename, '--step 300 DS:corruptPackets:DERIVE:600:0:125000000000 DS:def_cacheInserts:DERIVE:600:0:125000000000 DS:def_cacheLookup:DERIVE:600:0:125000000000 DS:latency:DERIVE:600:0:125000000000 DS:pc_hit:DERIVE:600:0:125000000000 DS:pc_miss:DERIVE:600:0:125000000000 DS:pc_size:DERIVE:600:0:125000000000 DS:qsize:DERIVE:600:0:125000000000 DS:qc_hit:DERIVE:600:0:125000000000 DS:qc_miss:DERIVE:600:0:125000000000 DS:rec_answers:DERIVE:600:0:125000000000 DS:rec_questions:DERIVE:600:0:125000000000 DS:servfailPackets:DERIVE:600:0:125000000000 DS:q_tcpAnswers:DERIVE:600:0:125000000000 DS:q_tcpQueries:DERIVE:600:0:125000000000 DS:q_timedout:DERIVE:600:0:125000000000 DS:q_udpAnswers:DERIVE:600:0:125000000000 DS:q_udpQueries:DERIVE:600:0:125000000000 DS:q_udp4Answers:DERIVE:600:0:125000000000 DS:q_udp4Queries:DERIVE:600:0:125000000000 DS:q_udp6Answers:DERIVE:600:0:125000000000 DS:q_udp6Queries:DERIVE:600:0:125000000000 ' . $config['rrd_rra']); } //end if $fields = array('corruptPackets' => $corrupt, 'def_cacheInserts' => $def_cacheInserts, 'def_cacheLookup' => $def_cacheLookup, 'latency' => $latency, 'pc_hit' => $pc_hit, 'pc_miss' => $pc_miss, 'pc_size' => $pc_size, 'qsize' => $qsize, 'qc_hit' => $qc_hit, 'qc_miss' => $qc_miss, 'rec_answers' => $rec_answers, 'rec_questions' => $rec_questions, 'servfailPackets' => $servfail, 'q_tcpAnswers' => $tcp_answers, 'q_tcpQueries' => $tcp_queries, 'q_timedout' => $timedout, 'q_udpAnswers' => $udp_answers, 'q_udpQueries' => $udp_queries, 'q_udp4Answers' => $udp4_answers, 'q_udp4Queries' => $udp4_queries, 'q_udp6Answers' => $udp6_answers, 'q_udp6Queries' => $udp6_queries); rrdtool_update($rrd_filename, $fields);
<?php if (!empty($agent_data['app']['nginx'])) { $nginx = $agent_data['app']['nginx']; } else { // Polls nginx statistics from script via SNMP $nginx = snmp_get($device, 'nsExtendOutputFull.5.110.103.105.110.120', '-Ovq', 'NET-SNMP-EXTEND-MIB'); } $nginx_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/app-nginx-' . $app['app_id'] . '.rrd'; echo ' nginx'; list($active, $reading, $writing, $waiting, $req) = explode("\n", $nginx); if (!is_file($nginx_rrd)) { rrdtool_create($nginx_rrd, '--step 300 DS:Requests:DERIVE:600:0:125000000000 DS:Active:GAUGE:600:0:125000000000 DS:Reading:GAUGE:600:0:125000000000 DS:Writing:GAUGE:600:0:125000000000 DS:Waiting:GAUGE:600:0:125000000000 ' . $config['rrd_rra']); } d_echo("active: {$active} reading: {$reading} writing: {$writing} waiting: {$waiting} Requests: {$req}"); $fields = array('Requests' => $req, 'Active' => $active, 'Reading' => $reading, 'Writing' => $writing, 'Waiting' => $waiting); rrdtool_update($nginx_rrd, $fields); $tags = array('name' => 'nginx', 'app_id' => $app['app_id']); influx_update($device, 'app', $tags, $fields); // Unset the variables we set here unset($nginx); unset($nginx_rrd); unset($active); unset($reading); unset($writing); unset($req);
} if (empty($hardware)) { $hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB'); } $oids_AP_Name = array('bsnAPName'); $oids_AP_Users = array('bsnApIfNoOfUsers'); foreach ($oids_AP_Name as $oid) { $stats = snmpwalk_cache_oid($device, $oid, $stats, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsxb'); } foreach ($oids_AP_Users as $oid) { $APstats = snmpwalk_cache_oid($device, $oid, $APstats, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsxb'); } $numAccessPoints = count($stats); $numClients = 0; foreach ($APstats as $key => $value) { $numClients += $value['bsnApIfNoOfUsers']; } $rrdfile = $host_rrd . '/ciscowlc' . safename('.rrd'); if (!is_file($rrdfile)) { rrdtool_create($rrdfile, ' --step 300 DS:NUMAPS:GAUGE:600:0:12500000000 DS:NUMCLIENTS:GAUGE:600:0:12500000000 ' . $config['rrd_rra']); } $fields = array('NUMAPS' => $numAccessPoints, 'NUMCLIENTS' => $numClients); $ret = rrdtool_update($rrdfile, $fields); // also save the info about how many clients in the same place as the wireless module $wificlientsrrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('wificlients-radio1.rrd'); if (!is_file($wificlientsrrd)) { rrdtool_create($wificlientsrrd, '--step 300 DS:wificlients:GAUGE:600:-273:10000 ' . $config['rrd_rra']); } $fields = array('wificlients' => $numClients); rrdtool_update($wificlientsrrd, $fields); $graphs['wifi_clients'] = true;
if (!empty($agent_data['app']['nfs'])) { $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-nfs-" . $app['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", "getdevlist"); if (!is_file($rrd_filename)) { $definition = "--step 300 "; foreach ($nfsLabel as $key => $values) { foreach ($values as $name) { $definition .= " DS:" . ($key . $name) . ":DERIVE:600:0:12500000 "; } } rrdtool_create($rrd_filename, $definition . " " . $config['rrd_rra']); } $datas = array(); foreach ($nfsLabel as $key => $values) { foreach ($values as $name) { $datas[$key . $name] = "U"; } } $lines = explode("\n", $agent_data['app']['nfs']); foreach ($lines as $line) { $tokens = explode(" ", $line); if (isset($tokens[0]) && isset($nfsLabel[strtolower($tokens[0])])) { $base = strtolower($tokens[0]); array_shift($tokens); array_shift($tokens); foreach ($tokens as $k => $v) {
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2014 Adam Armstrong * */ // Polls MailScanner statistics from script via SNMP // FIXME do we still support this in some way? $rrd_filename = "app-mailscannerV2-" . $app['app_id'] . ".rrd"; $options = "-O qv"; $oid = "nsExtendOutputFull.11.109.97.105.108.115.99.97.110.110.101.114"; $mailscanner = snmp_get($device, $oid, $options); echo " mailscanner"; list($msg_recv, $msg_rejected, $msg_relay, $msg_sent, $msg_waiting, $spam, $virus) = explode("\n", $mailscanner); rrdtool_create($device, $rrd_filename, " \\\n DS:msg_recv:COUNTER:600:0:125000000000 \\\n DS:msg_rejected:COUNTER:600:0:125000000000 \\\n DS:msg_relay:COUNTER:600:0:125000000000 \\\n DS:msg_sent:COUNTER:600:0:125000000000 \\\n DS:msg_waiting:COUNTER:600:0:125000000000 \\\n DS:spam:COUNTER:600:0:125000000000 \\\n DS:virus:COUNTER:600:0:125000000000 "); rrdtool_update($device, $rrd_filename, "N:{$msg_recv}:{$msg_rejected}:{$msg_relay}:{$msg_sent}:{$msg_waiting}:{$spam}:{$virus}"); // EOF
$version = preg_replace("/(.+),(.+),(.+)/", "\\1||\\2||\\3", $fnSysVersion); list($version, $features) = explode("||", $version); if (isset($rewrite_fortinet_hardware[$poll_device['sysObjectID']])) { $hardware = $rewrite_fortinet_hardware[$poll_device['sysObjectID']]; } #$cmd = $config['snmpget'] . " -M ".$config['mibdir']. " -m FORTINET-MIB-280 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname']; #$cmd .= " fnSysCpuUsage.0 fnSysMemUsage.0 fnSysSesCount.0 fnSysMemCapacity.0"; #$data = shell_exec($cmd); #list ($cpu, $mem, $ses, $memsize) = explode("\n", $data); $sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate_sessions.rrd"; $sessions = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysSesCount.0", "-Ovq"); if (is_numeric($sessions)) { if (!is_file($sessrrd)) { rrdtool_create($sessrrd, " --step 300 DS:sessions:GAUGE:600:0:3000000 " . $config['rrd_rra']); } print "Sessions: {$sessions}\n"; rrdtool_update($sessrrd, "N:" . $sessions); $graphs['fortigate_sessions'] = TRUE; } $cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate_cpu.rrd"; $cpu_usage = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0", "-Ovq"); if (is_numeric($cpu_usage)) { if (!is_file($cpurrd)) { rrdtool_create($cpurrd, " --step 300 DS:LOAD:GAUGE:600:-1:100 " . $config['rrd_rra']); } echo "CPU: {$cpu_usage}%\n"; rrdtool_update($cpurrd, " N:{$cpu_usage}"); $graphs['fortigate_cpu'] = TRUE; } #$mem=snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysMemUsage.0", "-Ovq"); #$memsize=snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysMemCapacity", "-Ovq");
$servers = explode("\n", $shoutcast); foreach ($servers as $item => $server) { $server = trim($server); if (!empty($server)) { $data = explode(';', $server); list($host, $port) = split(':', $data['0'], 2); $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']; $rrdfile = $config['rrd_dir'] . '/' . $device['hostname'] . '/app-shoutcast-' . $app['app_id'] . '-' . $host . '_' . $port . '.rrd'; if (!is_file($rrdfile)) { rrdtool_create($rrdfile, '--step 300 \\ DS:bitrate:GAUGE:600:0:125000000000 \\ DS:traf_in:GAUGE:600:0:125000000000 \\ DS:traf_out:GAUGE:600:0:125000000000 \\ DS:current:GAUGE:600:0:125000000000 \\ DS:status:GAUGE:600:0:125000000000 \\ DS:peak:GAUGE:600:0:125000000000 \\ DS:max:GAUGE:600:0:125000000000 \\ DS:unique:GAUGE:600:0:125000000000 ' . $config['rrd_rra']); } rrdtool_update($rrdfile, "N:{$bitrate}:{$traf_in}:{$traf_out}:{$current}:{$status}:{$peak}:{$max}:{$unique}"); } //end if } //end foreach
function poll_mib_def($device, $mib_name_table, $mib_subdir, $mib_oids, $mib_graphs, &$graphs) { global $config; echo "This is poll_mib_def Processing\n"; $mib = null; if (stristr($mib_name_table, 'UBNT')) { list($mib, ) = explode(':', $mib_name_table, 2); // $mib_dirs = mib_dirs($mib_subdir); $rrd_file = strtolower(safename($mib)) . '.rrd'; $influx_name = strtolower(safename($mib)); } else { list($mib, $file) = explode(':', $mib_name_table, 2); $rrd_file = strtolower(safename($file)) . '.rrd'; $influx_name = strtolower(safename($file)); } $rrdcreate = '--step 300 '; $oidglist = array(); $oidnamelist = array(); foreach ($mib_oids as $oid => $param) { $oidindex = $param[0]; $oiddsname = $param[1]; $oiddsdesc = $param[2]; $oiddstype = $param[3]; $oiddsopts = $param[4]; if (strlen($oiddsname) > 19) { $oiddsname = truncate($oiddsname, 19, ''); } if (empty($oiddsopts)) { $oiddsopts = '600:U:100000000000'; } $rrdcreate .= ' DS:' . $oiddsname . ':' . $oiddstype . ':' . $oiddsopts; if ($oidindex != '') { $fulloid = $oid . '.' . $oidindex; } else { $fulloid = $oid; } // Add to oid GET list $oidglist[] = $fulloid; $oidnamelist[] = $oiddsname; } //end foreach // Implde for LibreNMS Version $oidilist = implode(' ', $oidglist); $snmpdata = snmp_get_multi($device, $oidilist, '-OQUs', $mib); if (isset($GLOBALS['exec_status']['exitcode']) && $GLOBALS['exec_status']['exitcode'] !== 0) { print_debug(' ERROR, bad snmp response'); return false; } $oid_count = 0; $fields = array(); foreach ($oidglist as $fulloid) { list($splitoid, $splitindex) = explode('.', $fulloid, 2); $val = $snmpdata[$splitindex][$splitoid]; if (is_numeric($val)) { $fields[$oidnamelist[$oid_count]] = $val; } elseif (preg_match("/^\"(.*)\"\$/", $val, $number) && is_numeric($number[1])) { $fields[$oidnamelist[$oid_count]] = $number[1]; } else { $fields[$oidnamelist[$oid_count]] = 'U'; } $oid_count++; } $rrdfilename = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . $rrd_file; if (!is_file($rrdfilename)) { rrdtool_create($rrdfilename, $rrdcreate . ' ' . $config['rrd_rra']); } rrdtool_update($rrdfilename, $fields); $tags = array(); influx_update($device, $influx_name, $tags, $fields); foreach ($mib_graphs as $graphtoenable) { $graphs[$graphtoenable] = true; } return true; }
* * Copyright (c) 2015 Christophe Martinet Chrisgfx <*****@*****.**> * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ $version = trim(snmp_get($device, "productVersion.0", "-OQv", "PULSESECURE-PSG-MIB"), '"'); $hardware = "Juniper " . trim(snmp_get($device, "productName.0", "-OQv", "PULSESECURE-PSG-MIB"), '"'); $hostname = trim($poll_device['sysName'], '"'); $usersrrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/pulse_users.rrd'; $users = snmp_get($device, 'PULSESECURE-PSG-MIB::iveConcurrentUsers.0', '-OQv'); if (is_numeric($users)) { if (!is_file($usersrrd)) { rrdtool_create($usersrrd, ' DS:users:GAUGE:600:0:U' . $config['rrd_rra']); } $fields = array('users' => $users); rrdtool_update($usersrrd, $fields); $graphs['pulse_users'] = true; } $sessrrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/pulse_sessions.rrd'; $sessions = snmp_get($device, 'PULSESECURE-PSG-MIB::iveConcurrentUsers.0', '-OQv'); if (is_numeric($sessions)) { if (!is_file($sessrrd)) { rrdtool_create($sessrrd, ' DS:sessions:GAUGE:600:0:U ' . $config['rrd_rra']); } $fields = array('sessions' => $sessions); rrdtool_update($sessrrd, $fields); $graphs['pulse_sessions'] = true; }
<?php $storage_cache = array(); $query = "SELECT * FROM storage WHERE device_id = '" . $device['device_id'] . "'"; $storage_data = mysql_query($query); while ($storage = mysql_fetch_array($storage_data)) { echo $storage['storage_descr'] . ": "; $storage_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("storage-" . $storage['storage_mib'] . "-" . safename($storage['storage_descr']) . ".rrd"); if (!is_file($storage_rrd)) { rrdtool_create($storage_rrd, "--step 300 \\\n DS:used:GAUGE:600:0:U \\\n DS:free:GAUGE:600:0:U \\\n RRA:AVERAGE:0.5:1:600 \\\n RRA:AVERAGE:0.5:6:700 \\\n RRA:AVERAGE:0.5:24:775 \\\n RRA:AVERAGE:0.5:288:797 \\\n RRA:MIN:0.5:1:600 \\\n RRA:MIN:0.5:6:700 \\\n RRA:MIN:0.5:24:775 \\\n RRA:MIN:0.5:288:797 \\\n RRA:MAX:0.5:1:600 \\\n RRA:MAX:0.5:6:700 \\\n RRA:MAX:0.5:24:775 \\\n RRA:MAX:0.5:288:797"); } $file = $config['install_dir'] . "/includes/polling/storage-" . $storage['storage_mib'] . ".inc.php"; if (is_file($file)) { include $file; } else { ### FIXME GENERIC } if ($debug) { print_r($storage); } $percent = round($storage['used'] / $storage['size'] * 100); echo $percent . "% "; rrdtool_update($storage_rrd, "N:" . $storage['used'] . ":" . $storage['free']); $update_query = "UPDATE `storage` SET `storage_used` = '" . $storage['used'] . "'"; $update_query .= ", `storage_free` = '" . $storage['free'] . "', `storage_size` = '" . $storage['size'] . "'"; $update_query .= ", `storage_units` = '" . $storage['units'] . "', `storage_perc` = '" . $percent . "'"; $update_query .= " WHERE `storage_id` = '" . $storage['storage_id'] . "'"; if ($debug) { echo "{$update_query}\n"; } mysql_query($update_query);
$entPhysical_state[$index][$subindex][$group][$key] = $value; } } foreach ($chan_stats as $index => $entry) { list($index, $subindex) = explode('.', $index, 2); $group = 'c6kxbar'; foreach ($entry as $key => $value) { $entPhysical_state[$index][$subindex][$group][$key] = $value; } $fields = array('inutil' => $entry['cc6kxbarStatisticsInUtil'], 'oututil' => $entry['cc6kxbarStatisticsOutUtil'], 'outdropped' => $entry['cc6kxbarStatisticsOutDropped'], 'outerrors' => $entry['cc6kxbarStatisticsOutErrors'], 'inerrors' => $entry['cc6kxbarStatisticsInErrors']); $rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('c6kxbar-' . $index . '-' . $subindex . '.rrd'); d_echo("{$rrd} "); if (!is_file($rrd)) { rrdtool_create($rrd, '--step 300 DS:inutil:GAUGE:600:0:100 DS:oututil:GAUGE:600:0:100 DS:outdropped:DERIVE:600:0:125000000000 DS:outerrors:DERIVE:600:0:125000000000 DS:inerrors:DERIVE:600:0:125000000000 ' . $config['rrd_rra']); } rrdtool_update($rrd, $fields); } //end foreach // print_r($entPhysical_state); } //end if // Set Entity state foreach (dbFetch('SELECT * FROM `entPhysical_state` WHERE `device_id` = ?', array($device['device_id'])) as $entity) { if (!isset($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']])) { dbDelete('entPhysical_state', '`device_id` = ? AND `entPhysicalIndex` = ? AND `subindex` = ? AND `group` = ? AND `key` = ?', array($device['device_id'], $entity['entPhysicalIndex'], $entity['subindex'], $entity['group'], $entity['key'])); } else { if ($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']] != $entity['value']) {
echo " radioutil: {$radioutil}\n"; echo " numasoclients: {$numasoclients}\n"; echo " interference: {$interference}\n"; } // if there is a numeric channel, assume the rest of the data is valid, I guess if (is_numeric($channel)) { $rrd_file = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename("arubaap-{$name}.{$radionum}.rrd"); if (!is_file($rrd_file)) { $dslist = 'DS:channel:GAUGE:600:0:200 '; $dslist .= 'DS:txpow:GAUGE:600:0:200 '; $dslist .= 'DS:radioutil:GAUGE:600:0:100 '; $dslist .= 'DS:nummonclients:GAUGE:600:0:500 '; $dslist .= 'DS:nummonbssid:GAUGE:600:0:200 '; $dslist .= 'DS:numasoclients:GAUGE:600:0:500 '; $dslist .= 'DS:interference:GAUGE:600:0:2000 '; rrdtool_create($rrd_file, "--step 300 {$dslist} " . $config['rrd_rra']); } $fields = array('channel' => $channel, 'txpow' => $txpow, 'radioutil' => $radioutil, 'nummonclients' => $nummonclients, 'nummonbssid' => $nummonbssid, 'numasoclients' => $numasoclients, 'interference' => $interference); rrdtool_update($rrd_file, $fields); } // generate the mac address $macparts = explode('.', $radioid, -1); $mac = ''; foreach ($macparts as $part) { $mac .= sprintf('%02x', $part) . ':'; } $mac = rtrim($mac, ':'); $foundid = 0; for ($z = 0; $z < sizeof($ap_db); $z++) { if ($ap_db[$z]['name'] == $name && $ap_db[$z]['radio_number'] == $radionum) { $foundid = $ap_db[$z]['accesspoint_id'];
* Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ if ($device['os_group'] == "cisco") { // TODO: Need to test partial PRI. // Total $total = 0; foreach (snmpwalk_cache_oid_num($device, "1.3.6.1.2.1.2.2.1.3", NULL) as $key => $value) { // 81 is the ifType for DS0's if ($value[''] == "81") { $total++; } } // Active $active = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.10.19.1.1.4.0", NULL); $active = $active['1.3.6.1.4.1.9.10.19.1.1.4.0']['']; if (isset($active) && $active != "" && $total != 0) { $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cisco-iospri.rrd"); if (!file_exists($rrd_filename)) { rrdtool_create($rrd_filename, " DS:total:GAUGE:600:0:U DS:active:GAUGE:600:0:U" . $config['rrd_rra']); } $fields = array('total' => $total, 'active' => $active); rrdtool_update($rrd_filename, $fields); $tags = array(); influx_update($device, 'cisco-iospri', $tags, $fields); $graphs['cisco-iospri'] = TRUE; echo " Cisco IOS PRI "; } unset($rrd_filename, $total, $active); }
<?php // Polls MailScanner statistics from script via SNMP $rrd_filename = $config['rrd_dir'] . '/' . $device['hostname'] . '/app-mailscannerV2-' . $app['app_id'] . '.rrd'; $options = '-O qv'; $oid = 'nsExtendOutputFull.11.109.97.105.108.115.99.97.110.110.101.114'; $mailscanner = snmp_get($device, $oid, $options); echo ' mailscanner'; list($msg_recv, $msg_rejected, $msg_relay, $msg_sent, $msg_waiting, $spam, $virus) = explode("\n", $mailscanner); if (!is_file($rrd_filename)) { rrdtool_create($rrd_filename, '--step 300 \\ DS:msg_recv:COUNTER:600:0:125000000000 \\ DS:msg_rejected:COUNTER:600:0:125000000000 \\ DS:msg_relay:COUNTER:600:0:125000000000 \\ DS:msg_sent:COUNTER:600:0:125000000000 \\ DS:msg_waiting:COUNTER:600:0:125000000000 \\ DS:spam:COUNTER:600:0:125000000000 \\ DS:virus:COUNTER:600:0:125000000000 ' . $config['rrd_rra']); } $fields = array('msg_recv' => $msg_recv, 'msg_rejected' => $msg_rejected, 'msg_relay' => $msg_relay, 'msg_sent' => $msg_sent, 'msg_waiting' => $msg_waiting, 'spam' => $spam, 'virus' => $virus); rrdtool_update($rrd_filename, $fields);
foreach ($afis as $afi => $paths) { echo " |- {$afi}\n"; foreach ($paths as $path => $cef_stat) { echo ' | |-' . $path . ': ' . $cef_stat['cefSwitchingPath']; $cef_id = $device['device_id'] . '-' . $entity . '-' . $afi . '-' . $path; // if (dbFetchCell("SELECT COUNT(*) FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path)) != "1") if (!isset($cefs_db[$cef_id])) { dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $entity, 'afi' => $afi, 'cef_index' => $path, 'cef_path' => $cef_stat['cefSwitchingPath']), 'cef_switching'); echo '+'; } unset($cefs_db[$cef_id]); $cef_entry = dbFetchRow('SELECT * FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?', array($device['device_id'], $entity, $afi, $path)); $filename = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('cefswitching-' . $entity . '-' . $afi . '-' . $path . '.rrd'); if (!is_file($filename)) { rrdtool_create($filename, '--step 300 DS:drop:DERIVE:600:0:1000000 DS:punt:DERIVE:600:0:1000000 DS:hostpunt:DERIVE:600:0:1000000 ' . $config['rrd_rra']); } // Copy HC to non-HC if they exist if (is_numeric($cef_stat['cefSwitchingHCDrop'])) { $cef_stat['cefSwitchingDrop'] = $cef_stat['cefSwitchingHCDrop']; } if (is_numeric($cef_stat['cefSwitchingHCPunt'])) { $cef_stat['cefSwitchingPunt'] = $cef_stat['cefSwitchingHCPunt']; } if (is_numeric($cef_stat['cefSwitchingHCPunt2Host'])) { $cef_stat['cefSwitchingPunt2Host'] = $cef_stat['cefSwitchingHCPunt2Host']; } // FIXME -- memcached $cef_stat['update']['drop'] = $cef_stat['cefSwitchingDrop']; $cef_stat['update']['punt'] = $cef_stat['cefSwitchingPunt'];
} $pmxlines = explode("\n", $proxmox); $pmxcluster = array_shift($pmxlines); $pmxcdir = join('/', array($config['rrd_dir'], 'proxmox', $pmxcluster)); if (!is_dir($pmxcdir)) { mkdir($pmxcdir, 0775, true); } dbUpdate(array('device_id' => $device['device_id'], 'app_type' => 'proxmox', 'app_instance' => $pmxcluster), 'applications', '`device_id` = ? AND `app_type` = ?', array($device['device_id'], 'proxmox')); if (count($pmxlines) > 0) { $pmxcache = []; foreach ($pmxlines as $vm) { list($vmid, $vmport, $vmpin, $vmpout, $vmdesc) = explode('/', $vm, 5); $rrd_filename = join('/', array($pmxcdir, $vmid . '_netif_' . $vmport . '.rrd')); if (!is_file($rrd_filename)) { rrdtool_create($rrd_filename, ' --step 300 DS:INOCTETS:DERIVE:600:0:12500000000 DS:OUTOCTETS:DERIVE:600:0:12500000000 ' . $config['rrd_rra']); } rrdtool_update($rrd_filename, array("INOCTETS" => $vmpin, "OUTOCTETS" => $vmpout)); print "Proxmox ({$pmxcluster}): {$vmdesc}: {$vmpin}/{$vmpout}/{$vmport}\n"; if (proxmox_vm_exists($vmid, $pmxcluster, $pmxcache) === true) { dbUpdate(array('device_id' => $device['device_id'], 'last_seen' => array('NOW()'), 'description' => $vmdesc), 'proxmox', '`vmid` = ? AND `cluster` = ?', array($vmid, $pmxcluster)); } else { $pmxcache[$pmxcluster][$vmid] = dbInsert(array('cluster' => $pmxcluster, 'vmid' => $vmid, 'description' => $vmdesc, 'device_id' => $device['device_id']), 'proxmox'); } if ($portid = proxmox_port_exists($vmid, $pmxcluster, $vmport) !== false) { dbUpdate(array('last_seen' => array('NOW()')), 'proxmox_ports', '`vm_id` = ? AND `port` = ?', array($pmxcache[$pmxcluster][$vmid], $vmport)); } else { dbInsert(array('vm_id' => $pmxcache[$pmxcluster][$vmid], 'port' => $vmport), 'proxmox_ports'); } }
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2014 Adam Armstrong * */ if (!empty($agent_data['app']['nginx'])) { $nginx = $agent_data['app']['nginx']; $rrd_filename = "app-nginx-" . $app['app_id'] . ".rrd"; echo " nginx statistics" . PHP_EOL; list($active, $reading, $writing, $waiting, $req) = explode("\n", $nginx); rrdtool_create($device, $rrd_filename, " \\\n DS:Requests:DERIVE:600:0:125000000000 \\\n DS:Active:GAUGE:600:0:125000000000 \\\n DS:Reading:GAUGE:600:0:125000000000 \\\n DS:Writing:GAUGE:600:0:125000000000 \\\n DS:Waiting:GAUGE:600:0:125000000000 "); rrdtool_update($device, $rrd_filename, "N:{$req}:{$active}:{$reading}:{$writing}:{$waiting}"); unset($nginx, $rrd_filename, $active, $reading, $writing, $req); } // EOF
<?php if (!empty($agent_data['app']['postgresql'])) { $pgsql = $agent_data['app']['ntpd']; foreach (explode("\n", $pgsql) as $line) { list($item, $value) = explode(":", $line, 2); $pgsql_data[trim($item)] = trim($value); } $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-postgresql-" . $pgsql_data['version'] . "-" . $app['app_id'] . ".rrd"; // if $pgsql_data['version'] if (!is_file($rrd_filename)) { // version, ccount, tDbs, tUsr, tHst, idle, select, update, delete, other rrdtool_create($rrd_filename, " \\\n DS:cCount:GAUGE:600:0:1000000 \\\n DS:tDbs:GAUGE:600:0:1000000 \\\n DS:tUsr:GAUGE:600:0:1000000 \\\n DS:tHst:GAUGE:600:0:1000000 \\\n DS:idle:GAUGE:600:0:1000000 \\\n DS:select:GAUGE:600:0:1000000 \\\n DS:update:GAUGE:600:0:1000000 \\\n DS:delete:GAUGE:600:0:1000000 \\\n DS:other:GAUGE:600:0:1000000 "); } rrdtool_update($rrd_filename . "," . "N::" . $pgsql_data['cCount'] . "," . $pgsql_data['tDbs'] . "," . $pgsql_data['tUsr'] . "," . $pgsql_data['tHst'] . "," . $pgsql_data['idle'] . "," . $pgsql_data['select'] . "," . $pgsql_data['update'] . "," . $pgsql_data['delete'] . "," . $pgsql_data['other']); }
$oid_ds = truncate(str_replace("tcp", "", str_replace("Active", "Ac", str_replace("Passive", "Ps", str_replace("Zombie", "Zom", $oid)))), 19, ''); $rrd_create .= " DS:{$oid_ds}:GAUGE:600:U:100000000000"; } foreach ($oids_counter as $oid) { $oid_ds = truncate(str_replace("tcp", "", str_replace("Active", "Ac", str_replace("Passive", "Ps", str_replace("Zombie", "Zom", $oid)))), 19, ''); $rrd_create .= " DS:{$oid_ds}:COUNTER:600:U:100000000000"; } $data = snmpwalk_cache_oid($device, "nsTcpStatsGroup", array(), "NS-ROOT-MIB"); $rrdupdate = "N"; foreach ($oids as $oid) { if (is_numeric($data[0][$oid])) { $rrdupdate .= ":" . $data[0][$oid]; } else { $rrdupdate .= ":U"; } } if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } rrdtool_update($rrd_file, $rrdupdate); $graphs['netscaler_tcp_conn'] = TRUE; $graphs['netscaler_tcp_bits'] = TRUE; $graphs['netscaler_tcp_pkts'] = TRUE; $graphs['netscaler_tcp_errretransmit'] = TRUE; $graphs['netscaler_tcp_errretransmitgiveup'] = TRUE; $graphs['netscaler_tcp_errfullretransmit'] = TRUE; $graphs['netscaler_tcp_errpartialretransmit'] = TRUE; $graphs['netscaler_tcp_errfastretransmissions'] = TRUE; $graphs['netscaler_tcp_errxretransmissions'] = TRUE; } unset($oids, $data, $data_array, $oid);
*/ //<<<app-vmwaretools>>> //vmtotalmem:2051 //vmswap:117 //vmballoon:1302 //vmmemres:256 //vmmemlimit:U //vmspeed:2660000000 //vmcpulimit:U //vmcpures:0 if (!empty($agent_data['app']['vmwaretools'])) { $vmwaretools = $agent_data['app']['vmwaretools']; // Parse the data, first try key:value format $lines = explode("\n", $vmwaretools); foreach ($lines as $line) { // Parse key:value line list($key, $value) = explode(':', $line, 2); $values[$key] = $value; } $rrd_filename = "app-vmwaretools-" . $app['app_id'] . ".rrd"; list($vmtotalmem, $vmswap, $vmballoon) = explode("\n", $agent_data['app']['vmwaretools']); rrdtool_create($device, $rrd_filename, " \\\n DS:vmtotalmem:GAUGE:600:0:1000000 \\\n DS:vmswap:GAUGE:600:0:1000000 \\\n DS:vmballoon:GAUGE:600:0:1000000 \\\n DS:vmmemres:GAUGE:600:0:1000000 \\\n DS:vmmemlimit:GAUGE:600:0:1000000 \\\n DS:vmspeed:GAUGE:600:0:10000000000 \\\n DS:vmcpulimit:GAUGE:600:0:10000000000 \\\n DS:vmcpures:GAUGE:600:0:10000000000 "); // Construct the data $rrd_data = ""; $rrd_keys = array('vmtotalmem', 'vmswap', 'vmballoon', 'vmmemres', 'vmmemlimit', 'vmspeed', 'vmcpulimit', 'vmcpures'); foreach ($rrd_keys as $key) { $rrd_data .= ":" . $values[$key]; } rrdtool_update($device, $rrd_filename, "N" . $rrd_data); } // EOF
$mempool['used'] = $mempool['total'] * $mempool['perc'] / 100; } elseif (isset($mempool['perc'])) { $mempool['total'] = 100; $mempool['used'] = $mempool['perc']; } else { // Hrrmm.. it looks like empty snmp walk continue; } $mempool['free'] = $mempool['total'] - $mempool['used']; $hc = $mempool['mempool_hc'] ? ' (HC)' : ''; print_message("Mempool " . $mempool['mempool_descr'] . ': ' . $mempool['perc'] . '%%' . $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']); } if (!is_file($mempool_rrd)) { rrdtool_create($mempool_rrd, " DS:used:GAUGE:600:0:U DS:free:GAUGE:600:0:U "); } rrdtool_update($mempool_rrd, "N:" . $mempool['used'] . ":" . $mempool['free']); 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'])); echo PHP_EOL; } unset($cache_mempool, $mempool, $index); // EOF
$app_found['exchange'] = TRUE; echo "IS; "; $rrd_filename = $GLOBALS['config']['rrd_dir'] . "/" . $device['hostname'] . "/wmi-app-exchange-is.rrd"; if (!is_file($rrd_filename)) { rrdtool_create($rrd_filename, "DS:activeconcount:GAUGE:600:0:125000000000 " . "DS:usercount:GAUGE:600:0:125000000000 " . "DS:rpcrequests:GAUGE:600:0:125000000000 " . "DS:rpcavglatency:GAUGE:600:0:125000000000 " . "DS:clientrpcfailbusy:GAUGE:600:0:125000000000 "); } rrdtool_update($rrd_filename, "N:" . $wmi['exchange']['mailbox']['is']['ActiveConnectionCount'] . ":" . $wmi['exchange']['mailbox']['is']['UserCount'] . ":" . $wmi['exchange']['mailbox']['is']['RPCRequests'] . ":" . $wmi['exchange']['mailbox']['is']['RPCAveragedLatency'] . ":" . $wmi['exchange']['mailbox']['is']['ClientRPCsFailedServerTooBusy']); unset($wmi['exchange']['mailbox']['is'], $rrd_filename); } // 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; "; $rrd_filename = $GLOBALS['config']['rrd_dir'] . "/" . $device['hostname'] . "/wmi-app-exchange-mailbox.rrd"; if (!is_file($rrd_filename)) { rrdtool_create($rrd_filename, "DS:rpcavglatency:GAUGE:600:0:125000000000 " . "DS:msgqueued:GAUGE:600:0:125000000000 " . "DS:msgsentsec:GAUGE:600:0:125000000000 " . "DS:msgdeliversec:GAUGE:600:0:125000000000 " . "DS:msgsubmitsec:GAUGE:600:0:125000000000 "); } rrdtool_update($rrd_filename, "N:" . $wmi['exchange']['mailbox']['mailbox']['RPCAverageLatency'] . ":" . $wmi['exchange']['mailbox']['mailbox']['MessagesQueuedForSubmission'] . ":" . $wmi['exchange']['mailbox']['mailbox']['MessagesSentPersec'] . ":" . $wmi['exchange']['mailbox']['mailbox']['MessagesDeliveredPersec'] . ":" . $wmi['exchange']['mailbox']['mailbox']['MessagesSubmittedPersec']); } echo "\n"; } if ($app_found['exchange'] == TRUE) { $app['type'] = "exchange"; $app['name'] = "Exchange"; wmi_dbAppInsert($device['device_id'], $app); unset($app); } unset($wmi['exchange']); /* End of file exchange.inc.php */
$acc['update'][$oid_dir . '_prev'] = $acc[$oid_dir]; $oid_prev = $oid_dir . '_prev'; if ($this_ma[$oid][$dir]) { $oid_diff = $this_ma[$oid][$dir] - $acc[$oid_dir]; $oid_rate = $oid_diff / $polled_period; $acc['update'][$oid_dir . '_rate'] = $oid_rate; $acc['update'][$oid_dir . '_delta'] = $oid_diff; d_echo("\n {$oid_dir} ({$oid_diff} B) {$oid_rate} Bps {$polled_period} secs\n"); } } } d_echo("\n" . $acc['hostname'] . ' ' . $acc['ifDescr'] . " {$mac} -> {$b_in}:{$b_out}:{$p_in}:{$p_out} "); $rrdfile = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('cip-' . $acc['ifIndex'] . '-' . $acc['mac'] . '.rrd'); if (!is_file($rrdfile)) { rrdtool_create($rrdfile, 'DS:IN:COUNTER:600:0:12500000000 DS:OUT:COUNTER:600:0:12500000000 DS:PIN:COUNTER:600:0:12500000000 DS:POUT:COUNTER:600:0:12500000000 ' . $config['rrd_rra']); } // FIXME - use memcached to make sure these values don't go backwards? $fields = array('IN' => $b_in, 'OUT' => $b_out, 'PIN' => $p_in, 'POUT' => $p_out); rrdtool_update($rrdfile, $fields); $tags = array('ifIndex' => $acc['ifIndex'], 'mac' => $acc['mac']); influx_update($device, 'cip', $tags, $fields); if ($acc['update']) { // Do Updates dbUpdate($acc['update'], 'mac_accounting', '`ma_id` = ?', array($acc['ma_id'])); } //end if } //end if }
} else { $data = snmpwalk_cache_oid($device, $type, array(), $netstats['mib']); if (!count($data)) { continue; } $data_array = $data[0]; } $rrd_file = 'netstats-' . $type . '.rrd'; $rrd_create = ''; $rrd_update = 'N'; foreach ($oids as $oid) { $oid_ds = truncate($oid, 19, ''); if ($oid == 'tcpCurrEstab') { $rrd_create .= ' DS:' . $oid_ds . ':GAUGE:600:U:4294967295'; // Gauge32 max value 2^32 = 4294967295 } else { $rrd_create .= ' DS:' . $oid_ds . ':COUNTER:600:U:4294967295'; // Counter32 max value 2^32 = 4294967295 } $value = is_numeric($data_array[$oid]) ? $data_array[$oid] : 'U'; $rrd_update .= ':' . $value; } rrdtool_create($device, $rrd_file, $rrd_create); rrdtool_update($device, $rrd_file, $rrd_update); foreach ($netstats['graphs'] as $graph) { $graphs[$graph] = TRUE; } print_cli_data(nicecase($type) . " Graphs", implode(" ", $netstats['graphs']), 2); } unset($netstats_poll, $netstats, $type, $oids, $oid, $oid_ds, $oids_string, $data, $data_array, $rrd_create, $rrd_file, $rrd_update, $value, $mibs_blacklist); // EOF
<?php $version = preg_replace('/(.+)\\ version\\ (.+)\\ \\(SN:\\ (.+)\\,\\ (.+)\\)/', '\\1||\\2||\\3||\\4', $poll_device['sysDescr']); list($hardware, $version, $serial, $features) = explode('||', $version); $sessrrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/screenos_sessions.rrd'; $sess_cmd = $config['snmpget'] . ' -M ' . $config['mibdir'] . ' -O qv ' . snmp_gen_auth($device) . ' ' . $device['hostname']; $sess_cmd .= ' .1.3.6.1.4.1.3224.16.3.2.0 .1.3.6.1.4.1.3224.16.3.3.0 .1.3.6.1.4.1.3224.16.3.4.0'; $sess_data = shell_exec($sess_cmd); list($sessalloc, $sessmax, $sessfailed) = explode("\n", $sess_data); if (!is_file($sessrrd)) { rrdtool_create($sessrrd, ' --step 300 \\ DS:allocate:GAUGE:600:0:3000000 \\ DS:max:GAUGE:600:0:3000000 \\ DS:failed:GAUGE:600:0:1000 ' . $config['rrd_rra']); } rrdtool_update("{$sessrrd}", "N:{$sessalloc}:{$sessmax}:{$sessfailed}"); $graphs['screenos_sessions'] = true;