You are here

MPM with Zabbix 2.2

To make the MPM work with Zabbix 2.2.0, I need quite a few fixes to make it work (and also make it compatible with Ubuntu 12.04 Perl environment, which is missing SHA1)

I just wanted to list the fixes which I have applied (then you can see, which of them you can use, and which not):
--------------------------------------------------------------------------------------------------------
1.
After upgrading to Zabbix 2.2 , all the FromDual MPM Checks have stopped to deliver values to the Zabbix trappers.
When checking what was going on, we always received in the Logs:
--------------
20610:2013-12-09 08:55:33.550 - INFO: FromDualMySQLagent::checkConnectionToZabbixServer
20610:2013-12-09 08:55:33.550 - DBG : Check connection to zabbix server.
20610:2013-12-09 08:55:33.550 - DBG : /var/software/zabbix-agent/bin/zabbix_sender --zabbix-server zabbix.atrada.net --port 10051 --host 'nbg-db05' --key FromDual.server.check --value '1' -vv
zabbix_sender [20657]: DEBUG: answer [{
"response":"success",
"info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000027"}]
info from server: "processed: 0; failed: 1; total: 1; seconds spent: 0.000027"
sent: 1; skipped: 0; total: 1
20610:2013-12-09 08:55:33.558 - DBG : (ret=512).
20610:2013-12-09 08:55:33.559 - ERR : Child exited with value 2 (ret=512 / rc=1329).
20610:2013-12-09 08:55:33.559 - WARN: zabbix.atrada.net, 10051, nbg-db05
20610:2013-12-09 08:55:33.559 - WARN: Connection 1 to zabbix server failed (rc=1305)!
20610:2013-12-09 08:55:33.559 - INFO: Processing module drbd for secion nbg-db05 finished.
--------------
Further analysis revealed, that it was the return value of the zabbix_sender which has changed and thus gets wrongly interpreted by the checkConnectionToZabbixServer function!

The change of the zabbix_sender exit codes was mentioned for example here:
https://www.zabbix.com/forum/showthread.php?t=42678

[ZBXNEXT-935] zabbix sender exit status now better reflects the operation result - success:0, partial success:2, failure:1 (asaveljevs, wiper)

So, when the checkConnectionToZabbixServer make its check on a "non existent" trapper value (which it does per documentation), then it now receives a "partial success" exit code from zabbix_sender, which has the value 2 (and this is clearly visible in the above debug log too).

FIX (in two files):
* FromDualMySQLagent.pm (checkConnectionToZabbixServer)
<< if ( ($ret >> 8) == 0 ) {
>> if ( ($ret >> 8) == 0 || ($ret >> 8) == 2 ) {
* nano sendCachedData.pm
<< if ( $ret == 0 ) {
>> if ( ($ret >> 8) == 0 || ($ret >> 8) == 2 ) {

--------------------------------------------------------------------------------------------------------
2.
In the latest 0.9.1 there is a "little" bug in the MPM module, which inserts a "new line" after mpm_mr_version, which is also effective in the cache file, and thus can't be sent by zabbix_sender.

FIX (in one file)
* The simple fix is to remove the \n in FromDualMySQLmpm.pm in the two sprintf's
<< $hGlobalVariables{'mpm_mr_version'} = sprintf("%02d%02d%02d\n", $1, $2, $4);
>> $hGlobalVariables{'mpm_mr_version'} = sprintf("%02d%02d%02d", $1, $2, $4);
<< $hGlobalVariables{'mpm_mr_version'} = sprintf("%02d%02d%02d\n", $1, $2, 0);
>> $hGlobalVariables{'mpm_mr_version'} = sprintf("%02d%02d%02d", $1, $2, 0);

--------------------------------------------------------------------------------------------------------
3.
Ubuntu 12.04 does not provides perl-Digest-SHA1 but instead onyl the SHA package. Easiest way to fix this is, to replace all occurences of SHA1 with SHA:

FIX (by sed replacement):
* sed "s/SHA1/SHA/g" < lib/InnoDbStatus.pm > lib/InnoDbStatus2.pm
* mv lib/InnoDbStatus2.pm lib/InnoDbStatus.pm
* sed "s/SHA1/SHA/g" < lib/SecurityInformation.pm > lib/SecurityInformation2.pm
* mv lib/SecurityInformation2.pm lib/SecurityInformation.pm

--------------------------------------------------------------------------------------------------------
4.
The DRBD modul is sending back data in the wrong format. Each of the key strings has a hard coded "drbd." prefix at the beginning, which leads to a double "drbd.drbd." in the resulting keys in the cache file. A simple removal of these extra strings fixes this.

FIX (by sed replacement):
* sed "s/drbd\.//g" < lib/FromDualMySQLdrbd.pm > lib/FromDualMySQLdrbd2.pm
* mv lib/FromDualMySQLdrbd2.pm lib/FromDualMySQLdrbd.pm

Hi Andras,

Thanks for reporting those issues and sharing your fixes.
We would like to know also if you made a Zabbix upgrade from 1.8 to 2.2 directly or you did an earlier upgrade from 1.8 to 2.0 first then from 2.0 to 2.2 ?

If you made the upgrade to 2.0 first, have you experienced any problems or you just found them in 2.2?

Thanks,
Abdel-Mawla
abdel-mawlacomment

Hi,
Sorry for not going into more details on this.

First, we did never use 1.8 bus started with 2.0. The Bugs 3 and 4 were already there in 2.0.

Problem 1 is new with Zabbix 2.2 (as the zabbix_sender exit codes have changed).

Problem 2 is new since 0.9.1 of MPM which I only switched to during the move from 2.0 to 2.2 (but this bug should affect 2.0 users too).

Andras Fabiancomment