Subversion-Projekte lars-tiefland.nagios-php

Revision

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

Revision 49 Revision 58
Zeile -... Zeile 1...
-
 
1
<?php
-
 
2
 
-
 
3
    class hostGroup
-
 
4
    {
-
 
5
        public $alias;
-
 
6
        public $hostgroup_id;
-
 
7
        public $members;
-
 
8
        public function __construct( $id )
-
 
9
        {
-
 
10
            $sql = "SELECT
-
 
11
                    alias,
-
 
12
                    hostgroup_id
-
 
13
                FROM
-
 
14
                    hostgroups
-
 
15
                WHERE
-
 
16
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
-
 
17
                AND
-
 
18
                    hostgroup_id = $id
-
 
19
            ";
-
 
20
            $res = $GLOBALS["db"]->query( $sql );
-
 
21
            $row = $res->fetchRow();
-
 
22
            foreach ( $row as $feld => $wert )
-
 
23
            {
-
 
24
                $this->$feld = $wert;
-
 
25
            }
-
 
26
            $this->members = $this->getHostList();
-
 
27
        }
-
 
28
 
-
 
29
        public static function getList()
-
 
30
        {
-
 
31
 
-
 
32
        }
-
 
33
 
-
 
34
        public function getMemberList( $hg_id )
-
 
35
        {
-
 
36
            $sql = "SELECT
-
 
37
                    host_object_id
-
 
38
                FROM
-
 
39
                    host_group_members
-
 
40
                WHERE
-
 
41
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
-
 
42
                AND
-
 
43
                    hostgroup_id = $hg_id
-
 
44
            ";
-
 
45
            $res = $GLOBALS["db"]->query( $sql );
-
 
46
            while ( $row = $res->fetchRow() )
-
 
47
            {
-
 
48
                $ret[] = new host( $row["host_object_id"] );
-
 
49
            }
-
 
50
        }
-
 
51
    }
-
 
52
 
-
 
53
?>
1
54