[Pacemaker] pingd
Lars Ellenberg
lars.ellenberg at linbit.com
Fri Sep 3 14:18:29 UTC 2010
On Fri, Sep 03, 2010 at 12:12:58PM +0200, Bernd Schubert wrote:
> On Friday, September 03, 2010, Lars Ellenberg wrote:
> > > > how about an fping RA ?
> > > > active=$(fping -a -i 5 -t 250 -B1 -r1 $host_list 2>/dev/null | wc -l)
> > > >
> > > > terminates in about 3 seconds for a hostlist of 100 (on the LAN, 29 of
> > > > which are alive).
> > >
> > > Happy to add if someone writes it :-)
> >
> > I thought so ;-)
> > Additional note to whomever is going to:
> >
> > With fping you can get fancy about "better connectivity",
> > you are not limited to the measure "number of nodes responding".
>
> I think for the beginning, just the basic feature should be sufficient.
> Actually I thought about to add an option to the existing ping RA to let the
> user choose between ping and fping, it would default to ping. I will do that
> mid of next week.
>
>
> > You could also use the statistics on packet loss and rtt provided on
> > stderr for -c or -C mode (example output below, chose what you think is
> > easier to parse), then do some scoring scheme on average or max packet
> > loss, rtt, or whatever else makes sense to you.
> > (If a switch starts dying, it may produce increasing packet loss first...)
>
> That will require quite parsing, which I'm not comfortable with in a shell
> script. I have no objections to later on add fping RA written in perl or
> python.
-s causes a summary to be displayed, like so:
fping -s -q -c 2 $host_list
21 targets
6 alive
15 unreachable
0 unknown addresses
0 timeouts (waiting for response)
42 ICMP Echos sent
12 ICMP Echo Replies received
0 other ICMP received
0.11 ms (min round trip time)
0.47 ms (avg round trip time)
2.22 ms (max round trip time)
2.219 sec (elapsed real time)
That is easy enough to parse even from a shell script.
You just chose if you want to use "numbers alive", or
"number replies received", the latter accounting for packet loss.
If you want, you can resort to awk ;-)
N_REPLIES=$(fping -s -q -c $N_PINGS $host_list 2>&1 |
awk '/ICMP Echo Replies received/ { print $1 }')
# update the attribute with $N_REPLIES, instead of number alive,
# maybe scale with N_PINGS and/or N_HOSTS ...
--
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com
More information about the Pacemaker
mailing list