mirror of
https://github.com/librenms/librenms.git
synced 2024-09-22 10:58:42 +00:00
feature: Updated Nfsen integration support (#6003)
* add single pool based poller for php-fpm
* add the page for php-fpm
* add graph for php-fpm
* I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.
* use named OID as suggest by @laf
* document PHP-FPM monitoring
* link it in the index
* clean up the named oid
* add how to grab the script in question
* add f2b poller
* add f2b app page
* add f2b graph
* add fail2ban notes
* minor formatting cleanup
* ...more formatting cleanup
* rename it so it can be called via the app page
* Revert "rename it so it can be called via the app page"
This reverts commit 0bde88a038
.
* *rename it so it can be called via the apps page
*setup the apps page to call it
* renamed the graph
* now include fail2ban in the apps properly
* correct the wget command so it does not stomp on phpfpm-sp
* update the fail2ban poller for the newest fail2ban script and now build multiple RRDs
* update for now graphing firewalled and banned
* update fail2ban docs to match the newest snmpd extend method
* search automatically for jails and graph them
* graphs the currently banned for a fail2ban jail
* change the tital of the graph for the total banned to make it more descriptive
* Add a explanation of the two variables in the total graph.
* misc. white space cleans ups
* misc. white space cleanup
* minor white space cleanup
* correct descr lenght
* correct descr lenght
* Update fail2ban.inc.php
* Use rrd_name properly
* note the cache file bits
* make caching optional and note why
* Update to new RrdDefinition class
* And the use statement ;/
* Messed the second rrd_def
* correct two minor errors that did not seem to be causing issues
* don't use $vars as per pull #5994
* don't use $vars as per pull #5994
* fix jails graphs
* Remove loops and temp variables
* whitespace
* Change graph so we don't get fractions
* add the common nfsen channel include
* add nfsen channel flows graph
* add nfsen channel packet graph
* add nfsen channel traffic graph
* update nfsen for channel support
* the nfsen general page
* add the nfsen channel page
* update the docs on nfsen to be more clear about configuring it
* white space cleanup
* white space cleanup
* misc code cleanup
* now consistently uses all the same quotes
* minor code cleanups
* Update nfsen_channel_common.inc.php
* minor white space cleanup
This commit is contained in:
parent
46198b2caa
commit
41bf70dac9
@ -9,8 +9,9 @@ The following is the configuration that can be used:
|
||||
|
||||
```php
|
||||
$config['nfsen_enable'] = 1;
|
||||
$config['nfsen_split_char'] = "_";
|
||||
$config['nfsen_rrds'] = "/var/nfsen/profiles-stat/live/";
|
||||
$config['nfsen_split_char'] = '_';
|
||||
$config['nfsen_rrds'][] = '/var/nfsen/profiles-stat/live/';
|
||||
$config['nfsen_rrds'][] = '/var/nfsen/profiles-stat';
|
||||
$config['nfsen_suffix'] = "_yourdomain_com";
|
||||
```
|
||||
|
||||
@ -24,9 +25,25 @@ $config['nfsen_rrds'][] = '/var/nfsen/profiles-stat/sitea/';
|
||||
$config['nfsen_rrds'][] = '/var/nfsen/profiles-stat/siteb/';
|
||||
```
|
||||
|
||||
Although for most setups, it will look like below, with the profiles-stat/live directory being where it stores the general RRDs for data sources.
|
||||
|
||||
```php
|
||||
$config['nfsen_rrds'][] = '/var/nfsen/profiles-stat/live';
|
||||
```
|
||||
|
||||
`$config['nfsen_split_char']` This value tells us what to replace the full stops `.` in the devices hostname with.
|
||||
|
||||
`$config['nfsen_suffix']` This value will be removed from the domain name and can be useful if your rrd files are
|
||||
something like `host1.rrd` but your device hostname is `domain.host1.rrd`. You can then set $config['nfsen_suffix'] = 'domain';
|
||||
|
||||
If you wish to render info for configure channels for a device, you need add the various profile-stat directories your system uses, which for most systems will be as below.
|
||||
|
||||
```php
|
||||
$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 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.
|
||||
|
44
html/includes/graphs/device/nfsen_channel_common.inc.php
Normal file
44
html/includes/graphs/device/nfsen_channel_common.inc.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
$simple_rrd = true;
|
||||
|
||||
if (!is_array($config['nfsen_rrds'])) {
|
||||
$config['nfsen_rrds'] = array($config['nfsen_rrds']);
|
||||
}
|
||||
|
||||
foreach ($config['nfsen_rrds'] as $nfsenrrds) {
|
||||
$nfsenrrds = rtrim($nfsenrrds, '/') . '/';
|
||||
|
||||
if ($config['nfsen_split_char']) {
|
||||
$nfsenHostname=str_replace('.', $config['nfsen_split_char'], $device['hostname']);
|
||||
} else {
|
||||
$nfsenHostname=$device['hostname'];
|
||||
}
|
||||
$rrd_filename=$nfsenrrds.$nfsenHostname.'/'.$vars['channel'].'.rrd';
|
||||
|
||||
if (is_file($rrd_filename)) {
|
||||
$colours = 'blues';
|
||||
$nototal = 0;
|
||||
$units = '';
|
||||
$scale_min = '0';
|
||||
$unit_text = $dsdescr;
|
||||
|
||||
// set a multiplier which in turn will create a CDEF if this var is set
|
||||
if ($dsprefix == 'traffic_') {
|
||||
$multiplier = '8';
|
||||
}
|
||||
|
||||
$flowtypes = array('tcp', 'udp', 'icmp', 'other');
|
||||
$rrd_list = array();
|
||||
foreach ($flowtypes as $flowtype) {
|
||||
$rrd_list[] = array(
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => $flowtype,
|
||||
'ds' => $dsprefix.$flowtype
|
||||
);
|
||||
}
|
||||
d_echo($rrd_list);
|
||||
}
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_multi_simplex_seperated.inc.php';
|
5
html/includes/graphs/device/nfsen_channel_flows.inc.php
Normal file
5
html/includes/graphs/device/nfsen_channel_flows.inc.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$dsdescr = 'Flows/s ';
|
||||
$dsprefix = 'flows_';
|
||||
|
||||
require 'nfsen_channel_common.inc.php';
|
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
$dsdescr = 'Packets/s ';
|
||||
$dsprefix = 'packets_';
|
||||
|
||||
require 'nfsen_channel_common.inc.php';
|
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
$dsdescr = 'Byts/s ';
|
||||
$dsprefix = 'traffic_';
|
||||
|
||||
require 'nfsen_channel_common.inc.php';
|
@ -1,16 +1,50 @@
|
||||
<?php
|
||||
|
||||
$datas = array(
|
||||
'Flows' => 'nfsen_flows',
|
||||
'Packets' => 'nfsen_packets',
|
||||
'Traffic' => 'nfsen_traffic',
|
||||
);
|
||||
print_optionbar_start();
|
||||
|
||||
foreach ($datas as $name => $type) {
|
||||
$graph_title = $name;
|
||||
$graph_type = 'device_'.$type;
|
||||
$link_array = array(
|
||||
'page' => 'device',
|
||||
'device' => $device['device_id'],
|
||||
'tab' => 'nfsen',
|
||||
);
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
echo generate_link('General', $link_array, array('nfsen' => 'general'));
|
||||
|
||||
$printedChannel=false;
|
||||
$nfsenHostname=str_replace('.', $config['nfsen_split_char'], $device['hostname']);
|
||||
foreach ($config['nfsen_rrds'] as $nfsenDir) {
|
||||
$hostDir=$nfsenDir.'/'.$nfsenHostname.'/';
|
||||
if (is_dir($hostDir)) {
|
||||
$nfsenRRDchannelGlob=$hostDir.'*.rrd';
|
||||
foreach (glob($nfsenRRDchannelGlob) as $nfsenRRD) {
|
||||
$channel = str_replace(array($hostDir, '.rrd'), '', $nfsenRRD);
|
||||
|
||||
if (!$printedChannel) {
|
||||
echo '|Channels:';
|
||||
$printedChannel=true;
|
||||
} else {
|
||||
echo ',';
|
||||
}
|
||||
|
||||
if ($vars['channel'] == $channel) {
|
||||
$channelFilter=$hostDir.$channel.'-filter.txt';
|
||||
}
|
||||
|
||||
echo generate_link($channel, $link_array, array('nfsen' => 'channel', 'channel' => $channel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
if (!$vars['nfsen']) {
|
||||
$vars['nfsen'] = 'general';
|
||||
}
|
||||
|
||||
if (is_file('pages/device/nfsen/'.mres($vars['nfsen']).'.inc.php')) {
|
||||
include 'pages/device/nfsen/'.mres($vars['nfsen']).'.inc.php';
|
||||
} else {
|
||||
include 'pages/device/nfsen/general.inc.php';
|
||||
}
|
||||
|
||||
$pagetitle[] = 'Netflow';
|
||||
|
22
html/pages/device/nfsen/channel.inc.php
Normal file
22
html/pages/device/nfsen/channel.inc.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$datas = array(
|
||||
'Flows' => 'nfsen_channel_flows',
|
||||
'Packets' => 'nfsen_channel_packets',
|
||||
'Traffic' => 'nfsen_channel_traffic',
|
||||
);
|
||||
|
||||
if (isset($channelFilter)&&file_exists($channelFilter)) {
|
||||
$chanelFilterContents=file_get_contents($channelFilter);
|
||||
print_optionbar_start();
|
||||
print $vars['channel'].' Filter: '.$chanelFilterContents;
|
||||
print_optionbar_end();
|
||||
}
|
||||
|
||||
foreach ($datas as $name => $type) {
|
||||
$graph_title = $name;
|
||||
$graph_type = 'device_'.$type;
|
||||
$graph_array['channel']=$vars['channel'];
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
14
html/pages/device/nfsen/general.inc.php
Normal file
14
html/pages/device/nfsen/general.inc.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
$datas = array(
|
||||
'Flows' => 'nfsen_flows',
|
||||
'Packets' => 'nfsen_packets',
|
||||
'Traffic' => 'nfsen_traffic',
|
||||
);
|
||||
|
||||
foreach ($datas as $name => $type) {
|
||||
$graph_title = $name;
|
||||
$graph_type = 'device_'.$type;
|
||||
|
||||
include 'includes/print-device-graph.php';
|
||||
}
|
Loading…
Reference in New Issue
Block a user