More updates for influx

This commit is contained in:
laf
2015-08-19 20:58:02 +00:00
parent d2676213a4
commit 433562d351
66 changed files with 355 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ include_once($config['install_dir'] . "/includes/dbFacile.php");
include_once($config['install_dir'] . "/includes/common.php");
include_once($config['install_dir'] . "/includes/rrdtool.inc.php");
include_once($config['install_dir'] . "/includes/influxdb.inc.php");
include_once($config['install_dir'] . "/includes/billing.php");
include_once($config['install_dir'] . "/includes/cisco-entities.php");
include_once($config['install_dir'] . "/includes/syslog.php");

77
includes/influxdb.inc.php Normal file
View File

@@ -0,0 +1,77 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
*
* 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.
*/
if ($config['influxdb']['enable'] === true) {
include $config['install_dir'].'/lib/influxdb-php/vendor/autoload.php';
}//end if
function influxdb_connect() {
global $config;
$influxdb_cred = '';
if (!empty($config['influxdb']['username']) && !empty($config['influxdb']['password'])) {
$influxdb_cred = $config['influxdb']['username'].':'.$config['influxdb']['password'].'@';
d_echo('Using authentication for InfluxDB');
}
$influxdb_url = $influxdb_cred.$influxdb_cred.$config['influxdb']['host'].':'.$config['influxdb']['port'].'/'.$config['influxdb']['db'];
d_echo($config['influxdb']['transport'] . " transport being used");
if ($config['influxdb']['transport'] == 'http') {
$influxdb_conn = 'influxdb';
}
elseif ($config['influxdb']['transport'] == 'udp') {
$influxdb_conn = 'udp+influxdb';
}
else {
echo 'InfluxDB support enabled but no valid transport details provided';
}
$db = \InfluxDB\Client::fromDSN($influxdb_conn.'://'.$influxdb_url);
return($db);
}// end influxdb_connect
function influx_update($device,$measurement,$tags=array(),$fields) {
global $influxdb,$config,$console_color;
$tmp_fields = array();
$tmp_tags['hostname'] = $device['hostname'];
foreach ($tags as $k => $v) {
$tmp_tags[$k] = $v;
}
foreach ($fields as $k => $v) {
$tmp_fields[$k] = force_influx_data('f',$v);
}
d_echo("\nInfluxDB data:\n");
d_echo($measurement);
d_echo($tmp_tags);
d_echo($tmp_fields);
d_echo("\nEND\n");
if ($config['noinfluxdb'] !== true) {
$points = array(
new InfluxDB\Point(
$measurement,
null, // the measurement value
$tmp_tags,
$tmp_fields // optional additional fields
)
);
$result = $influxdb->writePoints($points);
d_echo($result);
}
else {
print $console_color->convert('[%gInfluxDB Disabled%n] ', false);
}//end if
}// end influx_update

View File

@@ -42,6 +42,10 @@ if ($device['os'] == 'asa' || $device['os'] == 'pix') {
if ($data_array[0]['alSslStatsTotalSessions'] || is_file($rrdfile)) {
rrdtool_update($rrdfile, $fields);
$tags = array();
influx_update($device,'altiga-ssl',$tags,$fields);
}
unset($rrdfile, $fields, $data_array);

View File

@@ -70,3 +70,7 @@ $fields = array(
);
rrdtool_update($rrd_filename, $fields);
$tags = array('name' => 'apache', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);

View File

@@ -101,4 +101,7 @@ if (!empty($agent_data['app']['bind']) && $app['app_id'] > 0) {
rrdtool_update($rrd_filename, $fields);
$tags = array('name' => 'bind', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);
}//end if

View File

@@ -43,4 +43,7 @@ $fields = array(
rrdtool_update($rrd_filename, $fields);
$tags = array('name' => 'drbd', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);
unset($drbd);

View File

@@ -36,3 +36,7 @@ $fields = array(
);
rrdtool_update($rrd_filename, $fields);
$tags = array('name' => 'mailscannerV2', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);

View File

@@ -54,3 +54,7 @@ $fields = array(
);
rrdtool_update($rrd_filename, $fields);
$tags = array('name' => 'memcached', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);

View File

@@ -203,6 +203,9 @@ if (!is_file($mysql_rrd)) {
rrdtool_update($mysql_rrd, $fields);
$tags = array('name' => 'mysql', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);
// Process state statistics
$mysql_status_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/app-mysql-'.$app['app_id'].'-status.rrd';
@@ -240,3 +243,7 @@ if (!is_file($mysql_status_rrd)) {
}
rrdtool_update($mysql_status_rrd, $fields);
$tags = array('name' => 'mysql', 'app_id' => $app['app_id'], 'status' => true);
influx_update($device,'app',$tags,$fields);

View File

@@ -36,6 +36,9 @@ $fields = array(
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);

View File

@@ -32,3 +32,7 @@ $fields = array(
);
rrdtool_update($rrd_filename, $fields);
$tags = array('name' => 'ntpclient', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);

View File

@@ -52,3 +52,6 @@ $fields = array(
);
rrdtool_update($rrd_filename, $fields);
$tags = array('name' => 'ntpdserver', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);

View File

@@ -70,3 +70,7 @@ $fields = array(
);
rrdtool_update($rrd_filename, $fields);
$tags = array('name' => 'powerdns', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);

View File

@@ -54,5 +54,8 @@ foreach ($servers as $item => $server) {
rrdtool_update($rrdfile, $fields);
$tags = array('name' => 'shoutcast', 'app_id' => $app['app_id'], 'host' => $host, 'port' => $port);
influx_update($device,'app',$tags,$fields);
}//end if
}//end foreach

View File

@@ -55,4 +55,8 @@ if (!empty($agent_data['app']['tinydns']) && $app['app_id'] > 0) {
}//end if
rrdtool_update($rrd_filename, 'N:'.$agent_data['app']['tinydns']);
$tags = array('name' => 'tinydns', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);
}//end if

View File

@@ -56,6 +56,9 @@ if ($device['type'] == 'wireless' && $device['os'] == 'arubaos') {
);
$ret = rrdtool_update($rrdfile, $fields);
$tags = array();
influx_update($device,'aruba-controller',$tags,$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');
@@ -68,6 +71,9 @@ if ($device['type'] == 'wireless' && $device['os'] == 'arubaos') {
);
rrdtool_update($wificlientsrrd, $fields);
$tags = array('radio' => '1');
influx_update($device,'wificlients',$tags,$fields);
$graphs['wifi_clients'] = true;
@@ -127,6 +133,9 @@ if ($device['type'] == 'wireless' && $device['os'] == 'arubaos') {
rrdtool_update($rrd_file, $fields);
$tags = array('name' => $name, 'radionum' => $radionum);
influx_update($device,'aruba',$tags,$fields);
}
// generate the mac address

View File

@@ -167,6 +167,9 @@ if ($config['enable_bgp']) {
);
rrdtool_update("$peerrrd", $fields);
$tags = array('bgpPeerIdentifier' => $peer['bgpPeerIdentifier']);
influx_update($device,'bgp',$tags,$fields);
$peer['update']['bgpPeerState'] = $bgpPeerState;
$peer['update']['bgpPeerAdminStatus'] = $bgpPeerAdminStatus;
$peer['update']['bgpPeerFsmEstablishedTime'] = $bgpPeerFsmEstablishedTime;
@@ -337,6 +340,9 @@ if ($config['enable_bgp']) {
);
rrdtool_update("$cbgp_rrd", $fields);
$tags = array('bgpPeerIdentifier' => $peer['bgpPeerIdentifier'], 'afi' => $afi, 'safi' => $safi);
influx_update($device,'cbgp',$tags,$fields);
} //end foreach
} //end if
echo "\n";

View File

@@ -96,6 +96,10 @@ foreach ($ipsec_array as $index => $tunnel) {
rrdtool_create($rrd_file, $rrd_create);
}
rrdtool_update($rrd_file, $fields);
$tags = array('address' => $address);
influx_update($device,'ipsectunnel',$tags,$fields);
// $graphs['ipsec_tunnels'] = TRUE;
}
}//end foreach

View File

@@ -58,6 +58,10 @@ foreach ($rserver_array as $index => $serverfarm) {
rrdtool_create($rrd_file, $rrd_create);
}
rrdtool_update($rrd_file, $fields);
$tags = array('farm_id' => $clean_index);
influx_update($device,'rservers',$tags,$fields);
}
}//end foreach

View File

@@ -62,6 +62,10 @@ foreach ($serverfarm_array as $index => $vserver) {
rrdtool_create($rrd_file, $rrd_create);
}
rrdtool_update($rrd_file, $fields);
$tags = array('classmap_id' => $classmap_id);
influx_update($device,'vservers',$tags,$fields);
}
}//end foreach

View File

@@ -44,6 +44,10 @@ if ($device['os_group'] == 'cisco' && $device['os'] == 'asa' && $device['type']
);
rrdtool_update($rrd_filename, $fields);
$tags = array();
influx_update($device,'asa_conns',$tags,$fields);
$graphs['asa_conns'] = true;
echo ' ASA Connections';
}

View File

@@ -94,6 +94,9 @@ if ($device['os_group'] == 'cisco') {
$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

View File

@@ -106,6 +106,9 @@ if ($device['os_group'] == 'cisco') {
);
rrdtool_update($rrd_filename, $fields);
$tags = array();
influx_update($device,'cipsec_flow',$tags,$fields);
$graphs['cipsec_flow_tunnels'] = true;
$graphs['cipsec_flow_pkts'] = true;
$graphs['cipsec_flow_bits'] = true;

View File

@@ -85,6 +85,9 @@ if ($device['os_group'] == 'cisco') {
);
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']));

View File

@@ -61,6 +61,9 @@ if ($device['os_group'] == 'cisco') {
rrdtool_update($rrd_filename, $fields);
$tags = array();
influx_update($device,'cras_sessions',$tags,$fields);
$graphs['cras_sessions'] = true;
echo ' CRAS Sessions';
}

View File

@@ -62,5 +62,9 @@ foreach (dbFetchRows('SELECT * FROM `slas` WHERE `device_id` = ? AND `deleted` =
);
rrdtool_update($slarrd, $fields);
$tags = array('sla_nr' => $sla['sla_nr']);
influx_update($device,'sla',$tags,$fields);
echo "\n";
}//end foreach

View File

@@ -37,6 +37,9 @@ if ($device['os_group'] == "cisco") {
rrdtool_update ($rrd_filename, $fields);
$tags = array();
influx_update($device,'cisco-iosdsp',$tags,$fields);
$graphs['cisco-iosdsp'] = TRUE;
echo (" Cisco IOS DSP ");
}

View File

@@ -36,6 +36,9 @@ if ($device['os_group'] == "cisco") {
rrdtool_update ($rrd_filename, $fields);
$tags = array();
influx_update($device,'cisco-iosmtp',$tags,$fields);
$graphs['cisco-iosmtp'] = TRUE;
echo (" Cisco IOS MTP ");
}

View File

@@ -41,6 +41,9 @@ if ($device['os_group'] == "cisco") {
rrdtool_update ($rrd_filename, $fields);
$tags = array();
influx_update($device,'cisco-iospri',$tags,$fields);
$graphs['cisco-iospri'] = TRUE;
echo (" Cisco IOS PRI ");
}

View File

@@ -36,6 +36,9 @@ if ($device['os_group'] == "cisco") {
rrdtool_update ($rrd_filename, $fields);
$tags = array();
influx_update($device,'cisco-iosxcode',$tags,$fields);
$graphs['cisco-iosxcode'] = TRUE;
echo (" Cisco IOS Transcoder ");
}

View File

@@ -26,6 +26,9 @@ if ($device['os_group'] == 'cisco') {
rrdtool_update($rrd_filename, $fields);
$tags = array('type' => $type);
influx_update($device,'vpdn',$tags,$fields);
$graphs['vpdn_sessions_'.$type] = true;
$graphs['vpdn_tunnels_'.$type] = true;

View File

@@ -52,6 +52,9 @@ if ($device['os'] == 'ios') {
rrdtool_update($rrd, $fields);
$tags = array('index' => $index, 'subindex' => $subindex);
influx_update($device,'c6kxbar',$tags,$fields);
}//end foreach
// print_r($entPhysical_state);

View File

@@ -111,6 +111,9 @@ function poll_sensor($device, $class, $unit) {
rrdtool_update($rrd_file, $fields);
$tags = array('sensor_class' => $sensor['sensor_class'], 'sensor_type' => $sensor['sensor_type'], 'sensor_descr' => $sensor['sensor_descr'], 'sensor_index' => $sensor['sensor_index']);
influx_update($device,'sensor',$tags,$fields);
// FIXME also warn when crossing WARN level!!
if ($sensor['sensor_limit_low'] != '' && $sensor['sensor_current'] > $sensor['sensor_limit_low'] && $sensor_value <= $sensor['sensor_limit_low'] && $sensor['sensor_alert'] == 1) {
echo 'Alerting for '.$device['hostname'].' '.$sensor['sensor_descr']."\n";
@@ -267,6 +270,10 @@ function poll_device($device, $options) {
'poller' => $device_time,
);
rrdtool_update($poller_rrd, $fields);
$tags = array();
influx_update($device,'poller-perf',$tags,$fields);
}
// Ping response rrd
@@ -281,6 +288,10 @@ function poll_device($device, $options) {
);
rrdtool_update($ping_rrd, $fields);
$tags = array();
influx_update($device,'ping-perf',$tags,$fields);
}
$update_array['last_polled'] = array('NOW()');
@@ -319,10 +330,12 @@ function poll_mib_def($device, $mib_name_table, $mib_subdir, $mib_oids, $mib_gra
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 ';
@@ -386,6 +399,9 @@ function poll_mib_def($device, $mib_name_table, $mib_subdir, $mib_oids, $mib_gra
rrdtool_update($rrdfilename, $fields);
$tags = array();
influx_update($device,$influx_name,$tags,$fields);
foreach ($mib_graphs as $graphtoenable) {
$graphs[$graphtoenable] = true;
}

View File

@@ -22,6 +22,10 @@ if (is_numeric($hrSystem[0]['hrSystemProcesses'])) {
);
rrdtool_update($rrd_file, $fields);
$tags = array();
influx_update($device,'hr_processes',$tags,$fields);
$graphs['hr_processes'] = true;
echo ' Processes';
}
@@ -41,6 +45,10 @@ if (is_numeric($hrSystem[0]['hrSystemNumUsers'])) {
);
rrdtool_update($rrd_file, $fields);
$tags = array();
influx_update($device,'hr_users',$tags,$fields);
$graphs['hr_users'] = true;
echo ' Users';
}

View File

@@ -117,6 +117,9 @@ if ($ipSystemStats) {
rrdtool_update($rrdfile, $fields);
$tags = array('af' => $af);
influx_update($device,'ipSystemStats',$tags,$fields);
unset($fields, $rrd_create);
// FIXME per-AF?

View File

@@ -49,6 +49,9 @@ if ($ipmi['host'] = get_dev_attrib($device, 'ipmi_hostname')) {
rrdtool_update($rrd_file, $fields);
$tags = array('sensor_class' => $sensor['sensor_class'], 'sensor_type' => $sensor['sensor_type'], 'sensor_descr' => $sensor['sensor_descr'], 'sensor_index' => $sensor['sensor_index']);
influx_update($device,'ipmi',$tags,$fields);
// FIXME warnings in event & mail not done here yet!
dbUpdate(array('sensor_current' => $sensor), 'sensors', 'poller_type = ? AND sensor_class = ? AND sensor_id = ?', array('ipmi', $ipmisensors['sensor_class'], $ipmisensors['sensor_id']));
}

View File

@@ -66,6 +66,9 @@ if (count($vp_rows)) {
rrdtool_update($rrd, $fields);
$tags = array('ifIndex' => $vp['ifIndex'], 'vp_id' => $vp['vp_id']);
influx_update($device,'atm-vp',$tags,$fields);
}//end foreach
echo "\n";

View File

@@ -32,6 +32,9 @@ foreach (dbFetchRows('SELECT * FROM mempools WHERE device_id = ?', array($device
);
rrdtool_update($mempool_rrd, $fields);
$tags = array('mempool_type' => $mempool['mempool_type'], 'mempool_index' => $mempool['mempool_index']);
influx_update($device,'mempool',$tags,$fields);
$mempool['state'] = array(
'mempool_used' => $mempool['used'],
'mempool_perc' => $percent,

View File

@@ -129,6 +129,10 @@ if ($device['os'] == 'netscaler') {
}
rrdtool_update($rrd_file, $fields);
$tags = array();
influx_update($device,'netscaler-stats-tcp',$tags,$fields);
$graphs['netscaler_tcp_conn'] = true;
$graphs['netscaler_tcp_bits'] = true;
$graphs['netscaler_tcp_pkts'] = true;

View File

@@ -125,6 +125,9 @@ if ($device['os'] == 'netscaler') {
rrdtool_update($rrd_file, $fields);
$tags = array('vsvrName' => $vsvr['vsvrName']);
influx_update($device,'netscaler-vsvr',$tags,$fields);
echo "\n";
}//end if
}//end foreach

View File

@@ -66,6 +66,10 @@ if ($device['os'] != 'Snom') {
}
rrdtool_update($rrd_file, $fields);
$tags = array();
influx_update($device,'netstats-icmp',$tags,$fields);
$graphs['netstat_icmp'] = true;
$graphs['netstat_icmp_info'] = true;
}

View File

@@ -54,6 +54,10 @@ if ($device['os'] != 'Snom') {
}
rrdtool_update($rrd_file, $fields);
$tags = array();
influx_update($device,'netstats-ip',$tags,$fields);
$graphs['netstat_ip'] = true;
$graphs['netstat_ip_frag'] = true;
}

View File

@@ -38,6 +38,11 @@ if ($device['os'] != 'Snom') {
}
rrdtool_update($rrd_file, $fields);
$tags = array();
influx_update($device,'netstats-ip_forward',$tags,$fields);
$graphs['netstat_ip_forward'] = true;
}
}

View File

@@ -65,6 +65,10 @@ if ($device['os'] != 'Snom') {
}
rrdtool_update($rrd_file, $fields);
$tags = array();
influx_update($device,'netstats-snmp',$tags,$fields);
$graphs['netstat_snmp'] = true;
$graphs['netstat_snmp_pkt'] = true;
}

View File

@@ -56,6 +56,10 @@ if ($device['os'] != 'Snom') {
}
rrdtool_update($rrd_file, $fields);
$tags = array();
influx_update($device,'netstats-tcp',$tags,$fields);
$graphs['netstat_tcp'] = true;
}

View File

@@ -43,6 +43,10 @@ if ($device['os'] != 'Snom') {
}
rrdtool_update($rrd_file, $fields);
$tags = array();
influx_update($device,'netstats-udp',$tags,$fields);
$graphs['netstat_udp'] = true;
}
}//end if

View File

@@ -30,6 +30,9 @@ if (is_numeric($sessions)) {
rrdtool_update($sessrrd, $fields);
$tags = array();
influx_update($device,'fortigate)sessions',$tags,$fields);
$graphs['fortigate_sessions'] = true;
}
@@ -49,5 +52,8 @@ if (is_numeric($cpu_usage)) {
rrdtool_update($cpurrd, $fields);
$tags = array();
influx_update($device,'fortigate_cpu',$tags,$fields);
$graphs['fortigate_cpu'] = true;
}

View File

@@ -19,5 +19,8 @@ if (is_numeric($sessions)) {
rrdtool_update($sessrrd, $fields);
$tags = array();
influx_update($device,'panos-sessions',$tags,$fields);
$graphs['panos_sessions'] = true;
}

View File

@@ -50,6 +50,9 @@ if (is_numeric($FdbAddressCount)) {
rrdtool_update($fdb_rrd_file, $fields);
$tags = array();
influx_update($device,'fdb_count',$tags,$fields);
$graphs['fdb_count'] = true;
echo 'FDB Count ';

View File

@@ -27,4 +27,7 @@ $fields = array(
rrdtool_update("$sessrrd", $fields);
$tags = array();
influx_update($device,'screenos_sessions',$tags,$fields);
$graphs['screenos_sessions'] = true;

View File

@@ -46,3 +46,6 @@ $fields = array(
);
rrdtool_update("$rrdfile", $fields);
$tags = array();
influx_update($device,'snom-data',$tags,$fields);

View File

@@ -380,6 +380,9 @@ $fields = array(
);
$ret = rrdtool_update("$filename", $fields);
$tags = array();
influx_update($device,'ospf-statistics',$tags,$fields);
unset($ospf_ports_db);
unset($ospf_ports_poll);

View File

@@ -168,5 +168,8 @@ if (isset($port_stats[$port['ifIndex']]['adslLineCoding'])) {
rrdtool_update($rrdfile, $fields);
$tags = array('ifName' => $port['ifName']);
influx_update($device,'adsl',$tags,$fields);
echo 'ADSL ('.$this_port['adslLineCoding'].'/'.formatRates($this_port['adslAtucChanCurrTxRate']).'/'.formatRates($this_port['adslAturChanCurrTxRate']).')';
}//end if

View File

@@ -33,5 +33,8 @@ if ($port_stats[$port['ifIndex']] &&
rrdtool_update($rrdfile, $fields);
$tags = array('ifName' => $port['ifName']);
influx_update($device,'dot3',$tags,$fields);
echo 'EtherLike ';
}

View File

@@ -69,5 +69,8 @@ if ($port_stats[$port['ifIndex']]
$ret = rrdtool_update("$rrdfile", $fields);
$tags = array('ifName' => $port['ifName']);
influx_update($device,'poe',$tags,$fields);
echo 'PoE ';
}//end if

View File

@@ -510,6 +510,13 @@ foreach ($ports as $port) {
);
rrdtool_update("$rrdfile", $fields);
$fields['ifSpeed'] = $port['ifSpeed'];
print_r($this_port);
$tags = array('ifName' => $this_port['ifName']);
influx_update($device,'ports',$tags,$fields);
// End Update IF-MIB
// Update PAgP
if ($this_port['pagpOperationMode'] || $port['pagpOperationMode']) {

View File

@@ -37,5 +37,8 @@ foreach (dbFetchRows('SELECT * FROM processors WHERE device_id = ?', array($devi
rrdtool_update($procrrd, $fields);
$tags = array('processor_type' => $processor['processor_type']);
influx_update($device,'processors',$tags,$fields);
dbUpdate(array('processor_usage' => $proc), 'processors', '`processor_id` = ?', array($processor['processor_id']));
}//end foreach

View File

@@ -39,6 +39,9 @@ foreach (dbFetchRows('SELECT * FROM storage WHERE device_id = ?', array($device[
rrdtool_update($storage_rrd, $fields);
$tags = array('mib' => $storage['storage_mib'], 'descr' => $storage['storage_descr']);
influx_update($device,'storage',$tags,$fields);
if ($config['memcached']['enable'] === true) {
$memcache->set('storage-'.$storage['storage_id'].'-used', $storage['used']);
$memcache->set('storage-'.$storage['storage_id'].'-free', $storage['free']);

View File

@@ -80,6 +80,11 @@ if (is_numeric($uptime)) {
rrdtool_update($uptime_rrd, $fields);
$measurement = 'uptime';
$tags = array();
influx_update($device,$measurement,$tags,$fields);
$graphs['uptime'] = true;
echo 'Uptime: '.formatUptime($uptime)."\n";

View File

@@ -36,6 +36,9 @@ if ($config['enable_printers']) {
rrdtool_update($tonerrrd, $fields);
$tags = array('index' => $toner['toner_index']);
influx_update($device,'toner',$tags,$fields);
// FIXME should report for toner out... :)
// Log toner swap
if ($tonerperc > $toner['toner_current']) {

View File

@@ -44,6 +44,10 @@ if (count($diskio_data)) {
);
rrdtool_update($rrd, $fields);
$tags = array('descr' => $diskio['diskio_descr']);
influx_update($device,'ucd_diskio',$tags,$fields);
}//end foreach
echo "\n";

View File

@@ -56,6 +56,10 @@ if (is_numeric($ss['ssCpuRawUser']) && is_numeric($ss['ssCpuRawNice']) && is_num
);
rrdtool_update($cpu_rrd, $fields);
$tags = array();
influx_update($device,'ucd_cpu',$tags,$fields);
$graphs['ucd_cpu'] = true;
}
@@ -90,6 +94,10 @@ foreach ($collect_oids as $oid) {
);
rrdtool_update($filename, $fields);
$tags = array('oid' => $oid);
influx_update($device,'ucd_cpu',$tags,$fields);
$graphs['ucd_cpu'] = true;
}
}
@@ -165,6 +173,9 @@ if (is_numeric($memTotalReal) && is_numeric($memAvailReal) && is_numeric($memTot
rrdtool_update($mem_rrd, $fields);
$tags = array();
influx_update($device,'ucd_mem',$tags,$fields);
$graphs['ucd_memory'] = true;
}
@@ -188,6 +199,10 @@ if (is_numeric($load_raw[2]['laLoadInt'])) {
);
rrdtool_update($load_rrd, $fields);
$tags = array();
influx_update($device,'ucd_load',$tags,$fields);
$graphs['ucd_load'] = 'TRUE';
}

View File

@@ -45,6 +45,10 @@ if ($device['os_group'] == 'unix') {
);
rrdtool_update($agent_rrd, $fields);
$tags = array();
influx_update($device,'agent',$tags,$fields);
$graphs['agent'] = true;
foreach (explode('<<<', $agent_raw) as $section) {

View File

@@ -115,6 +115,9 @@ if (!empty($agent_data['munin'])) {
rrdtool_update($filename, $fields);
$tags = array('plugin' => $plugin_type);
influx_update($device,'munin-plugins',$tags,$fields);
if (empty($ds_list[$ds_uniq])) {
$insert = array(
'mplug_id' => $mplug_id,

View File

@@ -85,6 +85,9 @@ if ($device['type'] == 'network' || $device['type'] == 'firewall' || $device['ty
rrdtool_update($wificlientsrrd, $fields);
$tags = array('radio' => '1');
influx_update($device,'wificlients',$tags,$fields);
$graphs['wifi_clients'] = true;
}
@@ -105,6 +108,10 @@ if ($device['type'] == 'network' || $device['type'] == 'firewall' || $device['ty
rrdtool_update($wificlientsrrd, $fields);
$tags = array('radio' => '2');
influx_update($device,'wificlients',$tags,$fields);
$graphs['wifi_clients'] = true;
}

View File

@@ -24,7 +24,7 @@ require 'includes/alerts.inc.php';
$poller_start = utime();
echo $config['project_name_version']." Poller\n\n";
$options = getopt('h:m:i:n:r::d::a::');
$options = getopt('h:m:i:n:r::d::a::f::');
if ($options['h'] == 'odd') {
$options['n'] = '1';
@@ -72,6 +72,7 @@ if (!$where) {
echo " Instances start at 0. 0-3 for -n 4\n\n";
echo "Debugging and testing options:\n";
echo "-r Do not create or update RRDs\n";
echo "-f Do not insert data into InfluxDB\n";
echo "-d Enable debugging output\n";
echo "-m Specify module(s) to be run\n";
echo "\n";
@@ -99,6 +100,14 @@ if (isset($options['r'])) {
$config['norrd'] = true;
}
if (isset($options['f'])) {
$config['noinfluxdb'] = true;
}
if ($config['noinfluxdb'] !== true) {
$influxdb = influxdb_connect();
}
rrdtool_pipe_open($rrd_process, $rrd_pipes);
echo "Starting polling run:\n\n";