Subversion-Projekte lars-tiefland.nagios-php

Revision

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

Revision 50 Revision 66
Zeile 33... Zeile 33...
33
        trigger_error( "Keine Verbindung zur Datenbank möglich!\n", E_USER_ERROR );
33
        trigger_error( "Keine Verbindung zur Datenbank möglich!\n", E_USER_ERROR );
34
    }
34
    }
35
    $GLOBALS["db"]->setfetchMode( MDB2_FETCHMODE_ASSOC );
35
    $GLOBALS["db"]->setfetchMode( MDB2_FETCHMODE_ASSOC );
Zeile 36... Zeile 36...
36
 
36
 
-
 
37
    $GLOBALS["ui"]->assign( "cfg", $GLOBALS["cfg"] );
-
 
38
    $GLOBALS["ui"]->assign( "nagiosVersion", getNagiosVersion() );
-
 
39
    $GLOBALS["ui"]->assign( "programStatus", getProgramStatus() );
-
 
40
    $GLOBALS["ui"]->assign( "runtimeInfo", getRuntimeInfo() );
-
 
41
 
-
 
42
    function getNagiosVersion()
-
 
43
    {
-
 
44
        $sql = "SELECT
-
 
45
                program_version
-
 
46
            FROM
-
 
47
                processevents pe
-
 
48
            JOIN
-
 
49
                programstatus ps
-
 
50
            ON
-
 
51
                pe.event_time = ps.progrram_starttime
-
 
52
            WHERE
-
 
53
                pe.instance_id = " . $GLOBALS["cfg"]["instance"] . "
-
 
54
            AND
-
 
55
                pe.instance_id = ps.instance_id
-
 
56
            AND
-
 
57
                pe.pprocess_id = ps.process_id
-
 
58
        ";
-
 
59
        $sres = $GLOBALS["db"]->query( $sql );
-
 
60
        $row = $res->fetchRow();
-
 
61
        return $row["program_version"];
-
 
62
    }
-
 
63
 
-
 
64
    function getProgramStatus()
-
 
65
    {
-
 
66
        $sql = "SELECT
-
 
67
                *
-
 
68
            FROM
-
 
69
                programstatus ps
-
 
70
            WHERE
-
 
71
                ps.instance_id = " . $GLOBALS["cfg"]["instance"] . "
-
 
72
        ";
-
 
73
        $res = $GLOBALS["db"]->query( $sql );
-
 
74
        $info = $res->fetchAll();
-
 
75
        return $info;
-
 
76
    }
-
 
77
 
-
 
78
    function getRuntimeInfo()
-
 
79
    {
-
 
80
        $sql = "SELECT
-
 
81
                varname,
-
 
82
                varvalue
-
 
83
            FROM
-
 
84
                runtimevariables
-
 
85
            WHERE
-
 
86
                instance_id = " . $GLOBALS["cfg"]["instance"] . "
-
 
87
        ";
-
 
88
        $res = $GLOBALS["db"]->query( $sql );
-
 
89
        while ( $row = $res->fetchRow() )
-
 
90
        {
-
 
91
            $ret[$row["varname"]] = $row["varvalue"];
-
 
92
        }
-
 
93
        return $ret;
Zeile 37... Zeile 94...
37
    $GLOBALS["ui"]->assign( "cfg", $GLOBALS["cfg"] );
94
    }