Nagios monitoring of PFsense interfaces
-
I am trying to monitor pfsense gateways with a nagios server. I seem to have everything setup fine since these commands work
sudo /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_load
sudo /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_usersbut when I try
sudo /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_ifstatus -a Lan
I get "NRPE: Unable to read output"
I have added the check_ifstatus command into pfsense's NRPE settings. Any ideas?
Thanks in advance.
-
Was is the command? Does it run locally? Can you see what it's returning?
'Lan' there looks a bit suspicious. I expect that to be LAN or lan. Unless that's not the interface but some parameters.
Steve
-
@stephenw1You are correct, it should be LAN. it fails with that also. the command is check_ifstatus. I want to know when an interface goes down.
-
Ah, it;'s because:
[2.6.0-RELEASE][admin@cedev-6.stevew.lan]/usr/local/libexec/nagios: ./check_ifstatus Can't locate Net/SNMP.pm in @INC (you may need to install the Net::SNMP module) (@INC contains: /usr/local/libexec/nagios /usr/local/lib/perl5/site_perl/mach/5.32 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.32/mach /usr/local/lib/perl5/5.32) at ./check_ifstatus line 41. BEGIN failed--compilation aborted at ./check_ifstatus line 41.
Looking.....
-
@stephenw10 INstalled Net-SNMP and enabled in on pfsense and get the same error.
-
Yeah, you need that package to get the SNMP perl module. But it appears to be in the correct location. Or at least a location that is referenced by the INC file. It should find it....
-
No, it is looking in the wrong place.
Try:
ln /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm /usr/local/lib/perl5/5.32/Net/SNMP.pm
Then retest.
-
https://redmine.pfsense.org/issues/13509
-
Getting closer. It recognizes it but now gives these errors
Subroutine AUTOLOAD redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 53.
Subroutine register_debug_tokens redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 138.
Subroutine getenv redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 144.
Subroutine setenv redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 150.
Subroutine setMib redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 158.
Subroutine initMib redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 169.
Subroutine addMibDirs redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 186.
Subroutine addMibFiles redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 195.
Subroutine loadModules redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 205.
Subroutine unloadModules redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 216.
Subroutine translateObj redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 222.
Subroutine getType redefined at /usr/local/lib/perl5/site_perl/mach/5.32/SNMP.pm line 251.
Can't locate object method "session" via package "Net::SNMP" (perhaps you forgot to load "Net::SNMP"?) at /usr/local/libexec/nagios/check_ifstatus line 128. -
That's after adding the symlink?
-
@stephenw10
Yes -
Mmm, OK I replicated that. That clearly that is loaded though. Something in the perl config maybe. Someone more familiar with perl will need to look at it.