Translations of this page:

ocs-inventory-ng

additional-hostinformation-wrapper

  • ocsnagios.php
  • abzulegen im ocsreports-Verzeichnis deines ocs-inventory-ng Servers
 define hostextinfo{
 host_name              server1
 notes_url              http://ocsserver/ocsnagios.php?host=$HOSTNAME$
 icon_image             help.png
 }
<?php
/*
 Author:    bbecker
 License:   GPL 2 (http://www.gnu.org/licenses/gpl.html)
 
 Testet with ocs-inventory-ng Version 1.02 
*/
 
// e.g. ocs-nagios.php?host=nagios-server
$host = $_GET['host'];
 
// http adress of you're ocs-inventory server
$ocs = "http://yourserver/ocsreports/";
 
// the machine.php, its may differs in you're system
$param = "machine.php?systemid=";
 
// alternativ http adress, if the machine is not in base
$alter = $ocs;
 
//mysql informations
$server = "localhost";
$user = "ocsuser";
$pw = "password";
$db = "ocsweb";
 
// and action
if($host!=""){
        $link = mysql_connect($server,$user,$pw) or die("Connection failed");
            mysql_select_db($db, $link) or die('Could not select database.');
        $query = "SELECT ID FROM hardware WHERE NAME='".$host."' LIMIT 1";
        $result = mysql_query($query) or die("Query failed");
        $result = mysql_fetch_assoc($result);
 
        if($result['ID'] != ""){
            header("Location: ".$ocs.$param.$result['ID']);
            exit;
        }
        else{
            header("Location: ".$alter);
            exit;
        }
}
?>
nagios/howtos/ocs-inventory-ng.txt · Zuletzt geändert: 2010/06/24 23:11 von rainbowwarrior
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0