Hi everyone,

I know that this has been discussed on this list before. I'm using this hosted service, that works quite well for alerting when backends are down: https://aura.snapt.net/

Best,

Andrei

Maik Kulbe wrote:
Hi,

that patch is for an older version of HAProxy. I would suggest you to monitor the logs or the stats socket as mentioned in the article. With a monitoring system like Nagios plus the socket interface you could also send those mails in case something goes down or up.

Hi!
I use HA-Proxy version 1.5.6 2014/10/18/ . Red hat 6.

I want use alert via mail. I find informations about this:
-----------------------------------
Patch HAProxy
So this brings us on to option 3 patch HAProxy to send the alerts, after
all how hard can it be?
As I don’t really want to write my own SMTP client or use any other
library’s lets go with the easy option of using mailx from the
mailutils package as we know it works. The following was written for
HAProxy dev18. Now I’m no developer so take the code more of a proof
of concept instead of something to add to your production environment.

Most of the work is already done for us, as HAProxy has functions for
setting a server up or down and also has an array containing the server
name, server’s status etc. So all we need to do is add our own
function to send the email and parse the email address from the
configuration file.

This done in the following patch files:
cfgparse.c
checks.c
log.c
global.h

So in the configuration file I have added the option “email_alert”
to the global section with to and from address.
http://blog.loadbalancer.org/3-ways-to-send-haproxy-health-check-email-alerts/
-------------------------------------

I try add text from patch file in the end original file and make haproxy
file.
/opt/haproxy/global.h.diff >> /opt/haproxy/include/types/global.h

cat /opt/haproxy/cfgparse.diff
>>/opt/haproxy/haproxy-1.5.6/src/cfgparse.c

cat /opt/haproxy/log.diff >>/opt/haproxy/haproxy-1.5.6/src/log.c

cat /opt/haproxy/checks.diff >>/opt/haproxy/haproxy-1.5.6/src/checks.c


And while compiling I have error:

[webadmin@srv-lb-qa haproxy-1.5.6_with_diff]$ make TARGET=linux2628
CPU=generic
gcc -Iinclude -Iebtree -Wall  -O2 -g -fno-strict-aliasing
-DCONFIG_HAP_LINUX_SPLICE -DTPROXY -DCONFIG_HAP_LINUX_TPROXY
-DCONFIG_HAP_CRYPT -DENABLE_POLL -DENABLE_EPOLL -DUSE_CPU_AFFINITY
-DASSUME_SPLICE_WORKS -DUSE_ACCEPT4 -DNETFILTER -DUSE_GETSOCKNAME
-DCONFIG_HAPROXY_VERSION=\"1.5.6\" -DCONFIG_HAPROXY_DATE=\"2014/10/18\"
\
              -DBUILD_TARGET='"linux2628"' \
              -DBUILD_ARCH='""' \
              -DBUILD_CPU='"generic"' \
              -DBUILD_CC='"gcc"' \
              -DBUILD_CFLAGS='"-O2 -g -fno-strict-aliasing"' \
              -DBUILD_OPTIONS='""' \
               -c -o src/haproxy.o src/haproxy.c
In file included from include/proto/proxy.h:28,
                 from include/common/cfgparse.h:30,
                 from src/haproxy.c:61:
include/types/global.h:207: error: expected identifier or ‘(’ before
‘--’ token
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:213: error: expected identifier or ‘(’ before
‘+’ token
include/types/global.h:215: error: expected identifier or ‘(’ before
‘+’ token
include/types/global.h:216: error: expected identifier or ‘(’ before
‘+’ token
In file included from src/haproxy.c:76:
include/types/global.h:207: error: expected identifier or ‘(’ before
‘--’ token
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:213: error: expected identifier or ‘(’ before
‘+’ token
include/types/global.h:215: error: expected identifier or ‘(’ before
‘+’ token
include/types/global.h:216: error: expected identifier or ‘(’ before
‘+’ token
In file included from include/proto/channel.h:35,
                 from src/haproxy.c:85:
include/types/global.h:207: error: expected identifier or ‘(’ before
‘--’ token
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:209: error: stray ‘@’ in program
include/types/global.h:213: error: expected identifier or ‘(’ before
‘+’ token
include/types/global.h:215: error: expected identifier or ‘(’ before
‘+’ token
include/types/global.h:216: error: expected identifier or ‘(’ before
‘+’ token
make: *** [src/haproxy.o] Error 1



Pls help me! I don't know how use patch(




Reply via email to