mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: Added sdfsinfo application support (#6494)
* initial version * various fixes, docs updated * various style fixes * added missing copyright * docs correction * docs correction * new split char for bash script * docs correction * scrutinizer issue * newline meh * doc changes
This commit is contained in:
@@ -30,6 +30,7 @@ Different applications support a variety of ways collect data: by direct connect
|
||||
1. [PowerDNS Recursor](#powerdns-recursor) - Direct, Agent
|
||||
1. [Proxmox](#proxmox) - SNMP extend
|
||||
1. [Raspberry PI](#raspberry-pi) - SNMP extend
|
||||
1. [SDFS info](#sdfs-info) - SNMP extend
|
||||
1. [SMART](#smart) - SNMP extend
|
||||
1. [Squid](#squid) - SNMP proxy
|
||||
1. [TinyDNS/djbdns](#tinydns-aka-djbdns) - Agent
|
||||
@@ -715,3 +716,24 @@ extend ups-apcups /etc/snmp/ups-apcups.sh
|
||||
4. Restart snmpd on your host
|
||||
|
||||
5. On the device page in Librenms, edit your host and check the `UPS apcups` under the Applications tab.
|
||||
|
||||
|
||||
### SDFS info
|
||||
A small shell script that exportfs SDFS volume info.
|
||||
|
||||
###### 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/sdfsinfo -O /etc/snmp/sdfsinfo
|
||||
```
|
||||
|
||||
2. Make the script executable (chmod +x /etc/snmp/sdfsinfo)
|
||||
|
||||
3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add:
|
||||
```
|
||||
extend sdfsinfo /etc/snmp/sdfsinfo
|
||||
```
|
||||
|
||||
4. Restart snmpd on your host
|
||||
|
||||
5. On the device page in Librenms, edit your host and check the `SDFS info` under the Applications tab or wait for it to be auto-discovered.
|
@@ -115,6 +115,9 @@ function nicecase($item)
|
||||
case 'opengridscheduler':
|
||||
return 'Open Grid Scheduler';
|
||||
|
||||
case 'sdfsinfo':
|
||||
return 'SDFS info';
|
||||
|
||||
default:
|
||||
return ucfirst($item);
|
||||
}
|
||||
|
57
html/includes/graphs/application/sdfsinfo_blocks.inc.php
Normal file
57
html/includes/graphs/application/sdfsinfo_blocks.inc.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 crcro
|
||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||
*/
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$colours = 'mixed';
|
||||
$unit_text = 'Blocks';
|
||||
$unitlen = 6;
|
||||
$bigdescrlen = 25;
|
||||
$smalldescrlen = 25;
|
||||
$dostack = 0;
|
||||
$printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 33;
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', $app['app_type'], $app['app_id']));
|
||||
|
||||
$array = array(
|
||||
'dup_data' => array('descr' => 'Duplicate data wrote (GB)','colour' => '000000',),
|
||||
'blocks_unique' => array('descr' => 'Unique blocks (GB)','colour' => '2A7A12',),
|
||||
'blocks_compressed' => array('descr' => 'Compressed blocks (GB)','colour' => '74127A',),
|
||||
'cluster_copies' => array('descr' => 'Cluster copies','colour' => 'F44842',),
|
||||
);
|
||||
|
||||
$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_float.inc.php';
|
55
html/includes/graphs/application/sdfsinfo_rates.inc.php
Normal file
55
html/includes/graphs/application/sdfsinfo_rates.inc.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 crcro
|
||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||
*/
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$colours = 'mixed';
|
||||
$unit_text = 'Rates';
|
||||
$unitlen = 6;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 20;
|
||||
$dostack = 0;
|
||||
$printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 33;
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', $app['app_type'], $app['app_id']));
|
||||
$array = array(
|
||||
'dedup_rate' => array('descr' => 'Dedup rate (%)','colour' => '000000',),
|
||||
'actual_savings' => array('descr' => 'Savings (%)','colour' => '2A7A12',),
|
||||
'comp_rate' => array('descr' => 'Compression (%)','colour' => '74127A',),
|
||||
);
|
||||
|
||||
$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_float.inc.php';
|
56
html/includes/graphs/application/sdfsinfo_volume.inc.php
Normal file
56
html/includes/graphs/application/sdfsinfo_volume.inc.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 crcro
|
||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||
*/
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$colours = 'mixed';
|
||||
$unit_text = 'Volume';
|
||||
$unitlen = 6;
|
||||
$bigdescrlen = 25;
|
||||
$smalldescrlen = 25;
|
||||
$dostack = 0;
|
||||
$printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 33;
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', $app['app_type'], $app['app_id']));
|
||||
$array = array(
|
||||
'files' => array('descr' => 'Files','colour' => '000000',),
|
||||
'vol_capacity' => array('descr' => 'Capacity (GB)','colour' => '2A7A12',),
|
||||
'vol_logic_size' => array('descr' => 'Logic capacity (GB)','colour' => '74127A',),
|
||||
'vol_max_load' => array('descr' => 'Max load (%)','colour' => 'F44842',),
|
||||
);
|
||||
|
||||
$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_float.inc.php';
|
@@ -232,6 +232,12 @@ $graphs['smart'] = array(
|
||||
'id233',
|
||||
);
|
||||
|
||||
$graphs['sdfsinfo'] = array(
|
||||
'volume',
|
||||
'blocks',
|
||||
'rates',
|
||||
);
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
echo "<span style='font-weight: bold;'>Apps</span> » ";
|
||||
|
48
html/pages/device/apps/sdfsinfo.inc.php
Normal file
48
html/pages/device/apps/sdfsinfo.inc.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 crcro
|
||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
$graphs = array(
|
||||
'sdfsinfo_volume' => 'Volume stats',
|
||||
'sdfsinfo_blocks' => 'Block stats',
|
||||
'sdfsinfo_rates' => 'Volume rates',
|
||||
);
|
||||
|
||||
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>';
|
||||
}
|
69
includes/polling/applications/sdfsinfo.inc.php
Normal file
69
includes/polling/applications/sdfsinfo.inc.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 crcro
|
||||
* @author Cercel Valentin <crc@nuamchefazi.ro>
|
||||
*/
|
||||
|
||||
use LibreNMS\RRD\RrdDefinition;
|
||||
|
||||
$name = 'sdfsinfo';
|
||||
$app_id = $app['app_id'];
|
||||
$options = '-O qv';
|
||||
$oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.8.115.100.102.115.105.110.102.111';
|
||||
|
||||
d_echo($name);
|
||||
|
||||
$sdfsinfo = snmp_walk($device, $oid, $options);
|
||||
|
||||
if (is_string($sdfsinfo)) {
|
||||
update_application($app, $sdfsinfo);
|
||||
$rrd_name = array('app', $name, $app_id);
|
||||
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('files', 'GAUGE', 0)
|
||||
->addDataset('vol_capacity', 'GAUGE', 0)
|
||||
->addDataset('vol_logic_size', 'GAUGE', 0)
|
||||
->addDataset('vol_max_load', 'GAUGE', 0)
|
||||
->addDataset('dup_data', 'GAUGE', 0)
|
||||
->addDataset('blocks_unique', 'GAUGE', 0)
|
||||
->addDataset('blocks_compressed', 'GAUGE', 0)
|
||||
->addDataset('cluster_copies', 'GAUGE', 0)
|
||||
->addDataset('dedup_rate', 'GAUGE', 0)
|
||||
->addDataset('actual_savings', 'GAUGE', 0)
|
||||
->addDataset('comp_rate', 'GAUGE', 0);
|
||||
|
||||
list($files, $vol_capacity, $vol_logic_size, $vol_max_load, $dup_data, $blocks_unique, $blocks_compressed, $cluster_copies, $dedup_rate, $actual_savings, $comp_rate) = explode(" ", $sdfsinfo);
|
||||
|
||||
$fields = array(
|
||||
'files' => $files,
|
||||
'vol_capacity' => $vol_capacity,
|
||||
'vol_logic_size' => $vol_logic_size,
|
||||
'vol_max_load' => $vol_max_load,
|
||||
'dup_data' => $dup_data,
|
||||
'blocks_unique' => $blocks_unique,
|
||||
'blocks_compressed' => $blocks_compressed,
|
||||
'cluster_copies' => $cluster_copies,
|
||||
'dedup_rate' => $dedup_rate,
|
||||
'actual_savings' => $actual_savings,
|
||||
'comp_rate' => $comp_rate,
|
||||
);
|
||||
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
unset($sdfsinfo, $rrd_name, $rrd_def, $data, $fields, $tags);
|
||||
}
|
Reference in New Issue
Block a user