Skip to content

Instantly share code, notes, and snippets.

<?php
//////////
// THIS FILE DUMPS THE DATA TO DATA FILE
// (c) Travis Mathis - travisdmathis@gmail.com
// Zabbix Report Generator v0.1
//
// INCLUDES
require_once("ZabbixAPI.class.php");
// ERROR REPORTING
<?php
foreach ($data as $line){
// go through each line, showing it as required, if it is surrounded by '<>' then
// assume that it is a title
$line=chop($line);
if (strlen($line) && $line[0]=='#'){
// comment, or new page request
switch($line){
case '#NP':
$pdf->ezNewPage();
<?php
//////////
// THIS FILE DUMPS THE DATA TO DATA FILE
// (c) Travis Mathis - travisdmathis@gmail.com
// Zabbix Report Generator v0.1
//
// INCLUDES
require_once("ZabbixAPI.class.php");
// ERROR REPORTING
<?php
ZabbixAPI::debugEnabled(TRUE);
ZabbixAPI::login($z_server,$z_user,$z_pass)
or die('Unable to login: '.print_r(ZabbixAPI::getLastError(),true));
//fetch graph data for single host
$hosts = ZabbixAPI::fetch_array('host','get',array('extendoutput'=>'shorten','select_graphs'=>'shorten','filter'=>array('host'=>$site)))
or die('Unable to get hostids: '.print_r(ZabbixAPI::getLastError(),true));
//echo "Hosts: ".print_r($hosts, true)."\n<br>";
foreach($hosts as $host) {
foreach($host as $ho) {
#!/bin/bash
#=========================================================
# Avaya PRI UP/Down Check
# Travis Mathis - travis.mathis@gdit.com
# Version 1.1
# Change Log: Moved Total Channels from seperate script 1/9/2012
#=========================================================
# VARIABLES
act='0'
// get graphids
// Login to Zabbix API using ZabbixAPI.class.php
ZabbixAPI::debugEnabled(TRUE);
ZabbixAPI::login($z_server,$z_user,$z_pass)
or die('Unable to login: '.print_r(ZabbixAPI::getLastError(),true));
//fetch graph data for single host
$hosts = ZabbixAPI::fetch_array('host','get',array('extendoutput'=>'shorten','select_graphs'=>'shorten','filter'=>array('host'=>$site)))
or die('Unable to get hostids: '.print_r(ZabbixAPI::getLastError(),true));
echo "Hosts: ".print_r($hosts, true)."\n<br>";
ZabbixAPI::debugEnabled(TRUE);
ZabbixAPI::login($z_server,$z_user,$z_pass)
or die('Unable to login: '.print_r(ZabbixAPI::getLastError(),true));
$hosts = ZabbixAPI::fetch_array('host','get',array('extendoutput'=>1,'filter'=>array('host'=>$site,'select_graphs')))
or die('Unable to get hostids: '.print_r(ZabbixAPI::getLastError(),true));
echo "Hosts: ".print_r($hosts, true)."\n<br>";
# OUTPUT
ZabbixAPI::debugEnabled(TRUE);
ZabbixAPI::login($z_server,$z_user,$z_pass)
or die('Unable to login: '.print_r(ZabbixAPI::getLastError(),true));
$hosts = ZabbixAPI::fetch_array('host','get',array('host'=>$site))
or die('Unable to get hostids: '.print_r(ZabbixAPI::getLastError(),true));
echo "Hosts: ".print_r($hosts, true)."\n<br>";
ZabbixAPI::debugEnabled(TRUE);
ZabbixAPI::login($z_server,$z_user,$z_pass)
or die('Unable to login: '.print_r(ZabbixAPI::getLastError(),true));
$hosts = ZabbixAPI::fetch_array('host','get',array('extendoutput'=>1, 'host'=>$site, 'select_graphs'))
or die('Unable to get hostids: '.print_r(ZabbixAPI::getLastError(),true));
echo "Hosts: ".print_r($hosts, true)."\n<br>";
select host,hostid,itemid,graphid,description from items left join graphs on graphs.graphid left join hosts on hosts.host limit 5;