Subversion-Projekte lars-tiefland.nagios-php

Revision

Revision 45 | Revision 82 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 45 Revision 47
Zeile 3... Zeile 3...
3
    class host
3
    class host
4
    {
4
    {
5
        public $display_name;
5
        public $display_name;
6
        public $host_id;
6
        public $host_id;
7
        public $host_object_id;
7
        public $host_object_id;
-
 
8
        public $services;
Zeile 8... Zeile 9...
8
 
9
 
9
        public function __construct($id)
10
        public function __construct( $id )
10
        {
11
        {
11
            $sql="SELECT
12
            $sql = "SELECT
12
                    host_id,
13
                    host_id,
13
                    display_name,
14
                    display_name,
14
                    host_object_id
15
                    host_object_id
15
                FROM
16
                FROM
16
                    hosts
17
                    hosts
17
                WHERE
18
                WHERE
18
                    host_id = $id
19
                    host_id = $id
19
                AND
20
                AND
20
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
21
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
21
            ";
22
            ";
22
            $res = $GLOBALS["db"]->query($sql);
23
            $res = $GLOBALS["db"]->query( $sql );
23
            $row = $res->fetchRow();
24
            $row = $res->fetchRow();
24
            //$this->host_id=$row["host_id"];
25
            //$this->host_id=$row["host_id"];
25
            foreach($row as $feld => $wert)
26
            foreach ( $row as $feld => $wert )
26
            {
27
            {
27
                $this->$feld = $wert;
28
                $this->$feld = $wert;
-
 
29
            }
-
 
30
            $this->services = host::getHostServiceList( $id );
-
 
31
        }
-
 
32
 
-
 
33
        public static function getHostServiceList( $host_id )
-
 
34
        {
-
 
35
            $sql = "SELECT
-
 
36
                    service_id
-
 
37
                FROM
-
 
38
                    services
-
 
39
                WHERE
-
 
40
                    host_object_id = $host_id
-
 
41
                AND
-
 
42
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
-
 
43
            ";
-
 
44
            $res = $GLOBALS["db"]->query( $sql );
-
 
45
            while ( $row = $res->fetchRow() )
-
 
46
            {
-
 
47
                $ret[] = new service( $row["service_id"] );
-
 
48
            }
28
            }
49
            return $ret;
29
        }
50
        }
30
        public static function getStatusList()
51
        public static function getStatusList()
31
        {
52
        {
32
            $sql = "SELECT
53
            $sql = "SELECT