コード例 #1
0
ファイル: host.php プロジェクト: rockylo/MoZBX
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
require_once "cookies.php";
$zabbix = new Zabbix($arrSettings);
// Populate our class
$zabbix->setUsername($zabbixUser);
$zabbix->setPassword($zabbixPass);
$zabbix->setZabbixApiUrl($zabbixApi);
// Login
if (isset($zabbixAuthHash) && strlen($zabbixAuthHash) > 0) {
    // Try it with the authentication hash we have
    $zabbix->setAuthToken($zabbixAuthHash);
} elseif (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
    $zabbix->login();
}
if (!$zabbix->isLoggedIn()) {
    header("Location: index.php");
    exit;
}
require_once "template/header.php";
$zabbixHostId = (string) $_GET['hostid'];
$zabbixHostGroupId = (string) $_GET['groupid'];
$zabbixHostGroupName = (string) urldecode($_GET['groupname']);
if ($zabbixHostId > 0) {
    $host = $zabbix->getHostById($zabbixHostId);
    // Graphs
    $graphs = $zabbix->getGraphsByHostId($zabbixHostId);
    $graphs = $zabbix->sortGraphsByName($graphs);
コード例 #2
0
ファイル: feedback.php プロジェクト: rockylo/MoZBX
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
require_once "cookies.php";
$zabbix = new Zabbix($arrSettings);
// Populate our class
$zabbix->setUsername($zabbixUser);
$zabbix->setPassword($zabbixPass);
$zabbix->setZabbixApiUrl($zabbixApi);
// Login
if (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
    $zabbix->login();
}
if (!$zabbix->isLoggedIn()) {
    header("Location: index.php");
    exit;
}
$boolShowThankyou = false;
$boolShowFeedbackForm = true;
$boolShowTextlengthWarn = false;
if (isset($_POST['mZabbixFeedback'])) {
    // Process feedback
    $txtFeedback = htmlentities($_POST['txtFeedback']);
    if (strlen($txtFeedback) < 30) {
        // Don't bother, type more
        $boolShowTextlengthWarn = true;
        $boolShowThankyou = false;
        $boolShowFeedbackForm = true;
    } else {
コード例 #3
0
ファイル: hostgroups.php プロジェクト: rockylo/MoZBX
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
$zabbix = new Zabbix($arrSettings);
// Get values from cookies, if any
require_once "cookies.php";
// Populate our class
$zabbix->setUsername($zabbixUser);
$zabbix->setPassword($zabbixPass);
$zabbix->setZabbixApiUrl($zabbixApi);
// Login
if (isset($zabbixAuthHash) && strlen($zabbixAuthHash) > 0) {
    // Try it with the authentication hash we have
    $zabbix->setAuthToken($zabbixAuthHash);
} elseif (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
    // Or try it with our info from the cookies
    $zabbix->login();
}
if (!$zabbix->isLoggedIn()) {
    header("Location: index.php");
    exit;
}
require_once "template/header.php";
?>
<div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
        <ul class="breadcrumb">
            <li>
                <a href="index.php">Home</a> <span class="divider">/</span>
コード例 #4
0
ファイル: trigger_ack.php プロジェクト: rockylo/MoZBX
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
require_once "cookies.php";
$zabbix = new Zabbix($arrSettings);
// Populate our class
$zabbix->setUsername($zabbixUser);
$zabbix->setPassword($zabbixPass);
$zabbix->setZabbixApiUrl($zabbixApi);
// Login
if (isset($zabbixAuthHash) && strlen($zabbixAuthHash) > 0) {
    // Try it with the authentication hash we have
    $zabbix->setAuthToken($zabbixAuthHash);
} elseif (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
    $zabbix->login();
}
if (!$zabbix->isLoggedIn()) {
    header("Location: index.php");
    exit;
}
// Process the AJAX call of the form, if it exists
$ack_ok = false;
if (isset($_POST['type'])) {
    $post_type = $_POST['type'];
    switch ($post_type) {
        case "acknowledge":
            $zabbixEventId = array((string) $_POST['eventid']);
            $comment = addslashes(htmlspecialchars($_POST["comment"]));
            $zabbix->acknowledgeEvent($zabbixEventId, $comment);
コード例 #5
0
ファイル: about.php プロジェクト: rockylo/MoZBX
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
$zabbix = new Zabbix($arrSettings);
// Get values from cookies, if any
require_once "cookies.php";
// Populate our class
$zabbix->setUsername($zabbixUser);
$zabbix->setPassword($zabbixPass);
$zabbix->setZabbixApiUrl($zabbixApi);
// Login
if (isset($zabbixAuthHash) && strlen($zabbixAuthHash) > 0) {
    // Try it with the authentication hash we have
    $zabbix->setAuthToken($zabbixAuthHash);
} elseif (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
    // Or try it with our info from the cookies
    $zabbix->login();
}
if (!$zabbix->isLoggedIn()) {
    header("Location: index.php");
    exit;
}
require_once "template/header.php";
if ($zabbix->isLoggedIn()) {
    // Retrieve the data in one go
    $zabbix_auth = $zabbix->getAuthToken();
    $zabbix_version = $zabbix->getVersion();
}
?>
コード例 #6
0
ファイル: trigger_info.php プロジェクト: rockylo/MoZBX
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
require_once "cookies.php";
$zabbix = new Zabbix($arrSettings);
// Populate our class
$zabbix->setUsername($zabbixUser);
$zabbix->setPassword($zabbixPass);
$zabbix->setZabbixApiUrl($zabbixApi);
// Login
if (isset($zabbixAuthHash) && strlen($zabbixAuthHash) > 0) {
    // Try it with the authentication hash we have
    $zabbix->setAuthToken($zabbixAuthHash);
} elseif (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
    $zabbix->login();
}
if (!$zabbix->isLoggedIn()) {
    header("Location: index.php");
    exit;
}
require_once "template/header.php";
$zabbixTriggerId = (string) $_GET['triggerid'];
$zabbixHostId = (string) $_GET['hostid'];
if ($zabbixTriggerId > 0 && $zabbixHostId > 0) {
    // Retrieve the trigger information
    $trigger = $zabbix->getTriggerByTriggerAndHostId($zabbixTriggerId, $zabbixHostId);
    $host = $zabbix->getHostById($zabbixHostId);
    $events = $zabbix->getEventsByTriggerAndHostId($zabbixTriggerId, $zabbixHostId);
    ?>
コード例 #7
0
ファイル: activetriggers.php プロジェクト: rockylo/MoZBX
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
$zabbix = new Zabbix($arrSettings);
// Get values from cookies, if any
require_once "cookies.php";
// Populate our class
$zabbix->setUsername($zabbixUser);
$zabbix->setPassword($zabbixPass);
$zabbix->setZabbixApiUrl($zabbixApi);
// Login
if (isset($zabbixAuthHash) && strlen($zabbixAuthHash) > 0) {
    // Try it with the authentication hash we have
    $zabbix->setAuthToken($zabbixAuthHash);
} elseif (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
    // Or try it with our info from the cookies
    $zabbix->login();
}
if (!$zabbix->isLoggedIn()) {
    header("Location: index.php");
    exit;
}
require_once "template/header.php";
// Get all active triggers (for the counter on homepage);
$triggersActive = $zabbix->getTriggersActive($arrSettings["minimalSeverity"]);
if (!is_array($triggersActive)) {
    $triggersActive = array();
}
?>
コード例 #8
0
ファイル: index.php プロジェクト: rockylo/MoZBX
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
/* Include the basic header/css/... */
require_once "template/header.php";
// Main Zabbix object
$zabbix = new Zabbix($arrSettings);
// Login
if (!$arrSettings["promptCredentials"]) {
    // Login using supplied credentials from the config.php file
    $zabbix->login();
} else {
    // It's a hosted version, perhaps we can recover username & password from cookies?
    $zabbixApi = "";
    $zabbixUser = "";
    $zabbixPass = "";
    // Get the values
    require_once "cookies.php";
    // Populate our class
    $zabbix->setUsername($zabbixUser);
    $zabbix->setPassword($zabbixPass);
    $zabbix->setZabbixApiUrl($zabbixApi);
    // Login
    if (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
        $zabbix->login();
    }
}
//$zabbix->Login("mattias_api", "test");
if ($zabbix->isLoggedIn()) {
コード例 #9
0
<?php

require_once 'config.php';
require_once "MimeMailParser.class.php";
if (empty($_GET['id'])) {
    echo "Email ID Required";
    die;
}
$eid = $_GET['id'];
if (!empty($_GET['action'])) {
    $action = $_GET['action'];
    require_once 'Zabbix.php';
    $zabbix = new Zabbix(array('host' => $ZABBIX_HOST));
    $sql = "SELECT * FROM email_tracker.email_schedule WHERE id = " . mysql_real_escape_string($eid);
    $results = mysql_query($sql, $db);
    $row = mysql_fetch_assoc($results);
    if (empty($row)) {
        echo "Schedule Not Found!";
        die;
    }
    switch ($action) {
        case "ack":
            $zabbix->check('email.mon[' . $eid . ']', 'OK', $row['zabbix_host']);
            echo $row['name'] . " Has been flagged as ok";
            break;
    }
    die;
}
if (!file_exists($EMAIL_STORE . $eid)) {
    echo "Email Not Found";
    die;
コード例 #10
0
ファイル: graph_img.php プロジェクト: rockylo/MoZBX
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
require_once "cookies.php";
$arrSettings["zabbixApiUrl"] = str_replace("api_jsonrpc.php", "", $zabbixApi);
$zabbix = new Zabbix($arrSettings);
// Populate our class
$zabbix->setUsername($zabbixUser);
$zabbix->setPassword($zabbixPass);
$zabbix->setZabbixApiUrl($zabbixApi);
// Login
if (isset($zabbixAuthHash) && strlen($zabbixAuthHash) > 0) {
    // Try it with the authentication hash we have
    $zabbix->setAuthToken($zabbixAuthHash);
} elseif (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
    $zabbix->login();
}
if (!$zabbix->isLoggedIn()) {
    header("Location: index.php");
    exit;
}
$graphid = (string) $_GET['graphid'];
$graphperiod = (string) $_GET['period'];
// Set correct header
header("Content-Type: image/jpg");
// Read the file & output
print $zabbix->getGraphImageById($graphid, $graphperiod);
コード例 #11
0
ファイル: graph.php プロジェクト: rockylo/MoZBX
<?php

require_once "config.inc.php";
require_once "functions.php";
require_once "class_zabbix.php";
require_once "cookies.php";
$arrSettings["zabbixApiUrl"] = str_replace("api_jsonrpc.php", "", $zabbixApi);
$zabbix = new Zabbix($arrSettings);
// Populate our class
$zabbix->setUsername($zabbixUser);
$zabbix->setPassword($zabbixPass);
$zabbix->setZabbixApiUrl($zabbixApi);
// Login
if (isset($zabbixAuthHash) && strlen($zabbixAuthHash) > 0) {
    // Try it with the authentication hash we have
    $zabbix->setAuthToken($zabbixAuthHash);
} elseif (strlen($zabbix->getUsername()) > 0 && strlen($zabbix->getPassword()) > 0 && strlen($zabbix->getZabbixApiUrl()) > 0) {
    $zabbix->login();
}
if (!$zabbix->isLoggedIn()) {
    header("Location: index.php");
    exit;
}
require_once "template/header.php";
$zabbixGraphId = (string) $_GET['graphid'];
$zabbixGraphPeriod = (string) $_GET['period'];
$zabbixHostId = (string) $_GET['hostid'];
$zabbixHostGroupId = (string) $_GET['groupid'];
$zabbixHostGroupName = (string) urldecode($_GET['groupname']);
$zabbixHostName = (string) urldecode($_GET['hostname']);
$urlParameters = "hostid=" . $zabbixHostId . "&hostname=" . $zabbixHostName . "&groupid=" . $zabbixHostGroupId . "&groupname=" . urlencode($zabbixHostGroupName);