mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
update branch
This commit is contained in:
@@ -144,6 +144,38 @@ graph.
|
||||
can follow the above process, then use the resultant data collected by
|
||||
LibreNMS in the RRD files or the database tables `device_oids`
|
||||
|
||||
## Configuration
|
||||
### Main Configuration
|
||||
In `/opt/librenms/config.php` add `$config['poller_modules']['mib'] = 1;`
|
||||
|
||||
### Discovery
|
||||
|
||||
You need to add your desired MIBs to `/opt/librenms/mibs` folder. Afterwards you need to register your MIBs to the discovery function.
|
||||
|
||||
#### Example
|
||||
`/opt/librenms/includes/discovery/os/f5.inc.php`
|
||||
|
||||
```
|
||||
<?php
|
||||
if (!$os || $os === 'linux') {
|
||||
$f5_sys_parent = '1.3.6.1.4.1.3375.2.1';
|
||||
if (strpos($sysObjectId, $f5_sys_parent)) {
|
||||
$os = 'f5';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
### MIB definition as an array
|
||||
$f5_mibs = array(
|
||||
"ltmVirtualServStatEntry" => "F5-BIGIP-LOCAL-MIB",
|
||||
);
|
||||
|
||||
### Actual registering of the MIB
|
||||
register_mibs($device, $f5_mibs, "includes/discovery/os/f5.inc.php");
|
||||
|
||||
```
|
||||
|
||||
The important thing is the array $f5_mibs where you define which parts (ltmVirtualServStatEntry) of the MIB (F5-BIGIP-LOCAL-MIB) you are going to add. The registering is also important, otherwise poller cannot make use of the MIB.
|
||||
|
||||
## TODO ##
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
Developing for LibreNMS has never been easier.
|
||||
|
||||
Thanks to [Wes Kennedy](https://twitter.com/livearchivist), there is
|
||||
now a vagrant file that will allow you to install a virtual machine
|
||||
that has LibreNMS already running on it!
|
||||
|
||||
To get started, you can just copy the script from `/contrib/dev_init`,
|
||||
or you can enter the following commands into your shell:
|
||||
|
||||
```
|
||||
mkdir -p dev/librenms && cd $_
|
||||
curl -O http://wkennedy.co/uploads/librenms/Vagrantfile
|
||||
curl -O http://wkennedy.co/uploads/librenms/bootstrap.sh
|
||||
chmod +x bootstrap.sh
|
||||
vagrant up
|
||||
```
|
||||
|
||||
This may take a few minutes and requires you to already have Vagrant
|
||||
installed. If you don't have Vagrant installed, it's easy to setup.
|
||||
See the [installation instructions here](http://docs.vagrantup.com/v2/installation/).
|
||||
@@ -406,6 +406,17 @@ Entries defined in `rewrite_if` are being replaced completely.
|
||||
Entries defined in `rewrite_if_regexp` only replace the match.
|
||||
Matches are compared case-insensitive.
|
||||
|
||||
#### Entity sensors to be ignored
|
||||
|
||||
Some devices register bogus sensors as they are returned via SNMP but either don't exist or just don't return data.
|
||||
This allows you to ignore those based on the descr field in the database. You can either ignore globally or on a per
|
||||
os basis.
|
||||
|
||||
```php
|
||||
$config['bad_entity_sensor_regex'][] = '/Physical id [0-9]+/';
|
||||
$config['os']['cisco']['bad_entity_sensor_regex'] = '/Physical id [0-9]+/';
|
||||
```
|
||||
|
||||
#### Storage configuration
|
||||
|
||||
```php
|
||||
|
||||
@@ -55,5 +55,5 @@ $response = array(
|
||||
'html' => $output,
|
||||
'title' => $title,
|
||||
);
|
||||
|
||||
header('Content-type: application/json');
|
||||
echo _json_encode($response);
|
||||
|
||||
@@ -29,6 +29,7 @@ if (!$_SESSION['authenticated']) {
|
||||
|
||||
if (preg_match('/^[a-zA-Z0-9\-]+$/', $_POST['type']) == 1) {
|
||||
if (file_exists('includes/forms/'.$_POST['type'].'.inc.php')) {
|
||||
header('Content-type: application/json');
|
||||
include_once 'includes/forms/'.$_POST['type'].'.inc.php';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ function levsort($base, $obj) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
header('Content-type: application/json');
|
||||
$obj = array(array('name' => 'Error: No suggestions found.'));
|
||||
$term = array();
|
||||
$current = false;
|
||||
|
||||
@@ -19,7 +19,7 @@ $bgp = array();
|
||||
|
||||
if (isset($_REQUEST['search'])) {
|
||||
$search = mres($_REQUEST['search']);
|
||||
|
||||
header('Content-type: application/json');
|
||||
if (strlen($search) > 0) {
|
||||
$found = 0;
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ $response = array();
|
||||
|
||||
if (isset($id)) {
|
||||
if (file_exists("includes/table/$id.inc.php")) {
|
||||
header('Content-type: application/json');
|
||||
include_once "includes/table/$id.inc.php";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ foreach ($graphs as $key => $text) {
|
||||
|
||||
if ($key == "ceph_poolstats") {
|
||||
foreach (glob($rrddir."/app-ceph-".$app['app_id']."-pool-*") as $rrd_filename) {
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
if (preg_match("/.*-pool-(.+)\.rrd$/", $rrd_filename, $pools)) {
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$pool = $pools[1];
|
||||
echo '<h3>'.$pool.' Reads/Writes</h3>';
|
||||
$graph_array['type'] = 'application_ceph_pool_io';
|
||||
@@ -29,6 +29,8 @@ foreach ($graphs as $key => $text) {
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
echo '</td></tr>';
|
||||
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
echo '<h3>'.$pool.' IOPS</h3>';
|
||||
$graph_array['type'] = 'application_ceph_pool_iops';
|
||||
$graph_array['pool'] = $pool;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
$no_refresh = true;
|
||||
|
||||
// FIXME - do this in a function and/or do it in graph-realtime.php
|
||||
if (!isset($vars['interval'])) {
|
||||
if ($device['os'] == 'linux') {
|
||||
|
||||
@@ -200,10 +200,21 @@ foreach (dbFetchRows('SELECT * FROM `bgpPeers` WHERE `device_id` = ? ORDER BY `b
|
||||
$peer['bgpPeerIdentifier'] = Net_IPv6::compress($peer['bgpPeerIdentifier']);
|
||||
}
|
||||
|
||||
// display overlib graphs
|
||||
$graph_array = array();
|
||||
$graph_array['type'] = 'bgp_updates';
|
||||
$graph_array['id'] = $peer['bgpPeer_id'];
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['from'] = $config['time']['day'];
|
||||
$graph_array['height'] = '110';
|
||||
$graph_array['width'] = $width;
|
||||
|
||||
$graph_type = 'bgp_updates';
|
||||
$peer_daily_url = 'graph.php?id='.$peer['bgpPeer_id'].'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=500&height=150';
|
||||
$peeraddresslink = "<span class=list-large><a onmouseover=\"return overlib('<img src=\'$peer_daily_url\'>', LEFT".$config['overlib_defaults'].');" onmouseout="return nd();">'.$peer['bgpPeerIdentifier'].'</a></span>';
|
||||
// Peer Address
|
||||
$graph_array_zoom = $graph_array;
|
||||
$graph_array_zoom['height'] = '150';
|
||||
$graph_array_zoom['width'] = '500';
|
||||
$overlib_link = "device/device=".$peer['device_id']."/tab=routing/proto=bgp/";
|
||||
$peeraddresslink = "<span class=list-large>".overlib_link(NULL, $peer['bgpPeerIdentifier'], generate_graph_tag($graph_array_zoom), NULL)."</span>";
|
||||
|
||||
echo '<tr bgcolor="'.$bg_colour.'"'.($peer['alert'] ? ' bordercolor="#cc0000"' : '').($peer['disabled'] ? ' bordercolor="#cccccc"' : '').'>
|
||||
';
|
||||
|
||||
@@ -256,20 +256,12 @@ else {
|
||||
unset($peername);
|
||||
}
|
||||
|
||||
// display overlib graphs
|
||||
$graph_type = 'bgp_updates';
|
||||
$local_daily_url = 'graph.php?id='.$peer['bgpPeer_id'].'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=500&height=150&&afi=ipv4&safi=unicast';
|
||||
if (filter_var($peer['bgpLocalAddr'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false) {
|
||||
$peer_ip = Net_IPv6::compress($peer['bgpLocalAddr']);
|
||||
}
|
||||
else {
|
||||
$peer_ip = $peer['bgpLocalAddr'];
|
||||
}
|
||||
|
||||
$localaddresslink = "<span class=list-large><a href='device/device=".$peer['device_id']."/tab=routing/proto=bgp/' onmouseover=\"return overlib('<div style=\'background-color: #ffffff;\'><img src=\'$local_daily_url\'></div>', LEFT".$config['overlib_defaults'].');" onmouseout="return nd();">'.$peer_ip.'</a></span>';
|
||||
|
||||
$graph_type = 'bgp_updates';
|
||||
$peer_daily_url = 'graph.php?id='.$peer['bgpPeer_id'].'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=500&height=150';
|
||||
if (filter_var($peer['bgpPeerIdentifier'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false) {
|
||||
$peer_ident = Net_IPv6::compress($peer['bgpPeerIdentifier']);
|
||||
}
|
||||
@@ -277,7 +269,29 @@ else {
|
||||
$peer_ident = $peer['bgpPeerIdentifier'];
|
||||
}
|
||||
|
||||
$peeraddresslink = "<span class=list-large><a href='device/device=".$peer['device_id']."/tab=routing/proto=bgp/' onmouseover=\"return overlib('<div style=\'background-color: #ffffff;\'><img src=\'$peer_daily_url\'></div>', LEFT".$config['overlib_defaults'].');" onmouseout="return nd();">'.$peer_ident.'</a></span>';
|
||||
// display overlib graphs
|
||||
$graph_array = array();
|
||||
$graph_array['type'] = 'bgp_updates';
|
||||
$graph_array['id'] = $peer['bgpPeer_id'];
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['from'] = $config['time']['day'];
|
||||
$graph_array['height'] = '110';
|
||||
$graph_array['width'] = $width;
|
||||
|
||||
// Peer Address
|
||||
$graph_array_zoom = $graph_array;
|
||||
$graph_array_zoom['height'] = '150';
|
||||
$graph_array_zoom['width'] = '500';
|
||||
$overlib_link = "device/device=".$peer['device_id']."/tab=routing/proto=bgp/";
|
||||
$peeraddresslink = "<span class=list-large>".overlib_link($overlib_link, $peer_ident, generate_graph_tag($graph_array_zoom), NULL)."</span>";
|
||||
|
||||
// Local Address
|
||||
$graph_array['afi'] = 'ipv4';
|
||||
$graph_array['safi'] = 'unicast';
|
||||
$graph_array_zoom['afi'] = 'ipv4';
|
||||
$graph_array_zoom['safi'] = 'unicast';
|
||||
$overlib_link = "device/device=".$peer['device_id']."/tab=routing/proto=bgp/";
|
||||
$localaddresslink = "<span class=list-large>".overlib_link($overlib_link, $peer_ip, generate_graph_tag($graph_array_zoom), NULL)."</span>";
|
||||
|
||||
echo '<tr class="bgp"'.($peer['alert'] ? ' bordercolor="#cc0000"' : '').($peer['disabled'] ? ' bordercolor="#cccccc"' : '').'>';
|
||||
|
||||
|
||||
@@ -324,7 +324,8 @@ function device_by_id_cache($device_id, $refresh = '0') {
|
||||
$device['vrf_lite_cisco'][$vrf['context_name']] = $vrf;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$device['ip'] = inet6_ntop($device['ip']);
|
||||
$cache['devices']['id'][$device_id] = $device;
|
||||
}
|
||||
return $device;
|
||||
|
||||
@@ -684,4 +684,33 @@ function discover_process_ipv6(&$valid, $ifIndex, $ipv6_address, $ipv6_prefixlen
|
||||
}//end if
|
||||
}
|
||||
|
||||
//end discover_process_ipv6()
|
||||
}//end discover_process_ipv6()
|
||||
|
||||
/*
|
||||
* Check entity sensors to be excluded
|
||||
*
|
||||
* @param string value to check
|
||||
* @param array device
|
||||
*
|
||||
* @return bool true if sensor is valid
|
||||
* false if sensor is invalid
|
||||
*/
|
||||
function check_entity_sensor($string, $device) {
|
||||
global $config;
|
||||
$valid = true;
|
||||
$string = strtolower($string);
|
||||
if (is_array($config['bad_entity_sensor_regex'])) {
|
||||
$fringe = $config['bad_entity_sensor_regex'];
|
||||
if (is_array($config['os'][$device['os']]['bad_entity_sensor_regex'])) {
|
||||
$fringe = array_merge($config['bad_entity_sensor_regex'],$config['os'][$device['os']]['bad_entity_sensor_regex']);
|
||||
}
|
||||
foreach ($fringe as $bad) {
|
||||
if (preg_match($bad . "i", $string)) {
|
||||
$valid = false;
|
||||
d_echo("Ignored entity sensor: $bad : $string");
|
||||
}
|
||||
}
|
||||
}
|
||||
return $valid;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ if (is_array($oids)) {
|
||||
$descr = rewrite_entity_descr($descr);
|
||||
}
|
||||
|
||||
$thisisnotbullshit = true;
|
||||
$valid = check_entity_sensor($descr, $device);
|
||||
|
||||
$type = $entitysensor[$entry['entPhySensorType']];
|
||||
|
||||
@@ -103,16 +103,16 @@ if (is_array($oids)) {
|
||||
|
||||
if ($type == 'temperature') {
|
||||
if ($current > '200') {
|
||||
$thisisnotbullshit = false;
|
||||
$valid = false;
|
||||
} $descr = preg_replace('/[T|t]emperature[|s]/', '', $descr);
|
||||
}
|
||||
|
||||
// echo($descr . "|" . $index . "|" .$current . "|" . $multiplier . "|" . $divisor ."|" . $entry['entPhySensorScale'] . "|" . $entry['entPhySensorPrecision'] . "\n");
|
||||
if ($current == '-127') {
|
||||
$thisisnotbullshit = false;
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
if ($thisisnotbullshit && dbFetchCell("SELECT COUNT(*) FROM `sensors` WHERE device_id = ? AND `sensor_class` = ? AND `sensor_type` = 'cisco-entity-sensor' AND `sensor_index` = ?", array($device['device_id'], $type, $index)) == '0') {
|
||||
if ($valid && dbFetchCell("SELECT COUNT(*) FROM `sensors` WHERE device_id = ? AND `sensor_class` = ? AND `sensor_type` = 'cisco-entity-sensor' AND `sensor_index` = ?", array($device['device_id'], $type, $index)) == '0') {
|
||||
// Check to make sure we've not already seen this sensor via cisco's entity sensor mib
|
||||
discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'entity-sensor', $descr, $divisor, $multiplier, null, null, null, null, $current);
|
||||
}
|
||||
|
||||
@@ -782,8 +782,8 @@ function snmp_gen_auth(&$device) {
|
||||
}
|
||||
}
|
||||
else if ($device['snmpver'] === 'v2c' or $device['snmpver'] === 'v1') {
|
||||
$cmd = ' -'.$device['snmpver'];
|
||||
$cmd .= ' -c '.$device['community'];
|
||||
$cmd = " -".$device['snmpver'];
|
||||
$cmd .= " -c '".$device['community']."'";
|
||||
}
|
||||
else {
|
||||
if ($debug) {
|
||||
|
||||
Reference in New Issue
Block a user