0% found this document useful (0 votes)
71 views

1301librenms Monitoring

1. Complete prerequisites by finishing Lab 7 and installing additional packages. 2. Configure LibreNMS on S1 by running validate.php, fixing errors, adding a user, and setting up SNMP and cron jobs. 3. Set up email alerting on S1 by installing SMTP and IMAP services, modifying exim4 configuration, and adding alert settings to config.php. Test email alerts.

Uploaded by

netgame76
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

1301librenms Monitoring

1. Complete prerequisites by finishing Lab 7 and installing additional packages. 2. Configure LibreNMS on S1 by running validate.php, fixing errors, adding a user, and setting up SNMP and cron jobs. 3. Set up email alerting on S1 by installing SMTP and IMAP services, modifying exim4 configuration, and adding alert settings to config.php. Test email alerts.

Uploaded by

netgame76
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

LAB 8 Monitoring with LibreNMS

Some materials that will help you doing the lab


LibreNMS official documentation: http://docs.librenms.org/

Prerequisites
To start with current lab Lab 7 must be completed.

INSTRUCTIONS
1. Verify that you have successfully completed Lab 7. You should see LibreNMS login when you
access S1 via web browser.
2. Before we can log in, some additional configuration is needed. This Ansible script did a lot of
manual work for you, but not all.
3. Log in to S1 (console) and cd to librenms directory (/opt/librenms)
Refer this documentation: http://docs.librenms.org/Support/Install%20Validation/
4. Run validate.php
php ./validate.php

5. Fix two errors that are reported as FAIL. Hints:


chown -R librenms:librenms /opt/librenms
chmod -R 0775 /opt/librenms/rrd/
usermod -a -G librenms www-data

You can ignore WARN messages.

6. We also need at least one user, to log on


php ./adduser.php student student 10 root@localhost

7. Next we need to set up information exchange via SNMP


Edit /etc/snmp/snmpd.conf
add line
rocommunity public udp:161
restart snmpd service

8. Set up librenms SNMP poller


cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
9. Set up email alerting.
Install SMTP and IMAP services
apt-get install exim4 dovecot-core dovecot-imapd

Modify /etc/exim4/exim4.conf.template Find section "routers"


after line
begin routers
add following
catchall:
driver = redirect
data = root@localhost

This is so called “catchall” router. Whatever email SMTP server catches it redirects this to root
mailbox.

Restart exim4 and dovecot.


Testing your setup

echo foo | mailx -s "test" [email protected]

With command “mail” you must see this email subject “test” and “foo” as body.

Refer this documentation:


http://docs.librenms.org/Extensions/Alerting/#transports-email
You need to add this configuration section to your Librenms config.php
Think a little bit. You do not have to re-type this file. (hint: wget).
Merge this config snippet to your config.php (NB! Do not overwrite. It may be good idea to do a
backup copy of your config.php)
Setting email_backend MAY need some additional tinkering. Other defaults are usually OK.
Restart apache to activate your settings.
LibreNMS
1. Now you are ready to log on to LibreNMS and add first host (itself).

Host name: localhost, Community public


Examine your host under devices. It may took some time until cron gets enough data to draw some
graphs. If you get „Graph Drawing Error” re-do validation process. Probably you’ve missed
something.
2. Alerts: Go to"Alert rules" "Enable global defalut alert rules"
Test your setup: on the right hand corner are the “settings” button
Go to global settings, alert settings and press test button behind
email alerting. If button goes green your email alerts are
configured correctly.
3. Create your own alert rule (Alerts, rules). Refer examples
http://docs.librenms.org/Extensions/Alerting/#rules-examples
Create your own global rule “disk full”. The rule creating dialog can be somewhat tricky. May be
this helps:

4. Now its time to test your monitoring.


On the console check free disk space
df -m

Note how many 1M blocks are available on root partition.


We want to generate a file big enough to trigger alert but not fill up our root partition completely.
On my S1 I have 1268 Megs free. 92% (we want to be on safe side) is approx 1166 Megs.
So, I generate a file like this (you, of course have to do your OWN calculations).
dd if=/dev/zero of=/bigfile bs=10M count=116

Let it run (it takes approximately a minute) and then check free disk space again. Now the df should
report that you have a LESS than 90% free on /
And final test. Reboot S1. After booting up and logging in check “mail”. You should see at least 3
alerts there (mail testing, machine reboot and message that disk has less than 90% free)
Remove /bigfile
Add second host (S2)
Refer this documentation: http://docs.librenms.org/Extensions/Auto-Discovery/
On S1 turn autodiscovery ON (follow instructions referred above)
On S2
Install SNMPD
apt-get update
apt-get install snmpd
Configure snmpd to accept connections from everywhere in community “public”
restart snmpd
Now, after minute or so S2 should appear under the “devices” on LibreNMS.
Reboot S2 and make sure you receive an alert.

You might also like