yum -y install iperf monit
nano /etc/init.d/iperfd
nano /etc/init.d/iperfd
Paste the following into the file:
#!/bin/bash
#
# iperfd iperf network bandwidth test
#
# chkconfig: 2345 80 30
# description: iperf network bandwidth test
# pidfile: /var/run/iperf.pid
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
start() {
echo -n "Starting iperfd: "
/usr/bin/iperf -s -D >/dev/null 2>&1
touch /var/lock/subsys/iperfd
pidofproc iperf > /var/run/iperf.pid
return 1
}
stop() {
echo -n "Shutting down iperfd: "
killproc iperf
rm -f /var/lock/subsys/iperfd
rm -f /var/run/iperf.pid
return 1
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status iperf
;;
restart)
stop
start
;;
*)
echo "Usage: iperfd {start|stop|restart}"
exit 1
;;
esac
exit $?
Setup Monit
nano /etc/monit.d/iperf
Paste the following into the file:
check process iperf with pidfile /var/run/iperf.pid
start program = "/etc/init.d/iperfd start"
stop program = "/etc/init.d/iperfd stop"
if failed host 127.0.0.1 port 5001 type TCP then restart
if 5 restarts within 5 cycles then timeout
chmod the monit files:
chmod 0700 /etc/monit.conf
chmod 0700 /etc/monit.d/iperf
Start up your services:
chkconfig monit on
chkconfig iperfd on
service iperfd start
service monit start
it appears to just set iperf to 100 cpu utilization:: CentOS 6
ReplyDeleteUPDATE: apparently matters on the chown permissions. If 0755 it makes things go crazy, didn't get to a resolution but at least it appears to work now :) thanks!
Spoke too soon, cpu goes too 100% on top after about 30 seconds. Not sure oh well.
ReplyDeleteI've played around with Iperf before. We've tried a couple of the free network capacity tools and have found pathtest to be the most accurate - check it out, it is most customizable and, best part, free! www.testmypath.com
ReplyDelete