How to enable basic ping testing in LibreNMS

How to enable basic ping testing in LibreNMS

In a previous post I looked at how to install LibreNMS which is easily one of the most straightforward network monitoring tools around. It’s easy to use, works out of the box, and is really pretty to look at. In this post I’ll look at how to enable ping monitoring non-snmp devices.

Update: In a previous revision I stated that you could also enable alerting on services. Currently that doesn’t look like it is possible. I’d add that information back here if I can figure it out.

Whilst most devices now-a-days provide SNMP management there are still a tonne of devices which either don’t support SNMP or where you just don’t need to manage them. Those devices may still need monitoring though and a simple alert when a device goes offline is something that’s very straightforward to set up.

  1. LibreNMS has no inbuilt ping support, it only supports SNMP enabled devices, so we’re going to make use of the Nagios Plugin set to provide additional monitoring. SSH on to your LibreNMS server and lets install the plugins.
    sudo apt-get install nagios-plugins
  2. Once they are installed, you’ll need to enable support for the plugins in LibreNMS.
    sudo emacs /opt/librenms/config.php
  3. Add the following lines to the bottom of your LibreNMS config.php file and save.
    $config['show_services'] = 1;
    $config['nagios_plugins'] = "/usr/lib/nagios/plugins";
  4. Now you just need to ensure that the ICMP nagios check file is enabled for execution by LibreNMS. The command and output should look like this. You need to be able to see the x in the permission string at the start of the line.
    ls /usr/lib/nagios/plugins/check_icmp -l
    -rwsr-xr-x 1 root root 59440 Mar 12 2014 check_icmp
  5. Finally, you need to make sure that the services checks are run. Edit the /etc/cron.d/librenms file and make sure the following line is at the bottom before saving.
    */5 * * * * librenms /opt/librenms/check-services.php >> /dev/null 2>&1
  6. Pop over to your LibreNMS web portal and hit Refresh. You should see a services menu appear. This is where you will manage all the non-snmp checks.
    LibreNMS Services
  7. Click Add Service to add a new service check.
  8. The Device is the IP of the machine that *does* the check. In our case use your LibreNMS IP address. Set the type to ICMP and enter the IP address to be pinged in the IP Address box. Click Add Service. Note: You *MUST* enter a description otherwise managing multiple alerts becomes an absolute nightmare.
  9. Click on Services > All Services to see your list of services. You should now see your new ping test there.
    LibreNMS Services

Author

Oliver Marshall
Oliver works as a Director at Oakson who provide absolutely awesome IT support in Brighton, UK. Out of hours he's a runner with a limp, has a board game addiction and a owns a dog that looks like a badger.
  • Karel Vychodsky

    Thanks for useful article, I was missing this function in LibreNMS.. As I’m a beginner, I have a question:
    On last screenshot you have service ICMP, not PING. When I select ICMP, it doesn’t refresh. When I select PING, I get an error “was not set check_ping: Could not parse arguments
    Usage:
    check_ping -H -w ,% -c ,%
    [-p packets] [-t timeout] [-4 .. “.

    Any hint or explanation?

    Thanks.

    • Hi Carl

      It’s definitely ICMP that you want to choose. I’ve attached a copy of my service overview screen.

      Did you do step 4 and type in the following?

      ls /usr/lib/nagios/plugins/check_icmp -l

      You should see some small x’s next to the check_icmp entry which show that it’s executable. If you don’t see the X’s then type …

      sudo chmod ugo+x /usr/lib/nagios/plugins/check_icmp

      Give that a go and see if it works.

      • Karel Vychodsky

        Thanks for fast reply.

        First I have tried ‘ping’ service, as displayed on screenshot #2, but that doesn’t work, returns error. So according to your last scrshot I figured out I should try ICMP.

        file check_icmp is :
        -rwxr-xr-x 1 root root 59504 Dec 3 2014 check_icmp
        ..which should be OK (Debian 8).

        What troubles me is the static state of information (seems it did the ping once when I added the service and never since then).

        When setting up the service in device selection I choose localhost, IP Addr is the target device.

        Thanks,

        K.

        • Hi Karel

          It sounds like things are working now but perhaps step 5 hasn’t been done.

          Step 5 shows the line that should be pasted in to your /etc/cron.d/librenms file which triggers a script to run every 5 minutes.

          If you wait 5 mins or so and you aren’t seeing the Last Check column of your services update then perhaps something is wrong with your crontab setup for LibreNMS. That might be a bit beyond the kind of help I can give you here.

          • Karel Vychodsky

            OK, I’ll check the cron somehow, thanks for tip. I guess I’ll solve it somehow, thanks for help and for article once more.

            K.

          • One other thing to try is to set up an ICMP service check and point it at a machine you can get to. Wait 5 or so minutes for the check to show as successful and then turn off that machine. See if you get an alert.

            I’ve set up a test box here and I can see that the Last Check column doesn’t always reflect a change despite me getting an alert from the service check.

            They are working on an update to the service check handling at the moment to make it fit more nicely with the rest of LibreNMS and have some reporting and graphing. Hopefully it will get there soon.

          • Pépé

            1st of all thanks for this post, exactly what I was looking for.
            Although the graphs don’t seem to be created (the graph shows but doesnt display any data).

            I’ d like to allow the view of this graph to limited users, just like we can grant access to ports or devices..
            Do you have any idea to integrate this with authentication ?

          • Hi Pepe

            Thanks for reading the post 🙂

            The main thing to remember about the Ping/ICMP tests are that they aren’t actually handled by LibreNMS. It just calls a plugin which returns some stuff. At the moment that return isn’t graphed by LibreNMS, they are working on it though. You just get the text based ping response time

            The user question is a great one. I’ll knock together a post about that today. However in general you create a new user in the Settings (cog) menu. Make him a normal user. Then edit their permissions and assign that user the ports you want them to access. They will see only those ports and their graphs.

            Olly

          • Pépé

            Unfortunately, if we edit permissions, can only choose between devices or interfaces. The Ping graph (or service) doesn’t appear as a choice.

          • Hi Pepe

            No, at the moment service checks aren’t supported very well. They are only a text based list of outputs from the plugins. Any user you create will have access to the Services menu and thus to the Ping/ICMP responses.

            So, you can just create a new user, assign them the Normal type, and they won’t see any devices but they can see the services output.

            LibreNMS are working to make Services work much more like an SNMP based device.

            Olly

          • Karel Vychodsky

            Hi, just wanted to say it got better. I have changed cron to check every minute and restarted the service, that’s it. After few days I have checked and the Last Check collumn is working as supposed. Thanks for everything ;).

      • Refalm

        How can I add a device without LibreNMS checking for SNMP? I have several that don’t have SNMP, and I just want to do a ping check.

        • Hi Refalm

          These instructions should get you going for now. At the moment LibreNMS doesn’t have any inbuilt support for non-snmp devices. A device has to be checked for SNMP before it’s added.

          It gets around this by using Nagios Plugins which support a range of checks against a range of devices, some of which are supported by LibreNMS.

          It does mean that you have to install these plugins by hand and do a small amount of manual tweaking, though if you’ve managed to install LibreNMS on a Linux box then the above instructions should be fairly straightforward.

          Moving forward LibreNMS are working on better integration with the Nagios Plugins so that you can more easily add ping checks and see graphs of results and the like.

          Olly

Show Buttons
Hide Buttons

Stay in touch

or
Subscribe to my weekly newsletter

If you enjoyed this article then why not like my page.

Stay in touch

or
Subscribe to my weekly newsletter

If you are enjoying this article then why not like my page.