check_rabbitmq_server CRITICAL when socket = 0
hello,
thank you for your very usefull check. I know there is not much support on this repo but this can helps other.
After a rabbitmq restart I had false positive alarms one one node :
root@server /usr/local/nagios/etc/objects ../../libexec/check_rabbitmq_server -v -H rabbitmq --port 80 -u user -p password -n rabbitmq-docker-worker02
RABBITMQ_SERVER CRITICAL - Unable to get values for Sockets | Memory=10.49%;80;90 Process=0.05%;80;90 FD=0.00%;80;90
According to the rabbitMQ API sockets_used was :
"sockets_used": 0,
"sockets_used_details": {
"rate": 0
},
Thanks to chatgpt (sorry I'm not a perl guy) I was able to find this fix :
191 # if (!$p || !$used) { # faulty code
192 if ( !defined $p || !defined $used || !defined $limit ) { # fixed version
the $used if it is 0 in perl is considered as false then returning unable to get values for sockets
Hope this helps
This bug was fixed 9 years ago. You might want to update... ;-)
Really ? I thought I used the master branch this is the one to use maybe ?
-------- Message d'origine -------- Le 12/08/2025 12:26, tubemeister a écrit :
tubemeister left a comment (nagios-plugins-rabbitmq/nagios-plugins-rabbitmq#108)
This bug was fixed 9 years ago. You might want to update... ;-)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
This bug was fixed 9 years ago. You might want to update... ;-)
Can you please help me fix this, I tried the solution by @hdep but it didn't work for me, the new error was: Illegal division by zero at /opt/nagios/plugins/nagios-plugins-rabbitmq/scripts/check_rabbitmq_server line 206.
I am using 2.0.3 scripts - nagios-plugins-rabbitmq-2.0.3.libperl-monitoring-plugin.tar.gz
That is a new one, I just ran into that one too when I upgraded our RabbitMQ cluster from 3.13 to 4.1.
RabbitMQ 4.x doesn't seem to do sockets anymore so sockets_total in the code below is 0.
This check calculates a percentage by doing used/total*100. But total == 0 for sockets, hence the error.
check($p, "Memory", $bodyref->{'mem_used'}, $bodyref->{'mem_limit'}, $warning[0], $critical[0]);
check($p, "Process", $bodyref->{'proc_used'}, $bodyref->{'proc_total'}, $warning[1], $critical[1]);
check($p, "FD", $bodyref->{'fd_used'}, $bodyref->{'fd_total'}, $warning[2], $critical[2]);
#check($p, "Sockets", $bodyref->{'sockets_used'}, $bodyref->{'sockets_total'}, $warning[3], $critical[3]);
Locally I've commented out the fourth check on sockets as above so the others work at least, I haven't had time yet to look at a proper fix.
check($p, "Sockets" ...) if $bodyref->{'sockets_total'};
would probably be a reasonable fix. Also not sure if this repository is still maintained...
That is a new one, I just ran into that one too when I upgraded our RabbitMQ cluster from 3.13 to 4.1.
RabbitMQ 4.x doesn't seem to do sockets anymore so
sockets_totalin the code below is 0. This check calculates a percentage by doing used/total*100. But total == 0 for sockets, hence the error.check($p, "Memory", $bodyref->{'mem_used'}, $bodyref->{'mem_limit'}, $warning[0], $critical[0]); check($p, "Process", $bodyref->{'proc_used'}, $bodyref->{'proc_total'}, $warning[1], $critical[1]); check($p, "FD", $bodyref->{'fd_used'}, $bodyref->{'fd_total'}, $warning[2], $critical[2]); #check($p, "Sockets", $bodyref->{'sockets_used'}, $bodyref->{'sockets_total'}, $warning[3], $critical[3]);Locally I've commented out the fourth check on sockets as above so the others work at least, I haven't had time yet to look at a proper fix.
check($p, "Sockets" ...) if $bodyref->{'sockets_total'};would probably be a reasonable fix. Also not sure if this repository is still maintained...
Yes, I already did that so I could have a 'clean' Nagios
And i can confirm your statements, for example, on my production working rabbibmq on one environment: "RabbitMQ","3.7.19" - "sockets_total":29399 in my other working production environment: RabbitMQ version: 4.1.0 - "sockets_used":0
Thanks for your reply. BR