5 die("Usage: $argv[0] host1 host2 host3...\n");
6 $table = getenv('DB_TABLE');
8 $table = 'report_data';
10 if (!mysql_connect('localhost', 'monitor', 'monitor'))
11 die("Failed to connect to mysql: " . mysql_error());
12 mysql_select_db('monitor_reports');
14 function dt_verify($host, $table) {
16 $query = "SELECT * FROM $table " .
17 "WHERE host_name = '$host' AND " .
18 "(event_type = 1103 OR event_type = 1104) ORDER BY id";
20 $result = mysql_query($query);
23 die("mysql_query() failed: " . mysql_error());
25 while ($row = mysql_fetch_array($result)) {
26 switch ($row['event_type']) {
28 $start = $row['timestamp'];
29 echo " START: ($start) " . date("Y-m-d H:i:s", $start) . "\n";
32 $stop = $row['timestamp'];
33 $duration = $stop - $start;
34 echo " STOP: ($stop) " . date("Y-m-d H:i:s", $stop) . " duration=$duration\n";
42 for ($i = 1; $i < $argc; $i++
) {
43 dt_verify($argv[$i], $table);