mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
more updates
This commit is contained in:
@@ -74,6 +74,11 @@ if (is_numeric($uptime)) {
|
||||
rrdtool_create($uptime_rrd, 'DS:uptime:GAUGE:600:0:U '.$config['rrd_rra']);
|
||||
}
|
||||
|
||||
$measurement = 'uptime';
|
||||
echo "BOOM " . sprintf("%.1f",$uptime) . " YAH\n";
|
||||
$fields = array('uptime' => $uptime);
|
||||
influx_update($device,$measurement,$tags,$fields);
|
||||
|
||||
rrdtool_update($uptime_rrd, 'N:'.$uptime);
|
||||
|
||||
$graphs['uptime'] = true;
|
||||
|
||||
@@ -305,8 +305,8 @@ function rrdtool_escape($string, $maxlength=null){
|
||||
}
|
||||
|
||||
function influx_update($device,$measurement,$tags=array(),$fields) {
|
||||
$tmp_tags = array();
|
||||
$tmp_fields = array();
|
||||
$tmp_tags[] = "host=".$device['hostname'];
|
||||
foreach ($tags as $k => $v) {
|
||||
$tmp_tags[] = "$k=$v";
|
||||
}
|
||||
@@ -320,7 +320,7 @@ function influx_update($device,$measurement,$tags=array(),$fields) {
|
||||
$influx_url = 'http://localhost:8086/write?db=librenms';
|
||||
|
||||
$ch = curl_init($influx_url);
|
||||
$post = "$measurement,host=".$device['hostname'].",$tags $fields";
|
||||
$post = "$measurement,$tags $fields";
|
||||
curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
||||
$response = curl_exec($ch);
|
||||
|
||||
Reference in New Issue
Block a user