Also fix the graph generating code for NfSen rrds (#6835)

* Also fix the graph generating code for NfSen rrds

* Updated NfSen document as well
This commit is contained in:
Aldemir Akpinar
2017-06-14 22:32:30 +03:00
committed by Neil Lathwood
parent af47676ce7
commit 572277bfaa
2 changed files with 12 additions and 3 deletions

View File

@@ -42,8 +42,13 @@ If you wish to render info for configure channels for a device, you need add the
$config['nfsen_rrds'][] = '/var/nfsen/profiles-stat';
```
When adding sources to nfsen.conf, it is important to use the hostname that matches what is configured in LibreNMS.
When adding sources to nfsen.conf, it is important to use the hostname that matches what is configured in LibreNMS, because the rrd files NfSen creates is named after the source name (ident), and it doesn't allow you to use an IP address instead. However, in LibreNMS, if your device is added by an IP address, add your source with any name of your choice, and create a symbolic link to the rrd file.
```sh
cd /var/nfsen/profiles-stat/sitea/
ln -s mychannel.rrd librenmsdeviceIP.rrd
```
When creating profiles under nfsen, be sure to use the hostname so it matches the name in LibreNMS. That is where channel data will be pulled from.
You should a new tab for the device called Nfsen.
You should see a new tab for the device called Nfsen.

View File

@@ -17,7 +17,11 @@ foreach ($config['nfsen_rrds'] as $nfsenrrds) {
$nfsensuffix = $config['nfsen_suffix'];
}
$basefilename_underscored = preg_replace('/\./', $config['nfsen_split_char'], $device['hostname']);
if (isset($config['nfsen_split_char']) && !empty($config['nfsen_split_char'])) {
$basefilename_underscored = preg_replace('/\./', $config['nfsen_split_char'], $device['hostname']);
} else {
$basefilename_underscored = $device['hostname'];
}
$nfsen_filename = preg_replace('/'.$nfsensuffix.'/', '', $basefilename_underscored);
if (is_file($nfsenrrds.$nfsen_filename.'.rrd')) {