I recently decided to do a fresh CentOS install on a web server with a minimal amount of sites on it because it seemed easier than attempting to upgrade everything. With a fresh install I figured I would be forced to get everything completed quicker. The server was upgraded from CentOS 5.1 to CentOS 5.3 and from ISPConfig 2.X to ISPConfig 3.X. One of the virtual host configurations was for a Nagios server that monitors a fairly large list of servers running various services from basic server items like CPU, Load, Disk Space, etc. all the way to complex PostgreSQL statistics and other custom items. There are numerous Perl scripts to monitor PostgreSQL including check_pg_connections.pl, check_pg_lock_status.pl, check_pg_max_xid.pl, check_pg_queries.pl, check_pg_time.pl, and check_pg_waiting_queries.pl. The scripts use the DBD-Pg Perl module to make a connection (remote or local) to PostgreSQL servers.
When attempting to run these scripts through Nagios or manually I was receiving the below error.
install_driver(Pg) failed: DBD::Pg object version 2.13.1 does not match bootstrap parameter v2.13.1 at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 253.
Compilation failed in require at (eval 3) line 3.
This error was caused by a mistake I had made with attempting to install some packages using CPAN. During the installation of these packages Perl was upgraded to 5.8.9 and had caused library issues with Perl version 5.8.8 which had been installed using RPM packages. I had rolled back to Perl version 5.8.8 but there must have been some leftover links to the 5.8.9 libraries that I was unable to find. I attempted to remove and reinstall the RPM package named Perl-DBD-Pg using yum however the error would not resolve.
First make sure that the perl-DBD-Pg.i386 package is not installed via yum or as an RPM by issuing the below command.
- yum list *PERL-DBD-PG*
Make sure the result from the above command doesn’t show perl-DBD-Pg.i386 as “installed”. To verify that the package is not installed as an RPM issue the below command.
- rpm -qa perl-DBD-Pg
The above command should not return anything if it is not installed but if it is installed you will get something like the below on the line below the command.
Once you have verified the package is not installed issue the below command to install perl-DBD-Pg using CPAN which is what corrected the problem for me.
- perl -MCPAN -e 'install DBD::Pg'
Now when you run a Perl script that requires a connecting to PostgreSQL it should run without issue.