mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@@ -22,20 +22,12 @@ if (!empty($agent_data['munin'])) {
|
||||
echo "Created directory : $plugins_rrd_dir\n";
|
||||
}
|
||||
|
||||
$plugin = array();
|
||||
foreach ($agent_data['munin'] as $plugin_type => $plugin_data) {
|
||||
$plugin = array();
|
||||
// list($plugin_type, $instance) = explode("_", $plugin_type);
|
||||
// if (!empty($instance))
|
||||
// {
|
||||
// echo("\nPlugin: $plugin_type ($instance)");
|
||||
// $plugin_rrd = $plugins_rrd_dir . "/" . $plugin_type."_".$instance;
|
||||
// $plugin_uniq = $plugin_type."_".$instance;
|
||||
// } else {
|
||||
|
||||
echo "\nPlugin: $plugin_type";
|
||||
$plugin_rrd = $plugins_rrd_dir.'/'.$plugin_type;
|
||||
$plugin_uniq = $plugin_type.'_';
|
||||
// }
|
||||
$base_rrd_name = 'munin/'.$plugin_type;
|
||||
|
||||
d_echo("\n[$plugin_data]\n");
|
||||
|
||||
foreach (explode("\n", $plugin_data) as $line) {
|
||||
@@ -76,9 +68,6 @@ if (!empty($agent_data['munin'])) {
|
||||
$ds_list[$vu] = 1;
|
||||
}
|
||||
|
||||
unset($dbq);
|
||||
unset($v);
|
||||
|
||||
foreach ($plugin['values'] as $name => $data) {
|
||||
echo " $name";
|
||||
if (empty($data['type'])) {
|
||||
@@ -97,22 +86,18 @@ if (!empty($agent_data['munin'])) {
|
||||
$data['draw'] = 'LINE1.5';
|
||||
}
|
||||
|
||||
$cmd = '--step 300 DS:val:'.$data['type'].':600:U:U ';
|
||||
$cmd .= $config['rrd_rra'];
|
||||
$ds_uniq = $mplug_id.'_'.$name;
|
||||
$filename = $plugin_rrd.'_'.$name.'.rrd';
|
||||
if (!is_file($filename)) {
|
||||
rrdtool_create($filename, $cmd);
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
'val' => $data['value'],
|
||||
);
|
||||
|
||||
rrdtool_update($filename, $fields);
|
||||
|
||||
$tags = array('plugin' => $plugin_type);
|
||||
influx_update($device,'munin-plugins',$tags,$fields);
|
||||
$tags = array(
|
||||
'plugin' => $plugin_type,
|
||||
'rrd_def' => 'DS:val:' . $data['type'] . ':600:U:U',
|
||||
'rrd_name' => $base_rrd_name . '_' . $name
|
||||
);
|
||||
data_update($device,'munin-plugins',$tags,$fields);
|
||||
|
||||
if (empty($ds_list[$ds_uniq])) {
|
||||
$insert = array(
|
||||
|
Reference in New Issue
Block a user