From 6640a210abb5b0b8b102caee315899e4c830a0af Mon Sep 17 00:00:00 2001 From: laf Date: Tue, 18 Aug 2015 19:20:11 +0000 Subject: [PATCH] Putting things back to normal --- includes/polling/ports.inc.php | 19 ------------- includes/polling/system.inc.php | 4 --- includes/rrdtool.inc.php | 47 --------------------------------- 3 files changed, 70 deletions(-) diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index 114f0b416..f374f5f62 100644 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -509,25 +509,6 @@ foreach ($ports as $port) { $this_port['ifOutMulticastPkts'], ); - $measurement = 'port'; - $tags = array('ifIndex' => $this_port['ifIndex']); - $fields = array('ifInOctets' => $this_port['ifInOctets'], - 'ifOutOctets' => $this_port['ifOutOctets'], - 'ifInErrors' => $this_port['ifInErrors'], - 'ifOutErrors' => $this_port['ifOutErrors'], - 'ifInUcastPkts' => $this_port['ifInUcastPkts'], - 'ifOutUcastPkts' => $this_port['ifOutUcastPkts'], - 'ifInNUcastPkts' => $this_port['ifInNUcastPkts'], - 'ifOutNUcastPkts' => $this_port['ifOutNUcastPkts'], - 'ifInDiscards' => $this_port['ifInDiscards'], - 'ifOutDiscards' => $this_port['ifOutDiscards'], - 'ifInUnknownProtos' => $this_port['ifInUnknownProtos'], - 'ifInBroadcastPkts' => $this_port['ifInBroadcastPkts'], - 'ifOutBroadcastPkts' => $this_port['ifOutBroadcastPkts'], - 'ifInMulticastPkts' => $this_port['ifInMulticastPkts'], - 'ifOutMulticastPkts' => $this_port['ifOutMulticastPkts'] - ); - influx_update($device,$measurement,$tags,$fields); rrdtool_update("$rrdfile", $this_port['rrd_update']); // End Update IF-MIB // Update PAgP diff --git a/includes/polling/system.inc.php b/includes/polling/system.inc.php index 181318f12..db39b2906 100644 --- a/includes/polling/system.inc.php +++ b/includes/polling/system.inc.php @@ -74,10 +74,6 @@ if (is_numeric($uptime)) { rrdtool_create($uptime_rrd, 'DS:uptime:GAUGE:600:0:U '.$config['rrd_rra']); } - $measurement = 'uptime'; - $fields = array('uptime' => force_influx_data('f',$uptime)); - influx_update($device,$measurement,$tags,$fields); - rrdtool_update($uptime_rrd, 'N:'.$uptime); $graphs['uptime'] = true; diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index 2a0fec55c..afbd2f7ad 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -253,8 +253,6 @@ function rrdtool_update($filename, $options) { $options = implode(':', $values); } - - return rrdtool('update', $filename, $options); } @@ -303,48 +301,3 @@ function rrdtool_escape($string, $maxlength=null){ return $result.' '; } - -function influx_connect() { - global $config; - if ($config['influxdb']['transport'] == 'http') { - - $influx_url = $config['influxdb']['url'] . '/write?db=' . $config['influxdb']['db']; - - $ch = curl_init($influx_url); - - if (!empty($config['influxdb']['username']) && !empty($config['influxdb']['password'])) { - curl_setopt($ch, CURLOPT_USERPWD, $config['influxdb']['username'] . ":" . $config['influxdb']['password']); - curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); - } - curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE); - return($ch); - } -}// end influx_connect - -function influx_write($ch,$data) { - global $config; - if ($config['influxdb']['transport'] == 'http') { - curl_setopt($ch, CURLOPT_POSTFIELDS, $data); - return(curl_exec($ch)); - } -}// end influx_write - -function influx_update($device,$measurement,$tags=array(),$fields) { - $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=$v"; - } - - $tags = implode(',', $tmp_tags); - $fields = implode(',', $tmp_fields); - - $influx_conn = influx_connect(); - - $data = "$measurement,$tags $fields"; - $response = influx_write($influx_conn,$data); - d_echo($response); -}// end influx_update