jonathanio / monitoring-nagios-haproxy

Nagios plugin (suitable for Nagios Check-compatible programs) for monitoring HAProxy services.
GNU General Public License v2.0
16 stars 19 forks source link

Feature : Query a particular Backend #4

Open JoNicolas opened 6 years ago

JoNicolas commented 6 years ago

Hi,

I was looking at your excellent script and found one feature : in some case, when you host multiples backends on a haproxy, when you have one faulty server, you will have the notification; however in certain condition, if you have another another failed server in another backend, the previous notification will be overwritten.

I will try to add one new option in order to query particular backend.

Best regards,

Nicolas

jonathanio commented 6 years ago

@JoNicolas,

I understand where you are coming from, however, the script was designed to ensure HAProxy had the appropriate number of minimum or maximum servers up or down (normally respectively). Setting Warning or Critical to one down won't re-warn when a second, or a third, go down too. This is not specifically an issue with the script, but just the way Nagios-based checked are designed to operate.

My preferred option here (and the way I normally configure monitoring) is to set up specific checks for the service/host that are independent of HAProxy. At least there I have awareness of communication issues (HAProxy alerts, but service/host alert is OK), or service down (service/host alerts instead, maybe HAProxy if it goes over the allowed limit too).

Nonetheless, I'm open to your pull request and am interested in seeing your idea.

JoNicolas commented 6 years ago

Hello @jonathanio,

I understand your point of view, from my side, I think that adding checks on both elements (HAProxy and all the backend servers and services) are a must be : HaProxy could have an issue but your backend servers can be healthy, it will be easier to track down the issues (but the impacts could be important).

I was able to tweak your script (in a quick and dirty way, I do not know perl) and add an optional parameter to the backend checks :

If you do not provide a parameter to -b or --backends then proceed as before (eq : display old behaviour); if a parameter is provided, try to find the provided backend and display the result of the checks.

I was not able to use the "!" getopt option with my optional parameter....

Regards,

Nicolas