add a directory for running nagios scale/performance tests
[monitor.git] / nagios / test / run_test_all4.sh
1 #!/bin/bash
2
3 NODES="1280 640 320"
4 TIMES="7 15 30 60 120"
5
6 D=`date +%s`
7
8 # NOTE: we should only need to do this once.  Every restart will inherit the
9 #       last retention file after restarting.
10
11 function block_until_hour ()
12 {
13     d=`date +%s`
14     last_hour=$(( $d - $d % (60 * 60 ) ))
15     next_hour=$(( $last_hour + 60*60 ))
16     while [ $next_hour -gt `date +%s` ] ; do 
17         sleep 10
18     done
19 }
20
21 #block_until_hour
22 cp /usr/share/monitor/nagios/retention.dat /var/log/nagios/retention.dat 
23
24 echo "Restoring complete retention.dat"
25 echo "START time nodes start"
26 for N in $NODES ; do 
27     cp /var/log/nagios/retention.dat /tmp/retention.dat 
28     /usr/share/monitor/nagios/filter_nagios_retention.py 7 1280 /tmp/retention.dat > /var/log/nagios/retention.dat
29
30     for T in $TIMES ; do 
31         service nagios stop
32         echo "Generating plcnodes with $T min intervals & $N nodes"
33         ./plc_test_hosts.py $T $N > /etc/nagios/objects/plcnodes.cfg
34         echo "Sleeping before starting nagios"
35         block_until_hour
36         D=`date +%s`
37         echo "START $T $N" $D $(( $D + 60*60 )) >> stimes.txt
38         service nagios start
39         sleep $(( 50*60 ))
40     done
41 done
42
43
44 service nagios stop
45 sleep $(( 10*60 ))
46 cp /etc/nagios/objects/plc.cfg /etc/nagios/objects/plcnodes.cfg
47 service nagios start
48