Revision 68 | Revision 78 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?phprequire_once "Config.php";require_once "MDB2.php";require_once "smarty/libs/Smarty.class.php";require_once "classes/host.php";require_once "classes/service.php";require_once "classes/hostgroup.php";require_once "classes/servicegroup.php";require_once "classes/contact.php";$GLOBALS["ui"] = new Smarty();$cfg = new Config();$cfg = $cfg->parseConfig( "config.xml", "xml" );$cfg = $cfg->toArray();$GLOBALS["cfg"] = $cfg["root"]["config"];$opts = array("persistent" => true,"portability" => MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL ^MDB2_PORTABILITY_FIX_CASE,);$dsn = array("phptype" => "mysqli","username" => $GLOBALS["cfg"]["db"]["user"],"password" => $GLOBALS["cfg"]["db"]["pass"],"hostspec" => $GLOBALS["cfg"]["db"]["server"],"database" => $GLOBALS["cfg"]["db"]["db"],"new_link" => true,);$GLOBALS["db"] = MDB2::connect( $dsn, $opts );if ( PEAR::isError( $GLOBALS["db"] ) ){trigger_error( "Keine Verbindung zur Datenbank möglich!\n", E_USER_ERROR );}$GLOBALS["db"]->setfetchMode( MDB2_FETCHMODE_ASSOC );$GLOBALS["ui"]->assign( "cfg", $GLOBALS["cfg"] );$nagiosVersion = getNagiosVersion();$programStatus = getProgramStatus();$runtimeInfo = getRuntimeInfo();var_dump( $nagiosVersion, $programStatus, $runtimeInfo );$GLOBALS["ui"]->assign( "nagiosVersion", $nagiosVersion );$GLOBALS["ui"]->assign( "programStatus", $programStatus );$GLOBALS["ui"]->assign( "runtimeInfo", $runtimeInfo );function getNagiosVersion(){$sql = "SELECTprogram_versionFROMprocessevents peJOINprogramstatus psONpe.event_time = ps.program_start_timeWHEREpe.instance_id = " . $GLOBALS["cfg"]["instance"] . "ANDpe.instance_id = ps.instance_idANDpe.process_id = ps.process_id";$res = $GLOBALS["db"]->query( $sql );$row = $res->fetchRow();return $row["program_version"];}function getProgramStatus(){$sql = "SELECT*FROMprogramstatus psWHEREps.instance_id = " . $GLOBALS["cfg"]["instance"] . "";$res = $GLOBALS["db"]->query( $sql );$info = $res->fetchAll();return $info;}function getRuntimeInfo(){$sql = "SELECTvarname,varvalueFROMruntimevariablesWHEREinstance_id = " . $GLOBALS["cfg"]["instance"] . "";$res = $GLOBALS["db"]->query( $sql );while ( $row = $res->fetchRow() ){$ret[$row["varname"]] = $row["varvalue"];}return $ret;}?>