Basic commit

This commit is contained in:
Rosiak
2016-01-17 17:47:26 +01:00
parent e74a45cdcc
commit c91a7081cc
3 changed files with 28 additions and 1 deletions

View File

@@ -53,6 +53,14 @@ You will need to configure default credentials for your devices, LibreNMS doesn'
X-Auth-Token: '01582bf94c03104ecb7953dsadsadwed'
```
LibreNMS is able to reload the Oxidized list of nodes, each time a device is added to LibreNMS.
To do so, add the following to your config.php.
```php
$config['oxidized']['reload_nodes'] = TRUE;
```
### Using Groups
To return a group to Oxidized you can do this by matching a regex for either hostname or location. The order is hostname is matched first, if nothing is found then location is attempted.

View File

@@ -471,8 +471,9 @@ $config['rancid_ignorecomments'] = 0;
// $config['collectd_dir'] = '/var/lib/collectd/rrd';
// $config['smokeping']['dir'] = "/var/lib/smokeping/";
$config['smokeping']['pings'] = 20;
// $config['oxidized']['enabled'] = FALSE;//Set to TRUE
$config['oxidized']['enabled'] = FALSE;//Set to TRUE
// $config['oxidized']['url'] = 'http://127.0.0.1:8888';// Set the Oxidized rest URL
$config['oxidized']['reload_nodes'] = FALSE;//Set to TRUE, check documentation
// NFSen RRD dir.
$config['nfsen_enable'] = 0;
// $config['nfsen_split_char'] = "_";

View File

@@ -580,6 +580,7 @@ function createHost($host, $community = NULL, $snmpver, $port = 161, $transport
if (host_exists($host) === false) {
$device_id = dbInsert($device, 'devices');
if ($device_id) {
oxidized_reload_nodes();
return($device_id);
}
else {
@@ -1302,3 +1303,20 @@ function warn_innodb_buffer($innodb_buffer) {
$output .= 'Config proposal: "innodb_buffer_pool_size = '.pow(2,ceil(log(($innodb_buffer['used'] / 1024 / 1024),2))).'M"'.PHP_EOL;
return $output;
}
function oxidized_reload_nodes() {
global $config;
if ($config['oxidized']['enabled'] === TRUE && $config['oxidized']['reload_nodes'] === TRUE && isset($config['oxidized']['url'])) {
$oxidized_reload_url = $config['oxidized']['url'] . '/reload';
$ch = curl_init($oxidized_reload_url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_exec($ch);
curl_close($ch);
}
}