Debugging snmp output when using LibreNMS

Librenms is my tool-of-choice for grabbing metrics from switches, servers, wireless access points, and anything else with an snmp interface.

In this post:

  • FreeBSD 14.0
  • LibrenMS 23.11.0,1 – updated to 23.11.0_1,1 within this post
  • net-snmp-5.9.1_4,1

After updating some hosts to FreeBSD 14, the zfs application/extension broke. It was quickly amended after a report was lodged.

However, after the fix, I still wasn’t getting graphs. It was nan all across the board for ZFS:

all data is nan
No data found

Debugging the issue

To debug the issue, I wanted to see what LibreNMS was getting from the host.

From the hostpage, I clicked on the three vertical dots (found on the right hand side of the page) and clicked on Capture:

The capture menu
The capture menu

I clicked on Poller, then on Run. The box below those controls then filled with the output of that command.

Or so it should. Instead, I got:

"message": "Server Error: Set APP_DEBUG=true to see details."

I tried added that value to the .env file and to

config.php

– it was no help.

I searched for the message in the code and found it at app/Exceptions/Handler.php line 69

It took me a little while longer before I looked at /var/log/librenms/librenms.log and found:

syntax error, unexpected single-quoted string ", \LibreNMS\Config::get(", expecting "]" {"userId":1,"exception":"[object] (ParseError(code: 0): 
syntax error, unexpected single-quoted string \", \\LibreNMS\\Config::get(\", expecting \"]\" at 
/usr/local/www/librenms/includes/html/output/capture.inc.php:35)"} 

Oh. There’s some bad double quotes in there, caused by my patching. I fixed it locally, then updated the FreeBSD port later.

Then clicking on the Run button gave me some output:

Capture some output
Capture some output

I knew the run was finished when I saw this near the bottom of the output:

>>> Polled r730-03.int.unixathome.org (120) in 2.800 seconds <<<  

I clicked on Download and reviewed the output with my editor (joe).

I found some interesting stuff by searching for zfs:

Application: zfs, app_id=4978SNMP['/usr/local/bin/snmpget' '-v3' '-l' 'authPriv' '-n' "" '-a' 'SHA' '-A' 'PASSWORD' '-u' 'USER' '-x' 'AES' '-X' 'PASSWORD' '
env: perl: No such file or directory  

Ahh, the zfs application uses /usr/bin/env perl – this is good if perl is on your path, but it’s not.

My local fix, mentioned upstream, is to use #!/usr/local/bin/perl instead.

With that fix, now I’m getting graphs:

Graphs have content now - look at the right hand side of "ARC size in bytes"
Graphs have content now – look at the right hand side of “ARC size in bytes”

Next step: deploy the new zfs LibreNMS script to all hosts.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top