add a directory for running nagios scale/performance tests
[monitor.git] / nagios / test / fake_api.sh
diff --git a/nagios/test/fake_api.sh b/nagios/test/fake_api.sh
new file mode 100755 (executable)
index 0000000..a44c2ea
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+source /usr/share/monitor/nagios/common.sh
+
+RAW=$( random_sample /usr/share/monitor/nagios/api_check_data.txt )
+RUNTIME=$( echo $RAW | awk '{print $1}' )
+STATE=$( echo $RAW | awk '{print $2}' )
+SLEEP=`echo "scale=3; $RUNTIME * 950000" | bc`
+HOST=boot.planet-lab.org
+open_http $HOST
+usleep $SLEEP
+/usr/lib/nagios/plugins/check_dummy $( str_to_state $STATE ) "Slept $RUNTIME sec for $STATE"
+R=$?
+
+close_http
+exit $R