Just installed a new Zabbix production server, and I was looking for integrated RSS support. Still cannot find that, but our company is using RSS feeds a lot on the old server. I thus moved my old RSS script to the new server. The script is not on this forum anymore it seems (at least not a version with minor security and the like). Therefore, for everyone who wants to use RSS feeds with their Zabbix installations, I put it here for the world to see 
I used some script, and added a login option to make it somewhat secure, just put the code below in a file (rss.php) and put that in a directory of its own. Make sure you change the $real_user and $real_pass variables to the login credentials you want for your feed.
Then make a file called db_connect.php in the same directory and make it look like this;
Ofcourse change this file so that it has the database login information for the Zabbix MySQL database.
Script is provided as-is, I take no resposibility for it whatsoever, mostly because I just copied and pasted from several scripts to get this working right (see the comments in the code for copyright information and such). I am however willing to support it if that is needed by any of you.

I used some script, and added a login option to make it somewhat secure, just put the code below in a file (rss.php) and put that in a directory of its own. Make sure you change the $real_user and $real_pass variables to the login credentials you want for your feed.
PHP Code:
<?
/**********************************************************************************
Modifications by Bert ter Beest. Also added some security. Change login information on setup!
For questions, please post on the Zabbix forum.
**********************************************************************************/
is_user_valid();
function is_user_valid() {
$auth=false;
if (isset( $_SERVER['PHP_AUTH_USER'] ) && isset($_SERVER['PHP_AUTH_PW'])) {
$real_user = "rss_username"; // setup a username for the RSS feed here
$real_pass = "rss_password"; //setup a password for the RSS feed here
if ($_SERVER['PHP_AUTH_PW'] == $real_pass and $_SERVER['PHP_AUTH_USER'] == $real_user) {
$auth = true;
}
}
if (!$auth) {
header( 'WWW-Authenticate: Basic realm="Infotune secure rss"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Authorization Required.';
exit();
}
}
// set the file's content type and character set
// this must be called before any output
header("Content-Type: text/xml;charset=utf-8");
/**********************************************************************************
* rss.php
* Version: 1.00
* Author: Rogers Cadenhead
* Date: 05/21/2004
* http://www.cadenhead.org/workbench/
*
**********************************************************************************
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This work is hereby released into the Public Domain. To view a copy of the public domain dedication, visit http://creativecommons.org/licenses/publicdomain/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
**********************************************************************************/
// prepare HTML text for use as UTF-8 character data in XML
function cleanText($intext) {
return utf8_encode(
htmlspecialchars(
stripslashes($intext)));
}
// retrieve database records
include('db_connect.php');
// the file db_connect.php contains only one line:
// $db = mysql_pconnect("localhost", "usernameHere", "passwordHere"); // it should be readable only by the user running the Web server // and saved outside of the directory tree that holds Web pages
if (!$db)
{
error_log("Error: Could not connect to database in rss.php.");
exit;
}
// store items from the database in the $result1 array mysql_select_db("zabbix");
$query1 = "select triggers.description description, items.lastvalue lastvalue, hosts.host host from triggers, functions, items, hosts where triggers.triggerid = functions.triggerid and items.itemid = functions.itemid and hosts.hostid = items.hostid and hosts.host like '%' and hosts.status=0 and triggers.value = 1";
$result1 = mysql_query($query1);
$phpversion = phpversion();
// display RSS 2.0 channel information
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<rss version=\"2.0\">
<channel>
<title>Current Triggers that are active</title>
<link>http://monitor.com.</link>
<description>Triggers Status</description>
<language>en-us</language>
<docs>http://backend.userland.com/rss</docs>
<generator>PHP/$phpversion</generator>";
// loop through the array pulling database fields for each item
for ($i = 0; $i < mysql_num_rows($result1); $i++) {
@$row = mysql_fetch_array($result1);
$trigger = cleanText($row["description"]);
$hostname = cleanText($row["host"]);
$value = cleanText($row["lastvalue"]);
$title = "Host: ".cleanText($row["host"])." Trigger: ".cleanText($row["description"])." Value: ".cleanText($row["lastvalue"]);
// display an item
echo "<item>
<title>$title</title>
<link>$trigger</link>
<description>$trigger</description>
<pubDate>$trigger</pubDate>
<guid isPermaLink=\"false\">$trigger</guid>
</item>";
}
echo "</channel></rss>";
?>
PHP Code:
<?php
$db = mysql_pconnect("localhost", "mysql_username", "mysql_password");
?>
Script is provided as-is, I take no resposibility for it whatsoever, mostly because I just copied and pasted from several scripts to get this working right (see the comments in the code for copyright information and such). I am however willing to support it if that is needed by any of you.
but it may be useful to somebody else.

Comment