Subversion-Projekte lars-tiefland.nagios-php

Revision

Revision 9 | Zur aktuellen Revision | Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
	class host
3
	{
4
		public static function getStatusList()
5
		{
6
			$sql="SELECT
7
					count(current_state) AS anz
8
				FROM
9
					hoststatus
10
				WHERE
11
					instance_id = " . $GLOBALS["cfg"]["instance"] . "
12
				AND
13
					current_state = 0
14
			";
15
			$res = $GLOBALS["db"]->query($sql);
16
			$row = $res->fetchRow();
17
			$rows["up"] = $row["anz"];
18
			$sql="SELECT
19
					count(current_state) AS anz
20
				FROM
21
					hoststatus
22
				WHERE
23
					instance_id = " . $GLOBALS["cfg"]["instance"] . "
24
				AND
25
					current_state = 1
26
			";
27
			$res = $GLOBALS["db"]->query($sql);
28
			$row = $res->fetchRow();
29
			$rows["down"] = $row["anz"];
30
			$sql="SELECT
31
					count(current_state) AS anz
32
				FROM
33
					hoststatus
34
				WHERE
35
					instance_id = " . $GLOBALS["cfg"]["instance"] . "
36
				AND
37
					current_state = 2
38
			";
39
			$res = $GLOBALS["db"]->query($sql);
40
			$row = $res->fetchRow();
41
			$rows["unreachable"] = $row["anz"];
42
			$rows["total"] = array_sum($rows);
43
			return $rows;
44
		}
45
	}
46
?>