Wednesday, 31 January 2018

Nagios Plugins: Can’t locate utils.pm in @INC



In nagios plugins written in perl, you got the following error while trying to use a nagios.


Can't locate utils.pm in @INC contains: /usr/local/nagios/libexec /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/lib64/nagios/plugins/check_clamav line 33.

Just install the nagios-plugins-perl package to fix the issue if the package is not installed.

[root@ linuxcnf ~]# yum install nagios-plugins-perl

Then it will be there:

[root@ linuxcnf ~]# find / -name "utils.pm" -type f
/usr/lib64/nagios/plugins/utils.pm

And if the issue still persists, due to a wrong defined library in Perl script. So, the solution of this problem is quite easy. Just change the defined library path as below in script:

use lib "/usr/local/nagios/libexec" ;

To

use lib "/usr/lib/nagios/plugins" ;

Now, it should works.

9 comments:

  1. Hi, what is the installation command for Debian/Ubuntu?

    ReplyDelete
  2. where should the change below be made?

    use lib "/usr/local/nagios/libexec" ;

    To

    use lib "/usr/lib/nagios/plugins" ;

    ReplyDelete
    Replies
    1. Dentro do script, meu caso eu abri o script usando o vi e mudei:

      de: use lib "/usr/local/nagios/libexec" ;
      para: use lib "/usr/lib/nagios/plugins" ;

      Delete