diff --git a/doc/Extensions/Smokeping.md b/doc/Extensions/Smokeping.md new file mode 100644 index 000000000..902b14f2a --- /dev/null +++ b/doc/Extensions/Smokeping.md @@ -0,0 +1,45 @@ +# Smokeping integration + +We currently have two ways to use Smokeping with LibreNMS, the first is using the included script generator to generate the config for Smokeping. The +second is to utilise an existing Smokeping setup. + +### Included Smokeping script + +To use this, please add something similar to your smokeping config file: + +```bash +@include /opt/smokeping/etc/librenms.conf +``` + +Then you need to generate the config file (maybe even add a cron to schedule this in and reload smokeping). We've assumed a few locations for smokeping, the config file you want +to call it and where LibreNMS is: + +```bash +cd /opt/librenms/scripts/ +php ./gen_smokeping.php > /opt/smokeping/etc/librenms.conf +/opt/smokeping/bin/smokeping --reload +``` + +Sample cron: + +```bash +15 0 * * * root cd /opt/librenms/scripts && php ./gen_smokeping.php > /opt/smokeping/etc/librenms.conf && /opt/smokeping/bin/smokeping --reload >> /dev/null 2>&1 +``` + +Now configure LibreNMS (make sure you point dir to your smokeping data directory: + +```php +$config['smokeping']['dir'] = '/opt/smokeping/data'; +$config['smokeping']['integration'] = true; +``` + +### Standard Smokeping + +This is quite simple, just point your dir at the smokeping data directory - please be aware that all RRD files need to be within this dir and NOT sub dirs: + +```php +$config['smokeping']['dir'] = '/opt/smokeping/data'; +$config['own_hostname'] +``` + +You should now see a new tab in your device page called ping. diff --git a/html/includes/graphs/device/smokeping_all_common.inc.php b/html/includes/graphs/device/smokeping_all_common.inc.php index 962ac8f51..a9e7b86b7 100644 --- a/html/includes/graphs/device/smokeping_all_common.inc.php +++ b/html/includes/graphs/device/smokeping_all_common.inc.php @@ -38,7 +38,7 @@ foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filena $descr = rrdtool_escape($source, $descr_len); - $filename = $config['smokeping']['dir'].$filename; + $filename = generate_smokeping_file($device,$filename); $rrd_options .= " DEF:median$i=".$filename.':median:AVERAGE '; $rrd_options .= " DEF:loss$i=".$filename.':loss:AVERAGE'; $rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*"; diff --git a/html/includes/graphs/device/smokeping_all_common_avg.inc.php b/html/includes/graphs/device/smokeping_all_common_avg.inc.php index c77d51021..97c5d40fb 100644 --- a/html/includes/graphs/device/smokeping_all_common_avg.inc.php +++ b/html/includes/graphs/device/smokeping_all_common_avg.inc.php @@ -39,7 +39,7 @@ foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filena $descr = rrdtool_escape($source, $descr_len); - $filename = $config['smokeping']['dir'].$filename; + $filename = generate_smokeping_file($device,$filename); $rrd_options .= " DEF:median$i=".$filename.':median:AVERAGE '; $rrd_options .= " CDEF:dm$i=median$i,UN,0,median$i,IF"; $rrd_options .= " DEF:loss$i=".$filename.':loss:AVERAGE'; diff --git a/html/includes/graphs/device/smokeping_common.inc.php b/html/includes/graphs/device/smokeping_common.inc.php index 006eb4197..ce9df8a4e 100644 --- a/html/includes/graphs/device/smokeping_common.inc.php +++ b/html/includes/graphs/device/smokeping_common.inc.php @@ -1,25 +1,3 @@ '; } - if (isset($config['smokeping']['dir'])) { - $smokeping_files = array(); - if ($handle = opendir($config['smokeping']['dir'])) { - while (false !== ($file = readdir($handle))) { - if ($file != '.' && $file != '..') { - if (eregi('.rrd', $file)) { - if (eregi('~', $file)) { - list($target,$slave) = explode('~', str_replace('.rrd', '', $file)); - $target = str_replace('_', '.', $target); - $smokeping_files['in'][$target][$slave] = $file; - $smokeping_files['out'][$slave][$target] = $file; - } - else { - $target = str_replace('.rrd', '', $file); - $target = str_replace('_', '.', $target); - $smokeping_files['in'][$target][$config['own_hostname']] = $file; - $smokeping_files['out'][$config['own_hostname']][$target] = $file; - } - } - } - } - }//end if - }//end if + $smokeping_files = get_smokeping_files($device); if (count($smokeping_files['in'][$device['hostname']]) || count($smokeping_files['out'][$device['hostname']])) { echo '