} 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
/* * LibreNMS Pulse Secure OS information module * * 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(snmp_get($device, "sysName.0", "-OQv", "SNMPv2-MIB"), '"'); $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']); } rrdtool_update($usersrrd, "N:{$users}"); $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']); } rrdtool_update($sessrrd, "N:{$sessions}"); $graphs['pulse_sessions'] = true; }
<?php $cpe_oids = array('cpeExtPsePortEnable', 'cpeExtPsePortDiscoverMode', 'cpeExtPsePortDeviceDetected', 'cpeExtPsePortIeeePd', 'cpeExtPsePortAdditionalStatus', 'cpeExtPsePortPwrMax', 'cpeExtPsePortPwrAllocated', 'cpeExtPsePortPwrAvailable', 'cpeExtPsePortPwrConsumption', 'cpeExtPsePortMaxPwrDrawn', 'cpeExtPsePortEntPhyIndex', 'cpeExtPsePortEntPhyIndex', 'cpeExtPsePortPolicingCapable', 'cpeExtPsePortPolicingEnable', 'cpeExtPsePortPolicingAction', 'cpeExtPsePortPwrManAlloc'); $peth_oids = array('pethPsePortAdminEnable', 'pethPsePortPowerPairsControlAbility', 'pethPsePortPowerPairs', 'pethPsePortDetectionStatus', 'pethPsePortPowerPriority', 'pethPsePortMPSAbsentCounter', 'pethPsePortType', 'pethPsePortPowerClassifications', 'pethPsePortInvalidSignatureCounter', 'pethPsePortPowerDeniedCounter', 'pethPsePortOverLoadCounter', 'pethPsePortShortCounter', 'pethMainPseConsumptionPower'); $port_stats = snmpwalk_cache_oid($device, 'pethPsePortEntry', $port_stats, 'POWER-ETHERNET-MIB'); $port_stats = snmpwalk_cache_oid($device, 'cpeExtPsePortEntry', $port_stats, 'CISCO-POWER-ETHERNET-EXT-MIB'); if ($port_stats[$port['ifIndex']] && $port['ifType'] == 'ethernetCsmacd' && isset($port_stats[$port['ifIndex']]['dot3StatsIndex'])) { // Check to make sure Port data is cached. $this_port =& $port_stats[$port['ifIndex']]; $rrdfile = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('port-' . $port['ifIndex'] . '-poe.rrd'); if (!file_exists($rrdfile)) { $rrd_create .= $config['rrd_rra']; // FIXME CISCOSPECIFIC $rrd_create .= ' DS:PortPwrAllocated:GAUGE:600:0:U'; $rrd_create .= ' DS:PortPwrAvailable:GAUGE:600:0:U'; $rrd_create .= ' DS:PortConsumption:DERIVE:600:0:U'; $rrd_create .= ' DS:PortMaxPwrDrawn:GAUGE:600:0:U '; rrdtool_create($rrdfile, $rrd_create); } $upd = "{$polled}:" . $port['cpeExtPsePortPwrAllocated'] . ':' . $port['cpeExtPsePortPwrAvailable'] . ':' . $port['cpeExtPsePortPwrConsumption'] . ':' . $port['cpeExtPsePortMaxPwrDrawn']; $ret = rrdtool_update("{$rrdfile}", $upd); echo 'PoE '; } //end if
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); }
$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 'no match!'; } unset($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']]); }
$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 } //end foreach unset($cip_array); if ($mac_entries) { echo " {$mac_entries} MAC accounting entries\n"; }
<?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);
// 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
$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) { $datas[$base . $nfsLabel[$base][$k]] = $v; } } } rrdtool_update($rrd_filename, "N:" . implode(':', $datas)); }
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); $tags = array('name' => 'powerdns', 'app_id' => $app['app_id']); influx_update($device, 'app', $tags, $fields);
if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); } $cpu5m = shell_exec($config['snmpget'] . " -m OLD-CISCO-CPU-MIB -O qv -{$snmpver} -c {$community} {$hostname}:{$port} avgBusy5.0"); $cpu5m = $cpu5m + 0; echo "{$hostname}\n"; if (!is_file($cpurrd)) { $rrdcreate = shell_exec($config['rrdtool'] . " create {$cpurrd} --step 300 \\\n DS:LOAD5M:GAUGE:600:-1:100 \\\n RRA:AVERAGE:0.5:1:2000 \\\n RRA:AVERAGE:0.5:6:2000 \\\n RRA:AVERAGE:0.5:24:2000 \\\n RRA:AVERAGE:0.5:288:2000 \\\n RRA:MAX:0.5:1:2000 \\\n RRA:MAX:0.5:6:2000 \\\n RRA:MAX:0.5:24:2000 \\\n RRA:MAX:0.5:288:2000 \\\n RRA:MIN:0.5:1:2000 \\\n RRA:MIN:0.5:6:2000 \\\n RRA:MIN:0.5:24:2000 \\\n RRA:MIN:0.5:288:2000"); } shell_exec($config['rrdtool'] . " update {$cpurrd} N:{$cpu5m}"); $mem_get = ".1.3.6.1.4.1.9.9.48.1.1.1.6.2 .1.3.6.1.4.1.9.9.48.1.1.1.6.1 .1.3.6.1.4.1.9.9.48.1.1.1.6.3"; $mem_get .= ".1.3.6.1.4.1.9.9.48.1.1.1.5.2 .1.3.6.1.4.1.9.9.48.1.1.1.5.1 .1.3.6.1.4.1.9.9.48.1.1.1.5.3"; $mem_raw = shell_exec($config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c {$community} {$hostname}:{$port} {$mem_get}"); $mem_raw = str_replace("No Such Instance currently exists at this OID", "0", $mem_raw); list($memfreeio, $memfreeproc, $memfreeprocb, $memusedio, $memusedproc, $memusedprocb) = explode("\n", $mem_raw); $memfreeproc = $memfreeproc + $memfreeprocb; $memusedproc = $memusedproc + $memusedprocb; $memfreeio = $memfreeio + 0; $memfreeproc = $memfreeproc + 0; $memusedio = $memusedio + 0; $memusedproc = $memusedproc + 0; $memtotal = $memfreeio + $memfreeproc + $memusedio + $memusedproc; if (!is_file($memrrd)) { shell_exec($config['rrdtool'] . " create {$memrrd} --step 300 \\\n DS:IOFREE:GAUGE:600:0:U \\\n DS:IOUSED:GAUGE:600:-1:U \\\n DS:PROCFREE:GAUGE:600:0:U \\\n DS:PROCUSED:GAUGE:600:-1:U \\\n DS:MEMTOTAL:GAUGE:600:-1:U \\\n RRA:AVERAGE:0.5:1:2000 \\\n RRA:AVERAGE:0.5:6:2000 \\\n RRA:AVERAGE:0.5:24:2000 \\\n RRA:AVERAGE:0.5:288:2000 \\\n RRA:MAX:0.5:1:2000 \\\n RRA:MAX:0.5:6:2000 \\\n RRA:MAX:0.5:24:2000 \\\n RRA:MAX:0.5:288:2000 \\\n RRA:MIN:0.5:1:2000 \\\n RRA:MIN:0.5:6:2000 \\\n RRA:MIN:0.5:24:2000 \\\n RRA:MIN:0.5:288:2000"); } rrdtool_update($memrrd, "N:{$memfreeio}:{$memusedio}:{$memfreeproc}:{$memusedproc}:{$memtotal}"); # include("includes/polling/cisco-processors.inc.php"); # include("includes/polling/cisco-enhanced-mempool.inc.php"); # include("includes/polling/cisco-mempool.inc.php"); # include("includes/polling/cisco-entity-sensors.inc.php");
$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");
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; }
<?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
$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
* * 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; }
$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); } unset($storage);
} 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 (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']; $cef_stat['update']['punt2host'] = $cef_stat['cefSwitchingPunt2Host']; $cef_stat['update']['drop_prev'] = $cef_entry['drop']; $cef_stat['update']['punt_prev'] = $cef_entry['punt']; $cef_stat['update']['punt2host_prev'] = $cef_entry['punt2host']; $cef_stat['update']['updated'] = $polled; $cef_stat['update']['updated_prev'] = $cef_entry['updated']; dbUpdate($cef_stat['update'], 'cef_switching', '`device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?', array($device['device_id'], $entity, $afi, $path)); $fields = array('drop' => $cef_stat['cefSwitchingDrop'], 'punt' => $cef_stat['cefSwitchingPunt'], 'hostpunt' => $cef_stat['cefSwitchingPunt2Host']); $ret = rrdtool_update("{$filename}", $fields); $tags = array('entity' => $entity, 'afi' => $afi, 'index' => $path); influx_update($device, 'cefswitching', $tags, $fields); echo "\n"; } //end foreach } //end foreach } //end foreach } //end if // FIXME - need to delete old ones. FIXME REALLY. print_r($cefs_db); foreach ($cefs_db as $cef_switching_id) { dbDelete('cef_switching', '`cef_switching_id` = ?', array($cef_switching_id));
$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'); } } } unset($pmxlines); unset($pmxcluster);
<?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']); }
$nummonbssid = $aruba_apstats["1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.10.{$radioid}"][''] + 0; $interference = $aruba_apstats["1.3.6.1.4.1.14823.2.2.1.5.3.1.6.1.11.{$radioid}"][''] + 0; $radionum = substr($radioid, strlen($radioid) - 1, 1); print_debug("* radioid: {$radioid}\n" . " radionum: {$radionum}\n" . " name: {$name}\n" . " type: {$type}\n" . " channel: {$channel}\n" . " txpow: {$txpow}\n" . " radioutil: {$radioutil}\n" . " numasoclients: {$numasoclients}\n" . " interference: {$interference}"); // if there is a numeric channel, assume the rest of the data is valid, I guess if (is_numeric($channel)) { $rrd_file = "arubaap-{$name}.{$radionum}.rrd"; $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($device, $rrd_file, "{$dslist} "); rrdtool_update($device, $rrd_file, "{$polled}:" . $channel . ":" . $txpow . ":" . $radioutil . ":" . $nummonclients . ":" . $nummonbssid . ":" . $numasoclients . ":" . $interference); } //generate the mac address $macparts = explode(".", $radioid, -1); $mac = ""; foreach ($macparts as $part) { $mac .= sprintf("%02x", $part) . ":"; } $mac = rtrim($mac, ":"); $foundid = 0; if (is_array($aps[$mac][$radionum])) { $ap_id = $aps[$mac][$radionum]['accesspoint_id']; dbUpdate(array('mac_addr' => $mac, 'deleted' => 0), 'accesspoints', '`accesspoint_id` = ?', array($foundid)); echo "."; } else { $ap_id = dbInsert(array('device_id' => $device['device_id'], 'name' => $name, 'radio_number' => $radionum, 'type' => $type, 'mac_addr' => $mac, 'deleted' => '0'), 'accesspoints');
*/ //<<<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
$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_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 */
} } } } 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") { $poll_device['sysLocation'] = ""; }
// Get data from the class table. if ($type == 2) { // Let's make sure the rrd is setup for this class. $filename = "port-" . $array['ifindex'] . "-cbqos-" . $array['sp-id'] . "-" . $array['sp-obj'] . ".rrd"; $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename($filename); if (!file_exists($rrd_filename)) { rrdtool_create($rrd_filename, " DS:postbits:COUNTER:600:0:U DS:bufferdrops:COUNTER:600:0:U DS:qosdrops:COUNTER:600:0:U" . $config['rrd_rra']); } // Let's print some debugging info. d_echo("\n\nComponent: " . $key . "\n"); d_echo(" Class-Map: " . $array['label'] . "\n"); d_echo(" SPID.SPOBJ: " . $array['sp-id'] . "." . $array['sp-obj'] . "\n"); d_echo(" PostBytes: 1.3.6.1.4.1.9.9.166.1.15.1.1.10." . $array['sp-id'] . "." . $array['sp-obj'] . " = " . $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.10'][$array['sp-id']][$array['sp-obj']] . "\n"); d_echo(" BufferDrops: 1.3.6.1.4.1.9.9.166.1.15.1.1.21." . $array['sp-id'] . "." . $array['sp-obj'] . " = " . $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.21'][$array['sp-id']][$array['sp-obj']] . "\n"); d_echo(" QOSDrops: 1.3.6.1.4.1.9.9.166.1.15.1.1.17." . $array['sp-id'] . "." . $array['sp-obj'] . " = " . $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.17'][$array['sp-id']][$array['sp-obj']] . "\n"); $rrd['postbytes'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.10'][$array['sp-id']][$array['sp-obj']]; $rrd['bufferdrops'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.21'][$array['sp-id']][$array['sp-obj']]; $rrd['qosdrops'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.17'][$array['sp-id']][$array['sp-obj']]; // Update rrd rrdtool_update($rrd_filename, $rrd); // Clean-up after yourself! unset($filename, $rrd_filename); } } // End foreach components echo $module . " "; } // end if count components // Clean-up after yourself! unset($type, $components, $component, $options, $module); }
<?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;