Re: Notify scripts informations

"Paul Robert Marino" <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Message-ID <[email protected]>
How I he's to handle this back in the day was I wrote a daemon in Perl that monitored a file then used logger to write to the file with headers which described the policy group with complex max lines, application, and time rules.
essentially that is still your best option however if you don't need real time with complex rules you can do the same thing with crony jobs and individual files. The trick would be in the cron job to lets say in Perl to open then in the next line unlink the file. This would result in the file being deleted according to new processes but as long as the Perl script had the file handle open it would read the original file. This could give you the effect you desire.

That said keepalived does not have a built in method for aggregating or custom formatting messages which is why you can define an external script as the notification message

-- Sent from my HP Pre3

----------
On Jul 4, 2013 5:14 AM, Denis Pompilio <[email protected]> wrote:

Hi,

I'm tring to merge keepalived notifications by using the notify_* features.

As of today, our keepalived servers are handling about:
- ~360 Virtual Server Group
- ~1700 Virtual IPs in IPVS
- ~2800 Realservers associated to these VIPs
This setup can produce a lot of notifications depending of the realservers
activities.

What I'm trying to do is to reduce the number of emails received for realservers
states changes. I am using the notify_up and notify_down methods to store the
state changes informations for 5 minutes and then send these informations in a
single mail. At the end of this mail, you will find my configuration file and
the notify script both used for tests. The script is full of debug to see what
is actually passed by keepalived.

When I compare email notification content with accessible informations from
script, I see that some informations like check result are missing. I have not
seen any change from release 1.1.20 to 1.2.7 on this point but I could have miss
something.

Is there a way to access all informations visible in notifications emails using
the notify_* directives ?

keepalived.conf
---
global_defs {
router_id sekmeth.int.nbs-system.com
notification_email {
*******@nbs-system.com
}
notification_email_from [email protected]
smtp_server ***********
smtp_connect_timeout 30
}

virtual_server group pool_3 {
delay_loop 5
lb_algo wrr
lb_kind DR
protocol TCP
real_server 192.168.1.7 80 {
notify_up "/usr/local/bin/ka-notify.sh up 192.168.1.7"
notify_down "/usr/local/bin/ka-notify.sh down 192.168.1.7"
weight 4
HTTP_GET {
url {
path /
status_code 401
}
connect_port 80
connect_timeout 3
nb_get_retry 1
delay_before_retry 0
}
real_server 192.168.1.62 80 {
weight 4
HTTP_GET {
url {
path /
status_code 200
}
connect_port 80
connect_timeout 3
nb_get_retry 1
delay_before_retry 0
}
}
}
---

/usr/local/bin/ka-notify.sh
---
#! /bin/sh

{
echo "----< `date` - $0 >----"
echo "----< export >----"
export
echo "----< set >----"
set

echo "----< arguments >----"
for arg in "$@" ; do
echo "- $arg"
done

echo "----< stdin readline >----"
while read line ; do
echo $line
done
} > /tmp/ka-notify.log
---

Regards,

Denis POMPILIO

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Keepalived-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/keepalived-devel

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk

_______________________________________________
Keepalived-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/keepalived-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.