Remove nfs requirement for distributed poller (with rrdtool 1.5+)

Use data_update instead of rrd_update/rrd_create and influx_update
Centralize rrd file check so we can check against a remote rrdcached server too
Use rrd_name() to generate rrd file names
This commit is contained in:
Tony Murray
2016-07-07 01:33:43 -05:00
parent bc7e5ffb46
commit 57650e4ffc
344 changed files with 1920 additions and 2470 deletions

View File

@@ -25,23 +25,21 @@ if ($device['os_group'] == "cisco") {
$active += $value[''];
}
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename ("cisco-iosdsp.rrd");
if (!file_exists ($rrd_filename)) {
rrdtool_create ($rrd_filename, " DS:total:GAUGE:600:0:U DS:active:GAUGE:600:0:U" . $config['rrd_rra']);
}
$rrd_def = array(
'DS:total:GAUGE:600:0:U',
'DS:active:GAUGE:600:0:U'
);
$fields = array(
'total' => $total,
'active' => $active,
);
rrdtool_update ($rrd_filename, $fields);
$tags = array();
influx_update($device,'cisco-iosdsp',$tags,$fields);
$tags = compact('rrd_def');
data_update($device, 'cisco-iosdsp', $tags, $fields);
$graphs['cisco-iosdsp'] = TRUE;
echo (" Cisco IOS DSP ");
}
unset($rrd_filename, $total, $active);
unset($rrd_def, $total, $active, $tags, $fields);
}

View File

@@ -24,23 +24,21 @@ if ($device['os_group'] == "cisco") {
// Active
$active = $total - $available;
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename ("cisco-iosmtp.rrd");
if (!file_exists ($rrd_filename)) {
rrdtool_create ($rrd_filename, " DS:total:GAUGE:600:0:U DS:active:GAUGE:600:0:U" . $config['rrd_rra']);
}
$rrd_def = array(
'DS:total:GAUGE:600:0:U',
'DS:active:GAUGE:600:0:U'
);
$fields = array(
'total' => $total,
'active' => $active,
);
rrdtool_update ($rrd_filename, $fields);
$tags = array();
influx_update($device,'cisco-iosmtp',$tags,$fields);
$tags = compact('rrd_def');
data_update($device, 'cisco-iosmtp', $tags, $fields);
$graphs['cisco-iosmtp'] = TRUE;
echo (" Cisco IOS MTP ");
}
unset($rrd_filename, $total, $active, $available);
unset($rrd_def, $total, $active, $available, $fields, $tags);
}

View File

@@ -28,24 +28,21 @@ if ($device['os_group'] == "cisco") {
$active = $active['1.3.6.1.4.1.9.10.19.1.1.4.0'][''];
if (isset($active) && ($active != "") && ($total != 0)) {
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename ("cisco-iospri.rrd");
if (!file_exists ($rrd_filename)) {
rrdtool_create ($rrd_filename, " DS:total:GAUGE:600:0:U DS:active:GAUGE:600:0:U" . $config['rrd_rra']);
}
$rrd_def = array(
'DS:total:GAUGE:600:0:U',
'DS:active:GAUGE:600:0:U'
);
$fields = array(
'total' => $total,
'active' => $active,
);
rrdtool_update ($rrd_filename, $fields);
$tags = array();
influx_update($device,'cisco-iospri',$tags,$fields);
$tags = copmact('rrd_def');
data_update($device, 'cisco-iospri', $tags, $fields);
$graphs['cisco-iospri'] = TRUE;
echo (" Cisco IOS PRI ");
}
unset($rrd_filename, $total, $active);
unset($rrd_def, $total, $active, $fields, $tags);
}

View File

@@ -24,23 +24,21 @@ if ($device['os_group'] == "cisco") {
// Active
$active = $total - $available;
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename ("cisco-iosxcode.rrd");
if (!file_exists ($rrd_filename)) {
rrdtool_create ($rrd_filename, " DS:total:GAUGE:600:0:U DS:active:GAUGE:600:0:U" . $config['rrd_rra']);
}
$rrd_def = array(
'DS:total:GAUGE:600:0:U',
'DS:active:GAUGE:600:0:U'
);
$fields = array(
'total' => $total,
'active' => $active,
);
rrdtool_update ($rrd_filename, $fields);
$tags = array();
influx_update($device,'cisco-iosxcode',$tags,$fields);
$tags = compact('rrd_def');
dat_update($device, 'cisco-iosxcode', $tags, $fields);
$graphs['cisco-iosxcode'] = TRUE;
echo (" Cisco IOS Transcoder ");
}
unset($rrd_filename, $total, $active, $available);
unset($rrd_def, $total, $active, $available, $fields, $tags);
}