DinoTools / monitoring-check_haproxy

Monitoring plugin to check HAProxy with Icinga, Nagios and other compatible monitoring solutions
https://DinoTools.github.io/monitoring-check_haproxy/
GNU General Public License v2.0
7 stars 4 forks source link

check script only shows data of one frontend #25

Open vmpr opened 7 months ago

vmpr commented 7 months ago

Hi,

I just tested your check script for haproxy and it's a great piece of work, thanks!

There is one problem: it only checks one frontend, but we have multiple configured :( here is the debug output for our case:

# /usr/lib/nagios/plugins/check_haproxy --debug
get_data{} is reading data from HAProxy
build_checks{} building BACKEND check for elasticsearch
build_checks{} building BACKEND check for redis
build_checks{} building FRONTEND check for stats
check_frontends{} is starting check on frontends
check_frontends{} checking FRONTEND stats
check_frontends{} running OPEN check
check_frontends{} running Sessions check
check_frontends{} found 1 (limit 8000); thresholds are 6000 (warn) 7200 (crit)
check_backends{} is starting check on backends
check_backends{} checking BACKEND elasticsearch
check_backends{} found 3 up, 0 down, 0 disabled (3 total)
check_backends{} found 3 (limit 3); thresholds are 5 (warn) 2 (crit)
check_frontends{} running Sessions check
check_backends{} found 0 (limit 800); thresholds are 600 (warn) 720 (crit)
check_backends{} checking BACKEND redis
check_backends{} found 1 up, 1 down, 0 disabled (2 total)
check_backends{} found 1 (limit 2); thresholds are 5 (warn) 2 (crit)
check_frontends{} running Sessions check
check_backends{} found 0 (limit 800); thresholds are 600 (warn) 720 (crit)
check_servers{} is starting check on servers
check_servers{} checking SERVER els01 on BACKEND elasticsearch
check_servers{} checking SERVER els02 on BACKEND elasticsearch
check_servers{} checking SERVER els03 on BACKEND elasticsearch
check_servers{} checking SERVER red01 on BACKEND redis
check_servers{} checking SERVER red02 on BACKEND redis
check_haproxy CRITICAL - Backend redis servers (up: 1, down 1, disabled 0, total 2) | frontend_stats_sessions=1;6000;7200;;8000 backend_elasticsearch_servers_up=3;5;2;;3 backend_elasticsearch_servers_down=0;;;;3 backend_elasticsearch_servers_disabled=0;;;;3 backend_elasticsearch_sessions=0;600;720 backend_redis_servers_up=1;5;2;;2 backend_redis_servers_down=1;;;;2 backend_redis_servers_disabled=0;;;;2 backend_redis_sessions=0;600;720

stats is the last frontend of our three frontends on the stats page, maybe the bug is related to that fact?

Can you help us with that problem?

thanks and have a great day! cheers Ringo

vmpr commented 5 months ago

@phibos can you help here? is this also in your setup happening? cheers Ringo

phibos commented 5 months ago

Can you see all three frontends if you run the the following command?

echo "show stat" | sudo socat /var/run/haproxy.sock stdio | grep FRONTEND

Maybe you have to change the socket.

vmpr commented 5 months ago

Hi @phibos - thanks for your reply, that's the output I`ve got:

echo "show stat" | sudo socat /var/run/haproxy.sock stdio | grep FRONTEND elasticsearch,FRONTEND,,,0,4,8000,71,135099,2605015,0,0,0,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,3,,,,0,123,0,0,0,0,,0,7,123,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,http,,0,3,71,0,0,0,0,,,0,0,,,,,,,0,,,,, redis,FRONTEND,,,0,25,8000,1952269,1923705329,163149004213,0,0,0,,,,,OPEN,,,,,,,,,1,3,0,,,,0,0,0,35,,,,,,,,,,,0,0,0,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,tcp,,0,35,1952269,,0,0,0,,,,,,,,,,,0,,,,, stats,FRONTEND,,,0,5,8000,4417,768558,10740944,0,0,0,,,,,OPEN,,,,,,,,,1,4,0,,,,0,0,0,1,,,,0,4417,0,0,0,0,,0,1,4417,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,http,,0,1,4417,4417,0,0,0,,,0,0,,,,,,,0,,,,,

I can see the frontends with your command, but they don't show up in the checks output:

check_haproxy OK - HAProxy is functioning within established parameters. (1 frontends, 2 backends, 2 servers, 2 services)

vmpr commented 5 days ago

@phibos do you have any ideas on how to fix the problem?