pandorafms/pandora_console/operation/events/events_rss.php

77 lines
3.1 KiB
PHP
Raw Normal View History

<?php
// Pandora FMS - the Free monitoring system
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@openideas.info
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas
// Copyright (c) 2008 Evi Vanoost, vanooste@rcbi.rochester.edu
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation version 2
// 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. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
error_reporting(E_ALL);
require "../../include/config.php";
require "../../include/functions.php";
require "../../include/functions_db.php";
$constraints = "";
$sql="SELECT `tevento`.`id_evento` AS event_id, `tagente`.`nombre` AS agent_name, `tevento`.`id_usuario` AS validated_by , `tevento`.`estado` AS validated, `tevento`.`evento` AS event_descr , `tevento`.`utimestamp` AS unix_timestamp, `tgrupo`.`nombre` AS group_name, `tgrupo`.`icon` AS group_icon
FROM tevento, tagente, tgrupo
WHERE `tevento`.`id_agente` = `tagente`.`id_agente` AND `tevento`.`id_grupo` = `tgrupo`.`id_grupo` $constraints
ORDER BY utimestamp DESC
LIMIT 0 , 30";
$result=mysql_query($sql);
//$url = "https://".$_SERVER['HTTP_HOST']."/pandora_console";
$url = $config["homeurl"];
$rss_feed = '<?xml version="1.0" ?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel>
<title>Pandora RSS Feed</title>
<description>Latest events on Pandora</description>
<link>' . $url . '</link>
<atom:link href="' . $url . '/operation/events/events_rss.php" rel="self" type="application/rss+xml" />';
while($row=mysql_fetch_array($result,MYSQL_ASSOC)) {
//This is mandatory
$rss_feed .= '<item><guid>';
$rss_feed .= $url . "/operation/events/view_event?id=" . $row['event_id'];
$rss_feed .= '</guid><title>';
$rss_feed .= htmlentities($row['agent_name']);
$rss_feed .= '</title><description>';
$rss_feed .= htmlentities($row['event_descr']);
if($row['validated'] == 1) {
$rss_feed .= '<br /><br />Validated by ' . $row['validated_by'];
}
$rss_feed .= '</description><link>';
2008-06-13 Sancho Lerena <slerena@gmail.com> * index.php: Added pure (Fullscreen). HTML code cleanup and user session. * pandoradb.sql: talert_snmp: Added priority field. * pandoradb_data.sql: Changes default values in talerta. tconfig_os, tgrupo and some links. * header.php: Fixed some user session management. * logon_ok.php: New design for welcome screen, odometer is over. * menu.php, godmode/menu.php: Some ACL improvements. * agent_disk_conf_editor.php: Minor fix in view link. * configurar_agente.php, agent_manager.php: Added parent combo and better ACL checks. New remote configuration control for get timestamp info of config file. * modify_alert.php: Changes to use new internal Mail alert. * config.php: Some items moved to config_process. (font, attachment and default style). * functions.php: Added form_agent_combo(), form_event_type_combo(), form_priority() and return_priority() functions. * functions_db.php: Added smal_event_table() to render a variable table with latest events (filtered). * pandora.css. Added pure and priority colors. * estado_alertas.php: Fixed ACL problems. * stado_generalagente.php: Graph of modules now represents modules that has generated events. Old graph is not used anymore. Also display parent. * estado_grupo.php: Border of boxes is now thicker. * tactical.php: New screen, almost all code changed. Odometer is not used anymore, added some new items, like module LAG meter, module sanity, and other general metrics. * ver_agente.php: Now renders also event for each agent view. Alert manual validation generate a new event. * events.php: New event system. 90% new code. A LOT of new features, including full screen, coloured (by priority) and filters by six fields. * snmp_alert.php: Added support for alert priority. * operation/users/user.php: No longer a user with UM privileges could see any other user. * render_view.php: Added fullscreen support for visual maps. * fgraph.php: Added support for session checking in graphs (at least!). New graphics for events (some changed it's function like events by group), and feature added to progress GD implementation. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@860 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-13 18:59:54 +02:00
$rss_feed .= $url . "/operation/events/view_event?id=" . $row["event_id"];
$rss_feed .= '</link>';
//The rest is optional
$rss_feed .= '<pubDate>' . date(DATE_RFC822, $row['unix_timestamp']) . '</pubDate>';
$rss_feed .= '<image>';
$rss_feed .= '<link>' . $url . '</link>';
$rss_feed .= '<title>' . $row['group_name'] . '</title>';
$rss_feed .= '<url>' . $url . '/images/groups_small/' . $row['group_icon'] . '.png</url>';
$rss_feed .= '</image>';
//This is mandatory again
$rss_feed .= '</item>';
}
$rss_feed .= "</channel></rss>";
header("Content-Type: application/xml; charset=UTF-8");
echo $rss_feed;
?>