Putting things back to normal

This commit is contained in:
laf
2015-08-18 19:20:11 +00:00
parent 98de6faf6b
commit 6640a210ab
3 changed files with 0 additions and 70 deletions
-19
View File
@@ -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
-4
View File
@@ -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;
-47
View File
@@ -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