Wednesday, December 22, 2010

iperf woes

Yesterday I blogged about iperf, CentOS and monit. Well, it turns out it was a bit early to report success. Even with monit, iperf is inherently unstable on CentOS. Monit's log shows this:
[CET Dec 21 11:26:14] error    : 'iperf' process with pid 20557 is a zombie
[CET Dec 21 11:26:14] error    : 'iperf' failed, cannot open a connection to INET[127.0.0.1:5001] via TCP
[CET Dec 21 11:26:14] info     : 'iperf' trying to restart
[CET Dec 21 11:26:14] info     : 'iperf' stop: /etc/init.d/iperfd
[CET Dec 21 11:26:44] error    : 'iperf' failed to stop
[CET Dec 21 11:27:44] error    : 'iperf' process with pid 20557 is a zombie
[CET Dec 21 11:27:44] error    : 'iperf' failed, cannot open a connection to INET[127.0.0.1:5001] via TCP
[CET Dec 21 11:27:44] info     : 'iperf' trying to restart
[CET Dec 21 11:27:44] info     : 'iperf' stop: /etc/init.d/iperfd
[CET Dec 21 11:28:14] error    : 'iperf' failed to stop
[CET Dec 21 11:29:14] error    : 'iperf' process with pid 20557 is a zombie
And ps shows iperf is defunct. This is obviously a bad situation. When I run iperf without -D parameter, it responds one time and then shuts down. But I couldn't get this behaviour to work with iperfd and monit properly. For the record, I used "iperf version 2.0.4 (7 Apr 2008) pthreads".
So in the end I resorted to use iperf on a Windows box and run it as a service. So far there have been no problems.

Tuesday, December 21, 2010

CentOS, iperf and monit

I'm quite fond of FAN and so I have several CentOS-based Nagios systems to check various things. I recently needed to check the available bandwith between two servers, so I decided to use check_bandwidth which is based on iperf. So far so good.
Because I need to rely on iperf to be running on both ends, I ended up using monit.
"Monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses too much resources."
Greg from the brain dive was kind enough to post the steps to set up iperf and monit on CentOS here. These steps almost led me to success, I had to do a few extra steps to make it work:

chmod +x /etc/init.d/iperfd
add "set daemon 60" to /etc/monit.conf

I found monit a bit weird to debug, because it doesn't write anything to it's logfile. So to find out why it's dying, I ran it in foreground with "monit -vI" which gives nice diagnostic output.