Notify scripts informations

Denis Pompilio <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Message-ID <[email protected]>
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
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.