mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: Added random entropy support for applications (#8555)
This commit is contained in:
committed by
Neil Lathwood
parent
09d6b2fd54
commit
65b8270936
@@ -9,6 +9,7 @@ Different applications support a variety of ways to collect data: by direct conn
|
||||
1. [BIND9/named](#bind9-aka-named) - SNMP extend, Agent
|
||||
1. [C.H.I.P.](#chip) - SNMP extend
|
||||
1. [DHCP Stats](#dhcp-stats) - SNMP extend
|
||||
1. [Entropy](#entropy) - SNMP extend
|
||||
1. [EXIM Stats](#exim-stats) - SNMP extend
|
||||
1. [Fail2ban](#fail2ban) - SNMP extend
|
||||
1. [FreeBSD NFS Client](#freebsd-nfs-client) - SNMP extend
|
||||
@@ -190,6 +191,25 @@ extend dhcpstats /etc/snmp/dhcp-status.sh
|
||||
4. Restart snmpd on your host
|
||||
|
||||
|
||||
### Entropy
|
||||
A small shell script that checks your system's available random entropy.
|
||||
|
||||
##### SNMP Extend
|
||||
1. Download the script onto the desired host (the host must be added to LibreNMS devices)
|
||||
```
|
||||
wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/entropy.sh -O /etc/snmp/entropy.sh
|
||||
```
|
||||
|
||||
2. Make the script executable (chmod +x /etc/snmp/entropy.sh)
|
||||
|
||||
3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add:
|
||||
```
|
||||
extend entropy /etc/snmp/entropy.sh
|
||||
```
|
||||
|
||||
4. Restart snmpd on your host
|
||||
|
||||
|
||||
### EXIM Stats
|
||||
SNMP extend script to get your exim stats data into your host.
|
||||
|
||||
|
@@ -60,6 +60,9 @@ function nicecase($item)
|
||||
case 'dbm':
|
||||
return 'dBm';
|
||||
|
||||
case 'entropy':
|
||||
return 'Random entropy';
|
||||
|
||||
case 'mysql':
|
||||
return ' MySQL';
|
||||
|
||||
|
35
html/includes/graphs/application/entropy_entropy.inc.php
Normal file
35
html/includes/graphs/application/entropy_entropy.inc.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require 'includes/graphs/common.inc.php';
|
||||
$name = 'entropy';
|
||||
$app_id = $app['app_id'];
|
||||
$scale_min = 0;
|
||||
$colours = 'mixed';
|
||||
$unit_text = 'Random entropy';
|
||||
$unitlen = 18;
|
||||
$bigdescrlen = 18;
|
||||
$smalldescrlen = 18;
|
||||
$dostack = 0;
|
||||
$printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 33;
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', $name, $app_id));
|
||||
|
||||
$array = array(
|
||||
'entropy' => array('descr' => 'entropy','colour' => '2B9220',),
|
||||
);
|
||||
|
||||
$i = 0;
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
foreach ($array as $ds => $var) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $var['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $var['colour'];
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/graphs/generic_v3_multiline.inc.php';
|
@@ -15,6 +15,10 @@ $graphs['drbd'] = array(
|
||||
'unsynced',
|
||||
);
|
||||
|
||||
$graphs['entropy'] = array(
|
||||
'entropy',
|
||||
);
|
||||
|
||||
$graphs['mysql'] = array(
|
||||
'network_traffic',
|
||||
'connections',
|
||||
|
27
html/pages/device/apps/entropy.inc.php
Normal file
27
html/pages/device/apps/entropy.inc.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
global $config;
|
||||
|
||||
$graphs = array(
|
||||
'entropy_entropy' => 'Random entropy',
|
||||
);
|
||||
|
||||
foreach ($graphs as $key => $text) {
|
||||
$graph_type = $key;
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$graph_array['type'] = 'application_'.$key;
|
||||
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.$text.'</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">';
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
19
includes/polling/applications/entropy.inc.php
Normal file
19
includes/polling/applications/entropy.inc.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
use LibreNMS\RRD\RrdDefinition;
|
||||
|
||||
$name = 'entropy';
|
||||
$app_id = $app['app_id'];
|
||||
$options = '-O qv';
|
||||
$mib = 'NET-SNMP-EXTEND-MIB';
|
||||
$oid = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.101.110.116.114.111.112.121.1';
|
||||
|
||||
$rrd_name = array('app', $name, $app_id);
|
||||
$rrd_def = RrdDefinition::make()->addDataset('entropy', 'GAUGE', 0);
|
||||
|
||||
$entropy_avail = snmp_get($device, $oid, $options, $mib);
|
||||
|
||||
$fields = array('entropy' => $entropy_avail,);
|
||||
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
update_application($app, $entropy_avail, $fields, $entropy_avail);
|
Reference in New Issue
Block a user