Seite 1 von 1

Server Online Status abfragen

Verfasst: 16.07.2008 11:15
von Horsti
Hallo liebe Gemeinde,

ich habe folgendes Problem. Ich möchte meinen Serverstatus (dyndns.org) in einer PortalBox abfragen.

Das ist die Abfrage:

Code: Alles auswählen

<?php

if (!defined('IN_PHPBB'))
{
   exit;
}

if (!defined('IN_PORTAL'))
{
   exit;
}


        $ip = "xxx.dyndns.org"; // this is the host of the monitored server
        $onlinetext = "Server ist Online. Push the Image" ; // this is the on-line message
        $offlinetext = "Server ist Offline. Push the Image" ; // this is the off-line message
        $port = "5901"; // this is the port that you check
          if(@fsockopen($ip,$port,$errno,$errstr,1)) 
          {
             $onlinestatus = $onlinetext;
             $onlineimage = 'serveron.png';
          }
          else
          {
             $onlinestatus = $offlinetext;
             $onlineimage = 'serveroff.png';
          }

       $template->assign_vars(array(
           'ONLINESTATUS' => $onlinestatus,
           'ONLINEIMAGE' => $onlineimage,
        
        ));

?>
Habe das in eine server_status.php kopiert. In der PortalBox habe ich folgenden Inhalt drin:

Code: Alles auswählen

<!-- IF S_USER_LOGGED_IN -->
<div class="panel">
<div class="inner">
<span class="corners-top"><span></span></span>
<h3>Serverstatus</h3>
<a href='http://www.xxxxxx/server/all_server.html' ><img src='{ONLINEIMAGE}' width='17' height='17' border='0'></a>
<br />
{ONLINESTATUS}
<span class="corners-bottom"><span></span></span>
</div>
</div>
<br style="clear:both" />
<!-- ENDIF -->
Diesen Eintrag -----include($phpbb_root_path . 'portal/block/server_status.'.$phpEx);----
habe ich natürlich auch in der portal.php gemacht.

Dort soll nur ein on/offline gif,png oder was auch immer angezeigt werden. Das geht auch soweit, nur das der korrekte Status nicht angezeigt wird. Steht immer auf offline. Die Ports in meinem Router habe ich natürlich frei gegeben. und wenn ich die Abfrage über diese Seite mache wird mir der Status auch angezeigt. Ich denke mal das es an der Abfrage des Query Ports liegt. Kann man den QueryPort denn irgendwie mit "fsockopen" abfragen? Oder hat jemand ein Java Script das mir den Status anzeigt?

Kann mir bitte jemand auf die Sprünge helfen? Unter BB2 hat das einwandfrei funktioniert und ich verstehe nicht warum es in BB3 nicht geht.

Vielen Dank
Horst

Verfasst: 17.07.2008 17:21
von Horsti
Hollo Jungs,

hat denn niemand einer von Euch ein bisserl Hilfe für mich? Habe mich schon Tod gesucht, man findet X Anleitungen aber alle ohne QueryPort Abfrage.

Gruß Horst