Recently, I upgraded my home server to run Ubuntu 15.04 from the previous 14.04 LTS version. The upgrade (via 14.10) was a breeze, aside from the pain in the arse of systemd and having to fix things like plexmediaserver which were no longer running – ugh.
One problem I did encounter was that none of my Perl-based nagios plugins were running anymore – giving me an ‘nrpe unable to read output’ from within the Opsview GUI. After running the plugins locally, we could see the following error:
root@server:/usr/local/nagios/libexec# ./check_SMART Segmentation fault (core dumped)
To investigate, I set the core file size to unlimited, ran the script again and then ran the core file through gdb as below:
root@server:/usr/local/nagios/libexec# ulimit -c unlimited root@server:/usr/local/nagios/libexec# ./check_SMART Segmentation fault (core dumped) root@server:/usr/local/nagios/libexec# which perl /usr/bin/perl root@server:/usr/local/nagios/libexec# gdb /usr/bin/perl ./core GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9 Copyright (C) 2015 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/bin/perl...(no debugging symbols found)...done. warning: core file may not match specified executable file. [New LWP 26194] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/usr/bin/perl ./check_SMART'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007fadcd2bea3e in boot_Params__Validate__XS () from /usr/local/nagios/perl/lib/x86_64-linux-gnu-thread-multi/auto/Params/Validate/XS/XS.so (gdb) bt #0 0x00007fadcd2bea3e in boot_Params__Validate__XS () from /usr/local/nagios/perl/lib/x86_64-linux-gnu-thread-multi/auto/Params/Validate/XS/XS.so #1 0x00007fadce77d34b in Perl_pp_entersub () from /usr/lib/x86_64-linux-gnu/libperl.so.5.20 #2 0x00007fadce775bb6 in Perl_runops_standard () from /usr/lib/x86_64-linux-gnu/libperl.so.5.20
Here we can see that the Params:Validate perl module is the culprit, presumably as its not compatible with the new 5.20 Perl version. To fix this, I simply removed the old Params:Validate module and installed a new one (5.20 version) via apt:
root@server:/usr/local/nagios/libexec# cd /usr/local/nagios/perl/lib/ root@server:/usr/local/nagios/perl/lib# cd x86_64-linux-gnu-thread-multi/auto/root@server:/usr/local/nagios/perl/lib/x86_64-linux-gnu-thread-multi/auto# rm -rf Params/ root@server:/usr/local/nagios/perl/lib/x86_64-linux-gnu-thread-multi/auto# apt-get install libparams-validate-perl Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: <snipped for brevity>
Now we can test the plugins, and voila – they work:
root@server:/usr/local/nagios/perl/lib/x86_64-linux-gnu-thread-multi/auto# cd /usr/local/nagios/libexec/ && ./check_SMART SMART WARNING - /dev/sdf /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde WARNING Airflow_Temperature_Cel Failed on: In_the_past /dev/sdg
Happy monitoring!