DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:sos

sos plugin

Compatible with DokuWiki

No compatibility info given!

plugin Service Online Status - Monitor several TCP / UDP services on your DokuWiki. You can display the status as picture or as text.

Last updated on
2007-12-21
Provides
Syntax

The missing download url means that this extension cannot be installed via the Extension Manager. Please see Publishing a Plugin on dokuwiki.org. Recommended are public repository hosts like GitHub, GitLab or Bitbucket.

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with fqdn, ip, status, tcp, udp

Download (detail page has disappeared) Direkt Link for PluginManager (page has disappeared)

Source

Found old german description and source here: http://www.lanbugs.de/?s=sos I put a copy of the page here description — oh-mark 2012/01/19 18:32

Copy of Page

Mit diesem DokuWiki Plugin können Sie den Status von Diensten TCP/UDP anzeigen als Bild mit/ohne Text und als Textversion. Bekannte Probleme

Nicht alle UDP Services werden korrekt angezeigt. Dies hängt mit dem UDP Protokoll zusammen, da UDP ein verbindungsloses Protokoll ist im gegensatz zu TCP. Bei UDP wird in der Regel keine Verbindung aufgebaut bevor nicht Daten gesendet oder empfangen werden müsssen. Bei DNS (udp/53) funktioniert die Statusanzeige. Andere UDP Services habe ich noch nicht getestet.

sos.html
<!--?php
/**
 * Service Online Status
 *
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Maximilian Thoma <info@thoma.cc-->
 */
 
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
 
/**
 * All DokuWiki plugins to extend the parser/rendering mechanism
 * need to inherit from this class
 */
class syntax_plugin_sos extends DokuWiki_Syntax_Plugin {
 
    function getInfo(){
      return array(
        'author' => 'Maximilian Thoma',
        'email'  => 'info@thoma.cc',
        'date'   => '2007-12-18',
        'name'   => 'Service Online Status',
        'desc'   => 'Service Online Status Plugin, -TCP fully supported, UDP experimental- usage: {{sos>protocol:ip_addr:port:img(y/n)|Description}}',
        'url'    => 'http://www.thoma.cc',
      );
    }
 
    function getType()  { return 'substition'; }
    //function getPType() { return 'block'; }
    function getSort()  { return 309; }
 
    function connectTo($mode)
    {
      $this->Lexer->addSpecialPattern('\{\{sos>.+?\}\}', $mode, 'plugin_sos');
    }
 
    function handle($match, $state, $pos, &$handler){
    $data = substr($match, 6, -2);
        $pos = strpos($data, '|');
        if ($pos === FALSE)
        {
            $description = '';
            $target = $data;
        }
        else
        {
            $description = substr($data, $pos + 1);
            $target = substr($data, 0, $pos);
        }
        return array(target => $target, description => $description);
    }
 
    function render($mode, &$renderer, $data) {
        if($mode == 'xhtml'){
            $renderer->doc .= $this->_sos($data);
            return true;
        }
        return false;
    }
 
    function _sos($data){
    global $ID;
 
    // Explode Data protocol:ip_addr:port:img(y/n)
    $data_tmp=explode(":",$data[target]);
    $protocol=$data_tmp[0];
    $ip_addr=$data_tmp[1];
    $port=$data_tmp[2];
    $img=$data_tmp[3];
    $description=$data[description];
 
    // TCP or UDP
    $status = @fsockopen("$protocol://$ip_addr", $port, $errno, $errstr, 5);
    if (!$status) {
    // Offline TCP
    if($img=="y"){
        // Mit Bild
        $src = DOKU_URL.'lib/plugins/sos/images/off.png';
        $buffer.="
<div class="\"plugin_sos\""><img src="%5C%22$src%5C%22" alt="\"($protocol\\$port)" $description\"="">$description</div>
 
";
        } else {
        // Ohne Bild
        if($description==""){
        $buffer.="
<div class="\"plugin_sos\"">$protocol\\$port $ip_addr not reachable.</div>
 
";
        } else {
        $buffer.="
<div class="\"plugin_sos\"">$description not reachable.</div>
 
";
        }
        }
    @fclose($status);
 
    } else {
    // Online oder UDP
    if($protocol=="tcp"){
    if($img=="y"){
        // Mit Bild
        $src = DOKU_URL.'lib/plugins/sos/images/on.png';
        $buffer.="
<div class="\"plugin_sos\""><img src="%5C%22$src%5C%22" alt="\"($protocol\\$port)" $description\"="">$description</div>
 
";
        } else {
        // Ohne Bild
        if($description==""){
        $buffer.="
<div class="\"plugin_sos\"">$protocol\\$port $ip_addr is reachable.</div>
 
";
        } else {
        $buffer.="
<div class="\"plugin_sos\"">$description is reachable.</div>
 
";
        }
        }
    @fclose($status);
    }
    // oder UDP
    if($protocol=="udp"){
    fwrite($status, "\n");
        if(fread($status, 26)==""){
        // Offline
    if($img=="y"){
        // Mit Bild
        $src = DOKU_URL.'lib/plugins/sos/images/off.png';
        $buffer.="
<div class="\"plugin_sos\""><img src="%5C%22$src%5C%22" alt="\"($protocol\\$port)" $description\"="">$description</div>
 
";
        } else {
        // Ohne Bild
        if($description==""){
        $buffer.="
<div class="\"plugin_sos\"">$protocol\\$port $ip_addr not reachable.</div>
 
";
        } else {
        $buffer.="
<div class="\"plugin_sos\"">$description not reachable.</div>
 
";
        }
        }
 
        } else {
            //Online
    if($img=="y"){
        // Mit Bild
        $src = DOKU_URL.'lib/plugins/sos/images/on.png';
        $buffer.="
<div class="\"plugin_sos\""><img src="%5C%22$src%5C%22" alt="\"($protocol\\$port)" $description\"="">$description</div>
 
";
        } else {
        // Ohne Bild
        if($description==""){
        $buffer.="
<div class="\"plugin_sos\"">$protocol\\$port $ip_addr is reachable.</div>
 
";
        } else {
        $buffer.="
<div class="\"plugin_sos\"">$description is reachable.</div>
 
";
        }
        }
 
            }
    fclose($status);
    }
    }
 
    return $buffer;
 
}
 
} ?>

Installation

Variante 1: Pluginmanager

Die URL vom Download in den Pluginmanager reinkopieren und Installieren anklicken.

Variante 2: Manuell

Den Inhalt des .tgz in lib/plugins kopieren. Einbinden in die Webseite Syntax

{{sos>protocol:ip_addr_oder_fqdn:port:img(y/n)|description}}

Empfehlenswert ist das Abschalten des Caches. Am Anfang der Webseite folgendes einfügen.

~~NOCACHE~~

Demo / Beispiele

Als Test verwende ich die IP-Adresse (FQDN) dieser Homepage und die Serviceports tcp/80 (vorhanden), tcp/801 (nicht vorhanden) und udp/53 (vorhanden), udp/3232 (nicht vorhanden). Nur Bild

{{sos>tcp:www.thoma.cc:80:y}}
{{sos>tcp:www.thoma.cc:801:y}}
{{sos>udp:www.thoma.cc:53:y}}
{{sos>udp:www.thoma.cc:3232:y}}

ergibt: y ( B, 0 downloads) y ( B, 0 downloads) y ( B, 0 downloads) y ( B, 0 downloads) Bild mit Beschreibung

{{sos>tcp:www.thoma.cc:80:y| www @ www.thoma.cc}}
{{sos>tcp:www.thoma.cc:801:y| xyz @ www.thoma.cc}}
{{sos>udp:www.thoma.cc:53:y| dns @ www.thoma.cc}}
{{sos>udp:www.thoma.cc:3232:y| zxy @ www.thoma.cc}}

ergibt: www @ www.thoma.cc ( B, 0 downloads) xyz @ www.thoma.cc ( B, 0 downloads) dns @ www.thoma.cc ( B, 0 downloads) zxy @ www.thoma.cc ( B, 0 downloads) Nur Text

{{sos>tcp:www.thoma.cc:80:n}}
{{sos>tcp:www.thoma.cc:801:n}}
{{sos>udp:www.thoma.cc:53:n}}
{{sos>udp:www.thoma.cc:3232:n}}

ergibt: n ( B, 0 downloads) n ( B, 0 downloads) n ( B, 0 downloads) n ( B, 0 downloads) Text mit Beschreibung

{{sos>tcp:www.thoma.cc:80:n| www @ www.thoma.cc}}
{{sos>tcp:www.thoma.cc:801:n| xyz @ www.thoma.cc}}
{{sos>udp:www.thoma.cc:53:n| dns @ www.thoma.cc}}
{{sos>udp:www.thoma.cc:3232:n| zxy @ www.thoma.cc}}

ergibt: www @ www.thoma.cc ( B, 0 downloads) xyz @ www.thoma.cc ( B, 0 downloads) dns @ www.thoma.cc ( B, 0 downloads) zxy @ www.thoma.cc ( B, 0 downloads)

Syntax

Usage:

{{sos>protocol:ip_addr:port:img(y/n)|Description}}

protocol: TCP (fully supported), UDP (experimental)

You could use this to display a green or red light for a web server:

{{sos>tcp:xxx.xxx.xxx.xxx:80:y}}
plugin/sos.txt · Last modified: 2015-04-04 06:21 by PatrickBrown

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki