I'm trying to install the munin-mysql plugin but I'm facing a strange error. Munin complains that it cannot find DBI.pm
in the @INC:
[root@mybox perl5]# munin-run mysql
Can't locate DBI.pm in @INC (@INC contains: /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 /etc/munin/plugins/mysql line 127.
BEGIN failed--compilation aborted at /etc/munin/plugins/mysql line 127.
However, it is indeed in the path, and precisely at /usr/local/lib64/perl5
. It was installed via the command cpanm DBI
.
In fact, there are several DBI.pm
files; how do I know which one is to be used?
[root@mybox perl5]# find / -name DBI.pm
/root/.cpan/build/DBI-1.634-Aazmvi/blib/lib/Bundle/DBI.pm
/root/.cpan/build/DBI-1.634-Aazmvi/blib/lib/DBI.pm
/root/.cpan/build/DBI-1.634-Aazmvi/lib/Bundle/DBI.pm
/root/.cpan/build/DBI-1.634-Aazmvi/DBI.pm
/root/.cpanm/work/1460983027.32244/DBI-1.634/blib/lib/Bundle/DBI.pm
/root/.cpanm/work/1460983027.32244/DBI-1.634/blib/lib/DBI.pm
/root/.cpanm/work/1460983027.32244/DBI-1.634/lib/Bundle/DBI.pm
/root/.cpanm/work/1460983027.32244/DBI-1.634/DBI.pm
/root/munin-mysql-master/t/mock/DBI.pm
/usr/local/lib64/perl5/Bundle/DBI.pm
/usr/local/lib64/perl5/DBI.pm
Related questions:
munin-run
switches users. The default user is nobody
. That user probably does not have permission to read the file.
The script must be run with sufficient privileges, usually as root, as it switches to either munin-node's default user (often "nobody") or any user specifically configured to run the given plugin.
Check with munin-run --debug
what user it's running as and check that user can read /usr/local/lib64/perl5/DBI.pm
.