You are here

check_mysql_performance saving host perfdata incorrectly

1 post / 0 new
cruatta
cruatta's picture
check_mysql_performance saving host perfdata incorrectly

check_mysql_performance saves some perfdata to /tmp/ and for some hosts, it seems to be saving it incorrectly to /tmp/nagios_mysql_perf_localhost_something_something.tmp if you don't use the -H flag. I think this causes some metrics to report incorrectly in opsview. We were seeing a huge increase in log waits that were showing up in opsview but not in mysql.

 

My check:

check_mysql_performance -D 'host=$HOSTADDRESS$;port=%MYSQLCREDENTIALS:3%' -u '%MYSQLCREDENTIALS:1%' -p '%MYSQLCREDENTIALS:2%' --metricname=Innodb_log_waits -w 20 -c 30  

From check_mysql_performance:

my $diff = Nagios::Plugin::Differences->new(     'file' => sprintf(         '/tmp/nagios_mysql_perf_%s_%s_%s.tmp',                                                                                                                                                                       $np->opts->H || "localhost",         urlencode( $ENV{NAGIOS_SERVICEDESC} || "unknown" ),         $fname_component     ) );   Using the above check, I end up with a whole bunch of files like /tmp/nagios_mysql_perf_localhost_Mysql_Threads_running_proddb1.tmp. proddb1 is a database that is not present on localhost (opsview server).    However, when you use the -H flag, my guess is that the -D flag is ignored because on some of our mysql servers that don't have port 3306 open, I get a cannot connect error:  

$ /usr/local/nagios/libexec/check_mysql_performance -H 10.1.200.100 -D 'host=10.1.200.100;port=3311' -u 'user' -p 'pass' --metricname=Innodb_log_waits -w 20 -c 30
RETURN CODE: 111
ERROR:
DBI connect('host=10.1.200.100','user',...) failed: Can't connect to MySQL server on '10.1.200.100' (111) at /usr/local/nagios/libexec/check_mysql_performance line 487.
Note: Errors without any output - this will be displayed as '(null)' in status screens

Is this a bug in the check or are my checks setup incorrectly?