Merge remote-tracking branch 'upstream/master' into rrd-create-remote

This commit is contained in:
Tony Murray
2016-08-07 08:22:32 -05:00
68 changed files with 941 additions and 506 deletions

View File

@@ -10,6 +10,10 @@ Different applications support a variety of ways collect data: by direct connect
4. [PowerDNS](#powerdns) - Agent
5. [PowerDNS Recursor](#powerdns-recursor) - Agent
6. [TinyDNS/djbdns](#tinydns-aka-djbdns) - Agent
7. [OS Updates](#os-updates) - extend SNMP
8. [DHCP Stats](#dhcp-stats) - extend SNMP
9. [Memcached](#memcached) - extend SNMP
* [Agent Setup](#agent-setup)
@@ -47,6 +51,8 @@ Note: if you change the path you will need to change the path in `scripts/agent-
##### Agent
[Install the agent](#agent-setup) on this device if it isn't already and copy the `mysql` script to `/usr/lib/check_mk_agent/local/`
The MySQL script requires PHP-CLI and the PHP MySQL extension, so please verify those are installed.
Unlike most other scripts, the MySQL script requires a configuration file `/usr/lib/check_mk_agent/local/mysql.cnf` with following content:
```php
@@ -57,6 +63,8 @@ $mysql_host = 'localhost';
$mysql_port = 3306;
```
Verify it is working by running `/usr/lib/check_mk_agent/local/mysql`
### NGINX
NGINX is a free, open-source, high-performance HTTP server: https://www.nginx.org/
@@ -88,7 +96,11 @@ A recursive DNS server: https://www.powerdns.com/recursor.html
##### Direct
The LibreNMS polling host must be able to connect to port 8082 on the monitored device.
The web-server must be enabled, see the Recursor docs: https://doc.powerdns.com/md/recursor/settings/#webserver
There is currently no way to specify a custom port or password.
###### Variables
`$config['apps']['powerdns-recursor']['api-key']` required, this is defined in the Recursor config
`$config['apps']['powerdns-recursor']['port']` numeric, defines the port to connect to PowerDNS Recursor on. The default is 8082
`$config['apps']['powerdns-recursor']['https']` true or false, defaults to use http.
##### Agent
[Install the agent](#agent-setup) on this device if it isn't already and copy the `powerdns-recursor` script to `/usr/lib/check_mk_agent/local/`
@@ -117,6 +129,44 @@ chown dnslog:nofiles /service/dns/log/main/tinystats
3. Restart TinyDNS and Daemontools: `/etc/init.d/svscan restart`
_Note_: Some say `svc -t /service/dns` is enough, on my install (Gentoo) it doesn't rehook the logging and I'm forced to restart it entirely.
### OS Updates
A small shell script that checks your system package manager for any available updates (supports yum/apt-get/zypper package managers).
##### Extend SNMP
1. Copy the shell script to the desired host (the host must be added to LibreNMS devices)
2. Make the script executable (chmod +x /opt/os-updates.sh)
3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add:
```
extend osupdate /opt/os-updates.sh
```
4. Restart snmpd on your host
5. On the device page in Librenms, edit your host and check the `OS Updates` under the Applications tab.
_Note_: apt-get depends on an updated package index. There are several ways to have your system run `apt-get update` automatically. The easiest is to create `/etc/apt/apt.conf.d/10periodic` and pasting the following in it: `APT::Periodic::Update-Package-Lists "1";`.
If you have apticron, cron-apt or apt-listchanges installed and configured, chances are that packages are already updated periodically.
### DHCP Stats
A small shell script that reports current DHCP leases stats.
##### Extend SNMP
1. Copy the shell script to the desired host (the host must be added to LibreNMS devices)
2. Make the script executable (chmod +x /opt/dhcp-status.sh)
3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add:
```
extend dhcpstats /opt/dhcp-status.sh
```
4. Restart snmpd on your host
5. On the device page in Librenms, edit your host and check the `DHCP Stats` under the Applications tab.
### Memcached
1. Copy the [memcached script](https://github.com/librenms/librenms-agent/blob/master/agent-local/memcached) to `/usr/local/bin` (or any other suitable location) on your remote server.
2. Make the script executable: `chmod +x /usr/local/memcached`
3. Edit your snmpd.conf file (usually `/etc/snmp/snmpd.conf`) and add:
```
extend memcached /usr/local/bin/memcached
```
4. Restart snmpd on your host
5. On the device page in Librenms, edit your host and check `Memcached` under the Applications tab.
Agent Setup
-----------
@@ -165,8 +215,7 @@ mkdir -p /usr/lib/check_mk_agent/plugins /usr/lib/check_mk_agent/local
| xinetd | systemd |
| --- | --- |
| `/etc/init.d/xinetd restart` | `systemctl enable --now check_mk.socket` |
| `/etc/init.d/xinetd restart` | `systemctl enable check_mk.socket && systemctl start check_mk.socket` |
8. Login to the LibreNMS web interface and edit the device you want to monitor. Under the modules section, ensure that unix-agent is enabled.
9. Then under Applications, enable the apps that you plan to monitor.

View File

@@ -1,10 +1,57 @@
# Auto discovery support
### Getting started with auto discovery.
LibreNMS provides the ability to automatically add devices on your network, we can do this with via
a few methods which will be explained below and also indicate if they are enabled by default.
All discovery methods run when discovery.php runs (every 6 hours by default and within 5 minutes for new devices).
> Please note that you need at least ONE device added before auto-discovery will work.
The first thing to do though is add the required configuration options to `config.php`.
#### SNMP Details
To add devices automatically we need to know your snmp details, examples of SNMP v1, v2c and v3 are below:
```php
// v1 or v2c
$config['snmp']['community'][] = "my_custom_community";
$config['snmp']['community'][] = "another_community";
// v3
$config['snmp']['v3'][0]['authlevel'] = 'AuthPriv';
$config['snmp']['v3'][0]['authname'] = 'my_username';
$config['snmp']['v3'][0]['authpass'] = 'my_password';
$config['snmp']['v3'][0]['authalgo'] = 'MD5';
$config['snmp']['v3'][0]['cryptopass'] = 'my_crypto';
$config['snmp']['v3'][0]['cryptoalgo'] = 'AES';
```
These details will be attempted when adding devices, you can specify any mixture of these.
#### Your networks
To add devices, we need to know what are your subnets so we don't go blindly attempting to add devices not
under your control.
```php
$config['nets'][] = '192.168.0.0/24';
$config['nets'][] = '172.2.4.0/22';
```
#### Exclusions
If you have added a network as above but a single device exists within it that you can't auto
add, then you can exclude this with the following:
```php
$config['autodiscovery']['nets-exclude'][] = '192.168.0.1/32';
```
If you want to enable / disable certain auto-discovery modules then see the rest of this doc for further info.
### Discovery methods
#### ARP
@@ -31,23 +78,16 @@ Enabled by default.
This module is invoked from bgp-peers discovery module.
### Including / Excluding subnets to scan
#### SNMP Scan
This isn't actually an auto- mechanism but manually invoked.
By default the following config is in place to exclude loopback, multicast, etc ranges. You can expand this out by adding more
ranges to config.php
It's designed to scan through all of the subnets in your config or what you have manually specified
to automatically add devices. An example of it's usage is:
```php
$config['autodiscovery']['nets-exclude'][] = '0.0.0.0/8';
$config['autodiscovery']['nets-exclude'][] = '127.0.0.0/8';
$config['autodiscovery']['nets-exclude'][] = '169.254.0.0/16';
$config['autodiscovery']['nets-exclude'][] = '224.0.0.0/4';
$config['autodiscovery']['nets-exclude'][] = '240.0.0.0/4';
```bash
./snmp-scan.php r 192.168.0.0/24
```
You will need to specify your own subnets that you would like to scan for which can be done with:
`$config['nets'][] = '8.8.8.0/24';`
#### Discovering devices by IP
By default we don't add devices by IP address, we look for a reverse dns name to be found and add with that. If this fails

View File

@@ -114,12 +114,11 @@ Ancient versions of rsyslog may require different syntax.
This is an example for rsyslog 5 (default on Debian 7):
```bash
# Feed syslog messages to librenms
$ModLoad omprog
$template librenms,"%FROMHOST%||%syslogfacility%||%syslogpriority%||%syslogseverity%||%syslogtag%||%$YEAR%-%$MONTH%-%$DAY% %timereported:8:25%||%msg%||%programname%\n"
$ActionOMProgBinary /opt/librenms/syslog.php
# Feed syslog messages to librenms
$ModLoad omprog
$template librenms,"%FROMHOST%||%syslogfacility-text%||%syslogpriority-text%||%syslogseverity%||%syslogtag%||%$YEAR%-%$MONTH%-%$DAY% %timegenerated:8:25%||%msg%||%programname%\n"
$ActionOMProgBinary /opt/librenms/syslog.php
*.* :omprog:;librenms
```