[packages/cacti-plugin-npc] - up to 2.0.4
glen
glen at pld-linux.org
Thu Nov 22 21:19:01 CET 2012
commit 9e291d54dcb118678bf065ff6c9a0e5c6f378e58
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Thu Nov 22 22:18:36 2012 +0200
- up to 2.0.4
major version change, depends on nagios ndoutils now
cacti-plugin-npc-extinfo.patch | 2949 -----------------------------------
cacti-plugin-npc-path_headers.patch | 28 -
cacti-plugin-npc.spec | 88 +-
3 files changed, 43 insertions(+), 3022 deletions(-)
---
diff --git a/cacti-plugin-npc.spec b/cacti-plugin-npc.spec
index a78d203..68ee8a4 100644
--- a/cacti-plugin-npc.spec
+++ b/cacti-plugin-npc.spec
@@ -1,74 +1,72 @@
# TODO
-# - Edit the MySQL options on line 143 of /cacti/plugins/npc/neb/inserter.c
+# - system Doctrine: phpdoctrine.spec
+# - forum thread: http://forums.cacti.net/viewtopic.php?t=26540
%define plugin npc
-%include /usr/lib/rpm/macros.perl
-Summary: Plugin for Cacti - NPC
+%define php_min_version 5.2.1
+%include /usr/lib/rpm/macros.php
+Summary: Nagios Plugin for Cacti (NPC)
Summary(pl.UTF-8): Wtyczka do Cacti - NPC
Name: cacti-plugin-npc
-Version: 0.1.1a
+Version: 2.0.4
Release: 0.2
-License: GPL v2
+License: GPL v3
Group: Applications/WWW
-Source0: http://forums.cacti.net/files/%{plugin}-%{version}.tar.gz
-# Source0-md5: 325f2e49070420346b55b7b4e2994d34
-Patch0: %{name}-path_headers.patch
-# inserter.c patch for nagios 3.0b6 from http://forums.cacti.net/about10327-0-asc-150.html
-#Patch1: http://forums.cacti.net/files/neb_159.patch
-# from http://forums.cacti.net/about10327-0-asc-135.html
-Patch1: %{name}-extinfo.patch
-URL: http://forums.cacti.net/about10327.html
-BuildRequires: glib2-devel
-BuildRequires: mysql-devel >= 4.1.0
-BuildRequires: nagios-devel >= 2.1
-BuildRequires: pkgconfig
-BuildRequires: rpm-perlprov
-Requires: cacti >= 0.8.6h
-Requires: nagios >= 2.1
+#Source0: http://downloads.sourceforge.net/gibtmirdas/npc-%{version}.tar.gz
+Source0: npc-%{version}.tar.gz
+# Source0-md5: 7b30302c544f10ed73cff406fda14499
+URL: https://trac.assembla.com/npc/
+BuildRequires: rpmbuild(macros) >= 1.553
+Requires: cacti >= 0.8.7b
+Requires: cacti(pia) >= 2.0
+Requires: nagios >= 3.0
+Requires: php-common >= 4:%{php_min_version}
+Requires: php-ctype
+Requires: nagios-ndoutils >= 1.4b7
+Requires: php-date
+Requires: php-iconv
+Requires: php-json
+Requires: php-mbstring
+Requires: php-mysql
+Requires: php-mysqli
+Requires: php-pcre
+Requires: php-session
+Requires: php-simplexml
+Requires: php-spl
+BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define cactidir /usr/share/cacti
%define plugindir %{cactidir}/plugins/%{plugin}
%define moduledir %{_libdir}/nagios/modules
+%define _noautoreq pear
+
%description
-Plugin for Cacti - A UI replacement for Nagios integrated into Cacti.
+The purpose of NPC is to be a complete web based UI replacement to
+Nagios while fully integrating into Cacti using the Cacti Plugin
+Architecture. This integration will provide a single point of access
+for trending and alert monitoring.
%description -l pl.UTF-8
Wtyczka do Cacti - zamiennik interfejsu użytkownika dla Nagiosa
zintegrowany z Cacti.
%prep
-%setup -q -n %{plugin}
-%patch0 -p1
-%patch1 -p1
-
-%build
-cd neb
-%{__cc} %{rpmcflags} -Wall -o inserter.o inserter.c -shared -I../include $(pkg-config glib-2.0 --cflags) $(mysql_config --cflags --libs) -fPIC
+%setup -qc
+mv %{plugin}/*.debug .
+mv %{plugin}/build.xml .
+mv %{plugin}/{README,LICENSE} .
+%undos -f php README
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{plugindir},%{moduledir}}
-install neb/inserter.o $RPM_BUILD_ROOT%{moduledir}
-cp -a . $RPM_BUILD_ROOT%{plugindir}
-rm -rf $RPM_BUILD_ROOT%{plugindir}/neb
-
-# Edit nagios.cfg and set:
-#
-# retain_state_information=0
-# event_broker_options=-1
-# broker_module=%{moduledir}/inserter.o
-
-# Setting retain_state_information=0 causes all hosts and services to
-# go to a pending state until rechecked by Nagios. Without this setting
-# the inserter module will never update any data in NPC. Its a minor
-# inconvenience that I will try to fix in the inserter module.
+install -d $RPM_BUILD_ROOT%{plugindir}
+cp -a %{plugin}/* $RPM_BUILD_ROOT%{plugindir}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc TODO README
+%doc README
%{plugindir}
-%attr(755,root,root) %{moduledir}/inserter.o
diff --git a/cacti-plugin-npc-extinfo.patch b/cacti-plugin-npc-extinfo.patch
deleted file mode 100644
index 4f59a67..0000000
--- a/cacti-plugin-npc-extinfo.patch
+++ /dev/null
@@ -1,2949 +0,0 @@
---- npc/extinfo.php.orig 2005-10-10 14:17:15.000000000 +0000
-+++ npc/extinfo.php 2006-12-26 16:32:52.000000000 +0000
-@@ -1,1473 +1,1473 @@
--<?php
--/*
-- +-------------------------------------------------------------------------+
-- | Nagios Plugin 0.1a for cacti 0.8.6f |
-- | Copyright (C) 2005 Billy Gunn (billy at gunn.org) |
-- | |
-- | 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; either version 2 |
-- | of the License, or (at your option) any later version. |
-- | |
-- | 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. |
-- +-------------------------------------------------------------------------+
-- | Cacti and Nagios are the copyright of their respective owners. |
-- +-------------------------------------------------------------------------+
--*/
--
--chdir('../../');
--include_once("./include/auth.php");
--include_once("./include/config.php");
--
--// Refresh the page at a user supplied interval
--header("Refresh: " . read_config_option("npc_refresh") . "; URL=" . $_SERVER["REQUEST_URI"]);
--
--/* set default action */
--if (!isset($_REQUEST["type"])) { $_REQUEST["type"] = ""; }
--
--switch ($_REQUEST["type"]) {
-- case '1':
--
-- hostInfo();
-- include_once("./include/bottom_footer.php");
-- break;
--
-- case '2':
--
-- serviceInfo();
-- include_once("./include/bottom_footer.php");
-- break;
--
-- default:
--
-- hostInfo();
-- include_once("./include/bottom_footer.php");
-- break;
--}
--
--
--function formatTime($time) {
--
-- $days = floor($time/60/60/24);
-- $time -= $days*60*60*24;
-- $hours = floor($time/60/60);
-- $time -= $hours*60*60;
-- $minutes = floor($time/60);
-- $time -= $minutes*60;
-- $seconds = $time;
--
-- return ($days . "d " . $hours . "h " . $minutes . "m " . $seconds . "s");
--}
--
--
--function serviceInfo() {
--
-- $hostid = $_REQUEST["hostid"];
-- $serviceid = $_REQUEST["serviceid"];
-- $hostname = $_REQUEST["hostname"];
-- $serviceName = ereg_replace("\+", " ", $_REQUEST["service"]);
--
--
-- if (isset($_POST["local_graph_id"])) {
-- db_execute("update npc_service set cacti_graph_id = " . $_POST["local_graph_id"] . " where id = " . $serviceid);
-- header("Location: extinfo.php?type=2&hostid=" . $hostid . "&hostname=" . $hostname . "&serviceid=" . $serviceid . "&service=" . $_REQUEST["service"]);
-- }
--
-- include_once("top_npc_header.php");
--
-- $background1 = "#F5F5F5";
-- $background2 = "#E7E9F2";
-- $rowColor = $background1;
--
-- $service_detail = db_fetch_row("
--select distinct
-- service_soft_state as 'Current Status',
-- duration as 'State Duration',
-- check_command as 'Check Command',
-- plugin_output as 'Plugin Output',
-- performance_data as 'Performance Data',
-- current_attempt as 'Current Attempt',
-- from_unixtime(last_check) as 'Last Check',
-- from_unixtime(next_check) as 'Next Check',
-- check_latency as 'Check Latency',
-- check_execute_time as 'Check Duration',
-- hostid,
-- name,
-- host_soft_state as 'Host Soft State',
-- host_notifications as 'Host Notifications',
-- service as 'Service',
-- cacti_graph_id,
-- serviceid,
-- service_hard_state,
-- service_notifications as 'Service Notifications',
-- max_attempts as 'Max Attempts'
--from
-- (
-- select
-- npc_host.id as hostid,
-- npc_host.name,
-- npc_hostgroup_membership.groupid as hostgroup,
-- npc_host_history.soft_state as host_soft_state,
-- npc_host.notifications_enabled as host_notifications,
-- npc_service.id as serviceid,
-- npc_service.cacti_graph_id,
-- npc_service.service_description as service,
-- npc_service_history.soft_state as service_soft_state,
-- npc_service_history.hard_state as service_hard_state,
-- npc_service.notifications_enabled as service_notifications,
-- npc_service_check.last_check,
-- npc_service_check.next_check,
-- npc_service_check.check_execute_time,
-- npc_service_check.check_latency,
-- npc_service_check.check_command,
-- npc_service_check.performance_data,
-- unix_timestamp() - npc_service_history.started as duration,
-- npc_service_history.current_attempt,
-- npc_service_check.max_attempts,
-- npc_service_history.plugin_output
-- from
-- npc_host,
-- npc_host_history,
-- npc_hostgroup_membership,
-- npc_service,
-- npc_service_check,
-- npc_service_history
-- where
-- npc_host.id = npc_hostgroup_membership.hostid and
-- npc_host.id = npc_service.hostid and
-- npc_host.id = npc_host_history.hostid and
-- npc_service.id = npc_service_check.serviceid and
-- npc_service.id = npc_service_history.serviceid and
-- npc_service_history.lasted is null and
-- npc_host_history.lasted is null and
-- npc_service.configured = TRUE and
-- npc_service.has_been_checked = TRUE and
-- npc_host.has_been_checked = TRUE
-- union
-- select
-- npc_host.id as hostid,
-- npc_host.name,
-- 0 as hostgroup,
-- npc_host_history.soft_state as host_soft_state,
-- npc_host.notifications_enabled as host_notifications,
-- npc_service.id as serviceid,
-- npc_service.cacti_graph_id,
-- npc_service.service_description as service,
-- npc_service_history.soft_state as service_soft_state,
-- npc_service_history.hard_state as service_hard_state,
-- npc_service.notifications_enabled as service_notifications,
-- npc_service_check.last_check,
-- npc_service_check.next_check,
-- npc_service_check.check_execute_time,
-- npc_service_check.check_latency,
-- npc_service_check.check_command,
-- npc_service_check.performance_data,
-- unix_timestamp() - npc_service_history.started as duration,
-- npc_service_history.current_attempt,
-- npc_service_check.max_attempts,
-- npc_service_history.plugin_output
-- from
-- npc_host,
-- npc_host_history,
-- npc_service,
-- npc_service_check,
-- npc_service_history
-- where
-- npc_host.id not in (select hostid from npc_hostgroup_membership) and
-- npc_host.id = npc_service.hostid and
-- npc_host.id = npc_host_history.hostid and
-- npc_service.id = npc_service_check.serviceid and
-- npc_service.id = npc_service_history.serviceid and
-- npc_service_history.lasted is null and
-- npc_host_history.lasted is null and
-- npc_service.configured = TRUE and
-- npc_service.has_been_checked = TRUE and
-- npc_host.has_been_checked = TRUE
-- union
-- select
-- npc_host.id as hostid,
-- npc_host.name,
-- npc_hostgroup_membership.groupid as hostgroup,
-- -1 as host_soft_state,
-- npc_host.notifications_enabled as host_notifications,
-- npc_service.id as serviceid,
-- npc_service.cacti_graph_id,
-- npc_service.service_description as service,
-- npc_service_history.soft_state as service_soft_state,
-- npc_service_history.hard_state as service_hard_state,
-- npc_service.notifications_enabled as service_notifications,
-- npc_service_check.last_check,
-- npc_service_check.next_check,
-- npc_service_check.check_execute_time,
-- npc_service_check.check_latency,
-- npc_service_check.check_command,
-- npc_service_check.performance_data,
-- unix_timestamp() - npc_service_history.started as duration,
-- npc_service_history.current_attempt,
-- npc_service_check.max_attempts,
-- npc_service_history.plugin_output
-- from
-- npc_host,
-- npc_hostgroup_membership,
-- npc_service,
-- npc_service_check,
-- npc_service_history
-- where
-- npc_host.id = npc_hostgroup_membership.hostid and
-- npc_host.id = npc_service.hostid and
-- npc_service.id = npc_service_check.serviceid and
-- npc_service.id = npc_service_history.serviceid and
-- npc_service_history.lasted is null and
-- npc_service.configured = TRUE and
-- npc_service.has_been_checked = TRUE and
-- npc_host.has_been_checked = FALSE
-- union
-- select
-- npc_host.id as hostid,
-- npc_host.name,
-- 0 as hostgroup,
-- -1 as host_soft_state,
-- npc_host.notifications_enabled as host_notifications,
-- npc_service.id as serviceid,
-- npc_service.cacti_graph_id,
-- npc_service.service_description as service,
-- npc_service_history.soft_state as service_soft_state,
-- npc_service_history.hard_state as service_hard_state,
-- npc_service.notifications_enabled as service_notifications,
-- npc_service_check.last_check,
-- npc_service_check.next_check,
-- npc_service_check.check_execute_time,
-- npc_service_check.check_latency,
-- npc_service_check.check_command,
-- npc_service_check.performance_data,
-- unix_timestamp() - npc_service_history.started as duration,
-- npc_service_history.current_attempt,
-- npc_service_check.max_attempts,
-- npc_service_history.plugin_output
-- from
-- npc_host,
-- npc_service,
-- npc_service_check,
-- npc_service_history
-- where
-- npc_host.id not in (select hostid from npc_hostgroup_membership) and
-- npc_host.id = npc_service.hostid and
-- npc_service.id = npc_service_check.serviceid and
-- npc_service.id = npc_service_history.serviceid and
-- npc_service_history.lasted is null and
-- npc_service.configured = TRUE and
-- npc_service.has_been_checked = TRUE and
-- npc_host.has_been_checked = FALSE
-- union
-- select
-- npc_host.id as hostid,
-- npc_host.name,
-- npc_hostgroup_membership.groupid as hostgroup,
-- npc_host_history.soft_state as host_soft_state,
-- npc_host.notifications_enabled as host_notifications,
-- npc_service.id as serviceid,
-- npc_service.cacti_graph_id,
-- npc_service.service_description as service,
-- -1 as service_soft_state,
-- -1 as service_hard_state,
-- npc_service.notifications_enabled as service_notifications,
-- npc_service_check.last_check,
-- npc_service_check.next_check,
-- npc_service_check.check_execute_time,
-- npc_service_check.check_latency,
-- npc_service_check.check_command,
-- npc_service_check.performance_data,
-- 0 as duration,
-- 0 as current_attempt,
-- npc_service_check.max_attempts,
-- null as plugin_output
-- from
-- npc_host,
-- npc_host_history,
-- npc_hostgroup_membership,
-- npc_service,
-- npc_service_check
-- where
-- npc_host.id = npc_hostgroup_membership.hostid and
-- npc_host.id = npc_service.hostid and
-- npc_host.id = npc_host_history.hostid and
-- npc_service.id = npc_service_check.serviceid and
-- npc_host_history.lasted is null and
-- npc_service.configured = TRUE and
-- npc_service.has_been_checked = FALSE and
-- npc_host.has_been_checked = TRUE
-- union
-- select
-- npc_host.id as hostid,
-- npc_host.name,
-- 0 as hostgroup,
-- npc_host_history.soft_state as host_soft_state,
-- npc_host.notifications_enabled as host_notifications,
-- npc_service.id as serviceid,
-- npc_service.cacti_graph_id,
-- npc_service.service_description as service,
-- -1 as service_soft_state,
-- -1 as service_hard_state,
-- npc_service.notifications_enabled as service_notifications,
-- npc_service_check.last_check,
-- npc_service_check.next_check,
-- npc_service_check.check_execute_time,
-- npc_service_check.check_latency,
-- npc_service_check.check_command,
-- npc_service_check.performance_data,
-- 0 as duration,
-- 0 as current_attempt,
-- npc_service_check.max_attempts,
-- null as plugin_output
-- from
-- npc_host,
-- npc_host_history,
-- npc_service,
-- npc_service_check
-- where
-- npc_host.id not in (select hostid from npc_hostgroup_membership) and
-- npc_host.id = npc_service.hostid and
-- npc_host.id = npc_host_history.hostid and
-- npc_service.id = npc_service_check.serviceid and
-- npc_host_history.lasted is null and
-- npc_service.configured = TRUE and
-- npc_service.has_been_checked = FALSE and
-- npc_host.has_been_checked = TRUE
-- union
-- select
-- npc_host.id as hostid,
-- npc_host.name,
-- npc_hostgroup_membership.groupid as hostgroup,
-- -1 as host_soft_state,
-- npc_host.notifications_enabled as host_notifications,
-- npc_service.id as serviceid,
-- npc_service.cacti_graph_id,
-- npc_service.service_description as service,
-- -1 as service_soft_state,
-- -1 as service_hard_state,
-- npc_service.notifications_enabled as service_notifications,
-- npc_service_check.last_check,
-- npc_service_check.next_check,
-- npc_service_check.check_execute_time,
-- npc_service_check.check_latency,
-- npc_service_check.check_command,
-- npc_service_check.performance_data,
-- 0 as duration,
-- 0 as current_attempt,
-- npc_service_check.max_attempts,
-- null as plugin_output
-- from
-- npc_host,
-- npc_hostgroup_membership,
-- npc_service,
-- npc_service_check
-- where
-- npc_host.id = npc_hostgroup_membership.hostid and
-- npc_host.id = npc_service.hostid and
-- npc_service.id = npc_service_check.serviceid and
-- npc_service.configured = TRUE and
-- npc_service.has_been_checked = FALSE and
-- npc_host.has_been_checked = FALSE
-- union
-- select
-- npc_host.id as hostid,
-- npc_host.name,
-- 0 as hostgroup,
-- -1 as host_soft_state,
-- npc_host.notifications_enabled as host_notifications,
-- npc_service.id as serviceid,
-- npc_service.cacti_graph_id,
-- npc_service.service_description as service,
-- -1 as service_soft_state,
-- -1 as service_hard_state,
-- npc_service.notifications_enabled as service_notifications,
-- npc_service_check.last_check,
-- npc_service_check.next_check,
-- npc_service_check.check_execute_time,
-- npc_service_check.check_latency,
-- npc_service_check.check_command,
-- npc_service_check.performance_data,
-- 0 as duration,
-- 0 as current_attempt,
-- npc_service_check.max_attempts,
-- null as plugin_output
-- from
-- npc_host,
-- npc_service,
-- npc_service_check
-- where
-- npc_host.id not in (select hostid from npc_hostgroup_membership) and
-- npc_host.id = npc_service.hostid and
-- npc_service.id = npc_service_check.serviceid and
-- npc_service.configured = TRUE and
-- npc_service.has_been_checked = FALSE and
-- npc_host.has_been_checked = FALSE
-- order by
-- name
-- ) as host_details where hostid = $hostid and service = '$serviceName'");
--
-- $service_detail["flapping"] = db_fetch_cell("select id from npc_flapping_service where id = $serviceid");
-- $service_config = db_fetch_row("select active_checks_enabled, passive_checks_enabled, event_handler_enabled, flap_detection_enabled, notifications_enabled, failure_prediction_enabled, process_performance_data, obsess_over_service, event_handler from npc_service where hostid = $hostid and service_description = '$serviceName'");
-- $comments = db_fetch_assoc("select id,serviceid,timestamp,author,comment,persist,type from npc_comment where serviceid = '$serviceid'");
-- $row_count = count($comments);
--
--?>
--
--
--
--
-- <table width="98%" border="0" cellpadding="0" cellspacing="0" align="center">
-- <tr class="textSubHeaderDark" bgcolor='#6d88ad'>
-- <td>
-- <h2> [ <?php echo $serviceName; ?> ] on
-- <a href="extinfo.php?type=1&hostid=<?php echo $hostid; ?>&hostname=<?php echo $hostname; ?>"><?php echo $hostname; ?></a></h2>
-- </td>
-- <td align='right' nowrap>
-- <FORM NAME="cl" ACTION="command.php" method="POST">Command:
-- <INPUT TYPE='hidden' NAME='host' VALUE='<?php echo $hostname; ?>'>
-- <INPUT TYPE='hidden' NAME='hostid' VALUE='<?php echo $service_detail["hostid"]; ?>'>
-- <INPUT TYPE='hidden' NAME='service' VALUE='<?php echo $serviceName; ?>'>
-- <INPUT TYPE='hidden' NAME='serviceid' VALUE='<?php echo $service_detail["serviceid"]; ?>'>
-- <select name="command" size="1">
--
--<?php
-- if (read_config_option("nagios_commands")) {
--
-- echo "<OPTION VALUE='NULL'>Execute a command</option>";
--
-- if ($service_config["active_checks_enabled"]) {
-- echo "<strong><OPTION VALUE='DISABLE_SVC_CHECK'>Disable active checks</option></strong>";
-- echo "<OPTION VALUE='SCHEDULE_SVC_CHECK'>Re-schedule the next check</option>";
-- } else {
-- echo "<OPTION VALUE='ENABLE_SVC_CHECK'>Enable Active Checks</option>";
-- }
-- if ($service_config["passive_checks_enabled"]) {
-- echo "<OPTION VALUE='PROCESS_SVC_CHECK_RESULT'>Submit passive check result</option>";
-- echo "<OPTION VALUE='DISABLE_PASSIVE_SVC_CHECKS'>Stop accepting passive checks</option>";
-- } else {
-- echo "<OPTION VALUE='ENABLE_PASSIVE_SVC_CHECKS'>Start accepting passive checks</option>";
-- }
-- if ($service_config["obsess_over_service"]) {
-- echo "<OPTION VALUE='STOP_OBSESSING_OVER_SVC'>Stop obsessing</option>";
-- } else {
-- echo "<OPTION VALUE='START_OBSESSING_OVER_SVC'>Start obsessing</option>";
-- }
-- if ($service_detail["Current Status"] == 1 || $service_detail["Current Status"] == 2 || $service_detail["Current Status"] == 3 && $service_detail["Current Status"] == $service_detail["service_hard_state"]) {
-- if (!db_fetch_cell("select * from npc_comment where serviceid = $serviceid and type = 4;")) {
-- echo "<OPTION VALUE='ACKNOWLEDGE_SVC_PROBLEM'>Acknowledge This Service Problem</option>";
-- } elseif (db_fetch_cell("select * from npc_comment where serviceid = $serviceid and type = 4;")) {
-- echo "<OPTION VALUE='REMOVE_SVC_ACKNOWLEDGEMENT'>Remove Problem Acknowledgement</option>";
-- }
-- }
-- if ($service_config["notifications_enabled"]) {
-- echo "<OPTION VALUE='DISABLE_SVC_NOTIFICATIONS'>Disable Notifications</option>";
-- if ($service_detail["Current Status"] != 0) {
-- echo "<OPTION VALUE='DELAY_SVC_NOTIFICATION'>Delay Next Service Notification</option>";
-- }
-- } else {
-- echo "<OPTION VALUE='ENABLE_SVC_NOTIFICATIONS'>Enable Notifications</option>";
-- }
-- echo "<OPTION VALUE='SCHEDULE_SVC_DOWNTIME'>Schedule Downtime</option>";
-- if ($service_config["event_handler_enabled"]) {
-- echo "<OPTION VALUE='DISABLE_SVC_EVENT_HANDLER'>Disable Event Handler</option>";
-- } else {
-- echo "<OPTION VALUE='ENABLE_SVC_EVENT_HANDLER'>Enable Event Handler</option>";
-- }
-- if ($service_config["flap_detection_enabled"]) {
-- echo "<OPTION VALUE='DISABLE_SVC_FLAP_DETECTION'>Disable Flap Detection</option>";
-- } else {
-- echo "<OPTION VALUE='ENABLE_SVC_FLAP_DETECTION'>Enable Flap Detection</option>";
-- }
-- echo "<OPTION VALUE='ADD_SVC_COMMENT'>Add Service Comment</option>";
-- echo "<OPTION VALUE='DEL_ALL_SVC_COMMENTS'>Delete All Service Comments</option>";
-- } else {
-- echo "<OPTION VALUE=''>Command execution disabled</option>";
-- }
--?>
--
-- </select>
-- <input type='image' src='../../images/button_go.gif' alt='Go' value='Execute' align='absmiddle'>
-- </form>
--
--
-- </td>
-- </tr>
--
-- <tr><td> </td><td> </td></tr>
-- <tr>
-- <td valign="top">
-- <table width="100%" border="0" align="left" valign="top">
-- <thead>
-- <tr class="textHeaderDark" bgcolor='#00438C'>
-- <td align="center"><strong>Service State Information</strong></td>
-- </tr>
-- </thead>
-- <tbody>
-- <tr>
-- <td width="100%" valign="top">
-- <table width="100%" align="center" cellpadding="3">
-- <thead>
-- <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-- <td>Parameter</td>
-- <td>Value</td>
-- </tr>
-- </thead>
-- <tbody>
--
--
--<?php
--
--
-- foreach ($service_detail as $key => $value) {
--
--
-- switch($key)
-- {
-- case "Current Status":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- switch($value)
-- {
-- case "-1":
-- echo "<td class='statusPENDING'><strong>PENDING</strong></td>";
-- break;
-- case "0":
-- echo "<td class='statusOK'><strong>OK</strong></td>";
-- break;
-- case "1":
-- echo "<td class='statusWARNING'><strong>WARNING</strong></td>";
-- break;
-- case "2":
-- echo "<td class='statusCRITICAL'><strong>CRITICAL</strong></td>";
-- break;
-- case "3":
-- echo "<td class='statusUNKNOWN'><strong>UNKNOWN</strong></td>";
-- break;
-- }
-- echo "</tr>";
-- break;
-- case "State Duration":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . formatTime($value) . "</td>";
-- echo "</tr>";
-- break;
-- case "Check Command":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "Plugin Output":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "Performance Data":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "Current Attempt":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "/" . $service_detail["Max Attempts"] . "</td>";
-- echo "</tr>";
-- break;
-- case "Last Check":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- if (preg_match('/1969-12-31/', $value)) {
-- echo "<td>N/A</td>";
-- } else {
-- echo "<td>" . $value . "</td>";
-- }
-- echo "</tr>";
-- break;
-- case "Next Check":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "Check Latency":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "Check Duration":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "flapping":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>Flapping:</td>";
-- if ($service_detail["flapping"]) {
-- echo "<td>Yes</td>";
-- } else {
-- echo "<td>No</td>";
-- }
-- echo "</tr>";
-- break;
-- }
--
-- if($rowColor == $background1) {
-- $rowColor = $background2;
-- } else {
-- $rowColor = $background1;
-- }
--
-- if ($key == "flapping") {
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>Event Handler:</td>";
-- if (!$service_config["event_handler"]) {
-- echo "<td>N/A</td>";
-- } else {
-- echo "<td>" . $service_config["event_handler"] . "</td>";
-- }
-- echo "</tr>";
-- }
--
--
-- }
--
--
--?>
--
-- </tbody>
-- </table>
--
-- </td>
-- </tr>
-- </tbody>
-- </table>
--
-- </td>
--
-- <td valign="top">
-- <table width="70%" border="0" align="right">
-- <thead>
-- <tr class="textHeaderDark" bgcolor='#00438C'>
-- <td align="center"><strong>Service Monitoring Options</strong></td>
-- </tr>
-- </thead>
-- <tbody>
-- <tr>
-- <td width="70%" valign="top">
-- <table width="100%" align="center" cellpadding="3">
-- <thead>
-- <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-- <td>Parameter</td>
-- <td>Value</td>
-- </tr>
-- </thead>
-- <tbody>
--
--<?php
-- $rowColor = $background1;
-- echo "<tr bgcolor='" . $rowColor . "'>";
--
--
-- foreach ($service_config as $key => $value) {
--
-- if ($key == "event_handler") { continue; }
--
-- echo "<tr bgcolor='" . $rowColor . "'>";
--
-- switch($key)
-- {
-- case "active_checks_enabled":
-- echo "<td>Active Checks:</td>";
-- break;
-- case "passive_checks_enabled":
-- echo "<td>Passive Checks:</td>";
-- break;
-- case "event_handler_enabled":
-- echo "<td>Event Handler:</td>";
-- break;
-- case "flap_detection_enabled":
-- echo "<td>Flap Detection:</td>";
-- break;
-- case "notifications_enabled":
-- echo "<td>Notifications:</td>";
-- break;
-- case "failure_prediction_enabled":
-- echo "<td>Failure Prediction:</td>";
-- break;
-- case "process_performance_data":
-- echo "<td>Process Performance Data:</td>";
-- break;
-- case "obsess_over_service":
-- echo "<td>Obsess Over Service:</td>";
-- break;
-- }
--
-- if ($value == 0) {
-- echo "<td class='optionDISABLED'>Disabled</td></tr>";
-- } else {
-- echo "<td class='optionENABLED'>Enabled</td></tr>";
-- }
--
-- if($rowColor == $background1) {
-- $rowColor = $background2;
-- } else {
-- $rowColor = $background1;
-- }
--
--
-- }
--
--?>
-- </tbody>
-- </table>
-- </td>
-- </tr>
-- </table>
--
-- </td>
--
--
--
--<?php
--
--
--
--
-- echo "</tr>";
-- echo "<tr>";
--
--?>
-- <tr><td> </td><td> </td></tr>
-- <tr><td> </td><td> </td></tr>
-- <td valign="top" colspan='2'>
-- <table width="60%" border="0" align="center">
-- <thead>
-- <tr class="textHeaderDark" bgcolor='#00438C'>
-- <td align="center"><strong>Service Comments</strong></td>
-- </tr>
-- </thead>
-- <tbody>
-- <tr>
-- <td width="60%" valign="top">
-- <table width="100%" align="center" cellpadding="3">
-- <thead>
-- <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-- <td>Entry Time</td>
-- <td>Author</td>
-- <td>Comment</td>
-- <td>Persistent</td>
-- <td>Type</td>
-- <td>Delete</td>
-- <tbody>
--<?php
-- for($i = 0; $i < $row_count; $i++) {
--
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td nowrap>" . $comments[$i]["timestamp"] . "</td>";
-- echo "<td>" . $comments[$i]["author"] . "</td>";
-- echo "<td>" . $comments[$i]["comment"] . "</td>";
-- echo "<td>";
-- if ($comments[$i]["persist"]) {
-- echo "Yes";
-- } else {
-- echo "No";
-- }
-- echo "</td>";
-- echo "<td>";
-- if ($comments[$i]["type"] == 2) {
-- echo "Comment";
-- } elseif ($comments[$i]["type"] == 4) {
-- echo "Acknowledgment";
-- }
-- echo "</td>";
-- echo "<td>";
-- if ($comments[$i]["type"] == 2) {
-- echo "<a href='command.php?cmd=DEL_SVC_COMMENT&id=" . $comments[$i]["id"] . "&host=" . $hostname . "&hostid=" . $hostid . "&service=" . $_REQUEST["service"] . "&serviceid=" . $serviceid . "'><img src='images/delete.gif' alt='delete' title='Delete comment' border=0></a>";
-- } elseif ($comments[$i]["type"] == 4) {
-- echo "<a href='command.php?cmd=REMOVE_SVC_ACKNOWLEDGEMENT&host=" . $hostname . "&hostid=" . $hostid . "&service=" . $_REQUEST["service"] . "&serviceid=" . $serviceid . "'><img src='images/delete.gif' alt='Remove' title='Remove problem acknowledgment' border=0></a>";
-- }
-- echo "</td>";
--
--
-- if($rowColor == $background1) {
-- $rowColor = $background2;
-- } else {
-- $rowColor = $background1;
-- }
-- }
--
--
--
--
--
--
--
--?>
-- </tbody>
-- </table>
-- </td>
-- </tr>
-- <tr>
-- <td>
-- <?php
-- echo "<a href='command.php?cmd=ADD_SVC_COMMENT&host=" . $hostname . "&hostid=" . $hostid . "&service=" . $_REQUEST["service"] . "&serviceid=" . $serviceid . "'><img src='images/comment.gif' alt='Add a comment' title='Add a comment' border=0></a>";
-- echo "<a href='command.php?cmd=DEL_ALL_SVC_COMMENTS&host=" . $hostname . "&hostid=" . $hostid . "&service=" . $_REQUEST["service"] . "&serviceid=" . $serviceid . "'><img src='images/delete.gif' alt='Delete all comments' title='Delete all comments' border=0></a>";
-- ?>
-- </td>
-- </tr>
-- </tbody>
-- </table>
-- </td>
-- <td></td>
-- <tr><td> </td><td> </td></tr>
-- <tr><td> </td><td> </td></tr>
-- <tr>
--
--
--
--
--
-- <td valign="top" colspan='2'>
-- <table width="60%" border="0" align="center">
-- <thead>
-- <tr align="center" class="textHeaderDark" bgcolor='#00438C'>
-- <td align="center"><strong>Graph Mapping</strong></td>
-- </tr>
-- </thead>
-- <tbody>
-- <tr>
-- <td width="60%" valign="top">
-- <table width="100%" align="center" cellpadding="3">
-- <tbody>
--
--<?php
--
--$cacti_graphs = db_fetch_assoc("
--select
-- graph_templates_graph.id,
-- graph_templates_graph.local_graph_id,
-- graph_templates_graph.height,
-- graph_templates_graph.width,
-- graph_templates_graph.title_cache as title,
-- graph_templates.name,
-- graph_local.host_id
-- from graph_local,graph_templates_graph
-- left join graph_templates on graph_local.graph_template_id=graph_templates.id
-- where graph_local.id=graph_templates_graph.local_graph_id
-- and graph_templates_graph.title_cache like '%'
-- order by graph_templates_graph.title_cache,graph_local.host_id");
--
-- $row_count = count($cacti_graphs);
--/* http://logindev/cacti/graph_image.php?local_graph_id=6&rra_id=0 */
--?>
--
-- <FORM NAME="gm" ACTION="" method="post">
-- <tr bgcolor='<?php echo $background1; ?>'>
-- <td>Associated graph:</td>
-- <td>
-- <select name="local_graph_id" size="1">
-- <?php
-- echo "<OPTION VALUE='NULL'>None</option>";
-- for($i = 0; $i < $row_count; $i++) {
-- echo "<OPTION VALUE='" . $cacti_graphs[$i]["local_graph_id"] . "'>" . $cacti_graphs[$i]["title"] . "</option>";
-- }
-- ?>
--
--
-- </select>
-- </td>
-- <td><INPUT TYPE="submit" VALUE="Map"></td>
-- </tr>
-- </FORM>
--
--
-- </tbody>
-- </table>
-- <?php
-- if ($service_detail["cacti_graph_id"]) {
-- echo "<table align='center'>";
-- echo "<tr><td width='100%'>";
-- echo "<img src='../../graph_image.php?local_graph_id=" . $service_detail["cacti_graph_id"] . "&rra_id=0'>";
-- echo "</td></tr>";
-- }
-- ?>
-- </td>
-- </tr>
-- </tbody>
-- </table>
--
-- </td>
--
-- </tr>
-- </table>
--
--<?php
--
--
--}
--
--
--function hostInfo() {
--
-- $hostid = $_REQUEST["hostid"];
-- $hostname = $_REQUEST["hostname"];
--
-- if (isset($_POST["local_graph_id"])) {
-- db_execute("update npc_host set cacti_graph_id = " . $_POST["local_graph_id"] . " where id = " . $hostid);
-- header("Location: extinfo.php?type=1&hostid=" . $hostid . "&hostname=" . $hostname);
-- }
--
-- include_once("top_npc_header.php");
--
-- $background1 = "#F5F5F5";
-- $background2 = "#E7E9F2";
-- $rowColor = $background1;
--
-- $host_flapping["flapping"] = db_fetch_cell("select id from npc_flapping_host where id = $hostid");
--
-- $host_history = db_fetch_row("select started, soft_state, hard_state, current_attempt, plugin_output from npc_host_history where hostid = $hostid order by started desc;");
--
-- $host_check = db_fetch_row("select check_command, check_execute_time, check_latency, from_unixtime(last_check) as last_check, from_unixtime(next_check) as next_check, max_attempts, last_notification, next_notification, no_more_notifications, check_type, performance_data from npc_host_check where hostid = $hostid;");
--
-- $host_config = db_fetch_row("select active_checks_enabled, passive_checks_enabled, event_handler_enabled, flap_detection_enabled, notifications_enabled, failure_prediction_enabled, process_performance_data, obsess_over_host, event_handler, cacti_graph_id from npc_host where id = $hostid");
--
-- $comments = db_fetch_assoc("select id,serviceid,timestamp,author,comment,persist,type from npc_comment where hostid = $hostid");
--
-- $graphView = db_fetch_cell("select id from graph_tree_items where host_id = (select id from host where npc_host_id = $hostid)");
--
-- $row_count = count($comments);
--
-- $duration = date("U") - $host_history["started"];
--
--?>
--
--
--
--
-- <table width="98%" border="0" cellpadding="0" cellspacing="0" align="center">
-- <tr class="textSubHeaderDark" bgcolor='#6d88ad'>
-- <td>
-- <h2> <strong><?php echo $hostname; ?></strong></h2>
-- </td>
-- <td align='right' nowrap>
-- <FORM NAME="cl" ACTION="command.php" method="POST">Command:
-- <INPUT TYPE='hidden' NAME='host' VALUE='<?php echo $hostname; ?>'>
-- <INPUT TYPE='hidden' NAME='hostid' VALUE='<?php echo $hostid; ?>'>
-- <select name="command" size="1">
--
--<?php
-- if (read_config_option("nagios_commands")) {
--
-- echo "<OPTION VALUE='NULL'>Execute a command</option>";
--
-- if ($host_config["active_checks_enabled"]) {
-- echo "<OPTION VALUE='DISABLE_HOST_CHECK'>Disable active checks</option>";
-- echo "<OPTION VALUE='SCHEDULE_HOST_CHECK'>Re-schedule the next check</option>";
-- echo "<OPTION VALUE='SCHEDULE_HOST_SVC_CHECKS'>Schedule a check of all services</option>";
-- } else {
-- echo "<OPTION VALUE='ENABLE_HOST_CHECK'>Enable Active Checks</option>";
-- }
-- echo "<OPTION VALUE='DISABLE_HOST_SVC_CHECKS'>Disable checks of all services</option>";
-- echo "<OPTION VALUE='ENABLE_HOST_SVC_CHECKS'>Enabble checks of all services</option>";
-- if ($host_config["passive_checks_enabled"]) {
-- echo "<OPTION VALUE='PROCESS_HOST_CHECK_RESULT'>Submit passive check result</option>";
-- echo "<OPTION VALUE='DISABLE_PASSIVE_HOST_CHECKS'>Stop accepting passive checks</option>";
-- } else {
-- echo "<OPTION VALUE='ENABLE_PASSIVE_HOST_CHECKS'>Start accepting passive checks</option>";
-- }
-- if ($host_config["obsess_over_service"]) {
-- echo "<OPTION VALUE='STOP_OBSESSING_OVER_HOST'>Stop obsessing</option>";
-- } else {
-- echo "<OPTION VALUE='START_OBSESSING_OVER_HOST'>Start obsessing</option>";
-- }
-- if ($host_history["soft_state"] == 1 || $host_history["soft_state"] == 2 && $host_history["soft_state"] == $host_history["hard_state"]) {
-- if (!db_fetch_cell("select * from npc_comment where hostid = $hostid and type = 4;")) {
-- echo "<OPTION VALUE='ACKNOWLEDGE_HOST_PROBLEM'>Acknowledge This Host Problem</option>";
-- } elseif (db_fetch_cell("select * from npc_comment where hostid = $hostid and type = 4;")) {
-- echo "<OPTION VALUE='REMOVE_HOST_ACKNOWLEDGEMENT'>Remove Problem Acknowledgement</option>";
-- }
-- }
-- if ($host_config["notifications_enabled"]) {
-- echo "<OPTION VALUE='DISABLE_HOST_NOTIFICATIONS'>Disable Notifications</option>";
-- if ($host_history["soft_state"] != 0) {
-- echo "<OPTION VALUE='DELAY_HOST_NOTIFICATION'>Delay Next Service Notification</option>";
-- }
-- } else {
-- echo "<OPTION VALUE='ENABLE_HOST_NOTIFICATIONS'>Enable Notifications</option>";
-- }
-- echo "<OPTION VALUE='SCHEDULE_HOST_DOWNTIME'>Schedule Downtime</option>";
-- if ($host_config["event_handler_enabled"]) {
-- echo "<OPTION VALUE='DISABLE_HOST_EVENT_HANDLER'>Disable Event Handler</option>";
-- } else {
-- echo "<OPTION VALUE='ENABLE_HOST_EVENT_HANDLER'>Enable Event Handler</option>";
-- }
-- if ($host_config["flap_detection_enabled"]) {
-- echo "<OPTION VALUE='DISABLE_HOST_FLAP_DETECTION'>Disable Flap Detection</option>";
-- } else {
-- echo "<OPTION VALUE='ENABLE_HOST_FLAP_DETECTION'>Enable Flap Detection</option>";
-- }
-- echo "<OPTION VALUE='ADD_HOST_COMMENT'>Add Host Comment</option>";
-- echo "<OPTION VALUE='DEL_ALL_HOST_COMMENTS'>Delete All Host Comments</option>";
-- } else {
-- echo "<OPTION VALUE='NULL'>Command execution disabled</option>";
-- }
--?>
--
-- </select>
-- <input type='image' src='../../images/button_go.gif' alt='Go' value='Execute' align='absmiddle'>
-- </form>
--
--
-- </td>
-- </tr>
-- <tr><td></td><td></td></tr>
-- <tr bgcolor='#a9b7cb'>
-- <td><a href='statusDetail.php?filter=showHost&name=<?php echo $hostname; ?>'>View Services</a> | <?php if ($graphView) { ?><a href='<?php echo $config['url_path']?>graph_view.php?action=tree&tree_id=1&leaf_id=<?php echo $graphView; ?>'>View Graphs</a> | <?php } ?><a href='hostConfig.php?name=<?php echo $hostname; ?>&hostid=<?php echo $hostid; ?>'>Configure</a></td>
-- <td> </td></tr>
-- </tr>
--
-- <tr><td> </td><td> </td></tr>
-- <tr>
-- <td valign="top">
-- <table width="100%" border="0" align="left" valign="top">
-- <thead>
-- <tr class="textHeaderDark" bgcolor='#00438C'>
-- <td align="center"><strong>Host State Information</strong></td>
-- </tr>
-- </thead>
-- <tbody>
-- <tr>
-- <td width="100%" valign="top">
-- <table width="100%" align="center" cellpadding="3">
-- <thead>
-- <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-- <td>Parameter</td>
-- <td>Value</td>
-- </tr>
-- </thead>
-- <tbody>
--
--
--<?php
--
--
-- $host_detail = array(
-- 'Current Status' => $host_history["soft_state"],
-- 'State Duration' => formatTime($duration),
-- 'Check Command' => $host_check["check_command"],
-- 'Plugin Output' => $host_history["plugin_output"],
-- 'Performance Data' => $host_check["performance_data"],
-- 'Current Attempt' => $host_history["current_attempt"],
-- 'Last Check' => $host_check["last_check"],
-- 'Next Check' => $host_check["next_check"],
-- 'Check Latency' => $host_check["check_latency"],
-- 'Check Duration' => $host_check["check_execute_time"],
-- 'flapping' => $host_flapping["flapping"],
-- 'Event Handler' => $host_config["event_handler"],
-- );
--
-- foreach ($host_detail as $key => $value) {
--
--
-- switch($key)
-- {
-- case "Current Status":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- switch($value)
-- {
-- case "-1":
-- echo "<td class='statusPENDING'><strong>PENDING</strong></td>";
-- break;
-- case "0":
-- echo "<td class='statusHOSTUP'><strong>UP</strong></td>";
-- break;
-- case "1":
-- echo "<td class='statusHOSTDOWN'><strong>DOWN</strong></td>";
-- break;
-- case "2":
-- echo "<td class='statusHOSTUNREACHABLE'><strong>UNREACHABLE</strong></td>";
-- break;
-- }
-- echo "</tr>";
-- break;
-- case "State Duration":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "Check Command":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "Plugin Output":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "Performance Data":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "Current Attempt":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "/" . $host_check["max_attempts"] . "</td>";
-- echo "</tr>";
-- break;
-- case "Last Check":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- if (preg_match('/1969-12-31/', $value)) {
-- echo "<td>N/A</td>";
-- } else {
-- echo "<td>" . $value . "</td>";
-- }
-- echo "</tr>";
-- break;
-- case "Next Check":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- if (preg_match('/1969-12-31/', $value)) {
-- echo "<td>N/A</td>";
-- } else {
-- echo "<td>" . $value . "</td>";
-- }
-- echo "</tr>";
-- break;
-- case "Check Latency":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "Check Duration":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- echo "<td>" . $value . "</td>";
-- echo "</tr>";
-- break;
-- case "flapping":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>Flapping:</td>";
-- if ($host_detail["flapping"]) {
-- echo "<td>Yes</td>";
-- } else {
-- echo "<td>No</td>";
-- }
-- echo "</tr>";
-- break;
-- case "Event Handler":
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td>" . $key . ":</td>";
-- if (!$value) {
-- echo "<td>N/A</td>";
-- } else {
-- echo "<td>" . $value . "</td>";
-- }
-- echo "</tr>";
-- break;
-- }
--
-- if($rowColor == $background1) {
-- $rowColor = $background2;
-- } else {
-- $rowColor = $background1;
-- }
--
-- }
--
--
--?>
--
-- </tbody>
-- </table>
--
-- </td>
-- </tr>
-- </tbody>
-- </table>
--
-- </td>
--
-- <td valign="top">
-- <table width="70%" border="0" align="right">
-- <thead>
-- <tr class="textHeaderDark" bgcolor='#00438C'>
-- <td align="center"><strong>Host Monitoring Options</strong></td>
-- </tr>
-- </thead>
-- <tbody>
-- <tr>
-- <td width="70%" valign="top">
-- <table width="100%" align="center" cellpadding="3">
-- <thead>
-- <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-- <td>Parameter</td>
-- <td>Value</td>
-- </tr>
-- </thead>
-- <tbody>
--
--<?php
-- $rowColor = $background1;
-- echo "<tr bgcolor='" . $rowColor . "'>";
--
--
-- foreach ($host_config as $key => $value) {
--
-- if ($key == "event_handler") { continue; }
-- if ($key == "cacti_graph_id") { continue; }
--
-- echo "<tr bgcolor='" . $rowColor . "'>";
--
-- switch($key)
-- {
-- case "active_checks_enabled":
-- echo "<td>Active Checks:</td>";
-- break;
-- case "passive_checks_enabled":
-- echo "<td>Passive Checks:</td>";
-- break;
-- case "event_handler_enabled":
-- echo "<td>Event Handler:</td>";
-- break;
-- case "flap_detection_enabled":
-- echo "<td>Flap Detection:</td>";
-- break;
-- case "notifications_enabled":
-- echo "<td>Notifications:</td>";
-- break;
-- case "failure_prediction_enabled":
-- echo "<td>Failure Prediction:</td>";
-- break;
-- case "process_performance_data":
-- echo "<td>Process Performance Data:</td>";
-- break;
-- case "obsess_over_host":
-- echo "<td>Obsess Over Host:</td>";
-- break;
-- }
--
-- if ($value == 0) {
-- echo "<td class='optionDISABLED'>Disabled</td></tr>";
-- } else {
-- echo "<td class='optionENABLED'>Enabled</td></tr>";
-- }
--
-- if($rowColor == $background1) {
-- $rowColor = $background2;
-- } else {
-- $rowColor = $background1;
-- }
--
--
-- }
--
--?>
-- </tbody>
-- </table>
-- </td>
-- </tr>
-- </table>
--
-- </td>
--
--
--
--<?php
--
--
--
--
-- echo "</tr>";
-- echo "<tr>";
--
--?>
-- <tr><td> </td><td> </td></tr>
-- <tr><td> </td><td> </td></tr>
-- <td valign="top" colspan='2'>
-- <table width="60%" border="0" align="center">
-- <thead>
-- <tr class="textHeaderDark" bgcolor='#00438C'>
-- <td align="center"><strong>Host Comments</strong></td>
-- </tr>
-- </thead>
-- <tbody>
-- <tr>
-- <td width="60%" valign="top">
-- <table width="100%" align="center" cellpadding="3">
-- <thead>
-- <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-- <td>Entry Time</td>
-- <td>Author</td>
-- <td>Comment</td>
-- <td>Persistent</td>
-- <td>Type</td>
-- <td>Delete</td>
-- <tbody>
--<?php
-- for($i = 0; $i < $row_count; $i++) {
--
-- echo "<tr bgcolor='" . $rowColor . "'>";
-- echo "<td nowrap>" . $comments[$i]["timestamp"] . "</td>";
-- echo "<td>" . $comments[$i]["author"] . "</td>";
-- echo "<td>" . $comments[$i]["comment"] . "</td>";
-- echo "<td>";
-- if ($comments[$i]["persist"]) {
-- echo "Yes";
-- } else {
-- echo "No";
-- }
-- echo "</td>";
-- echo "<td>";
-- if ($comments[$i]["type"] == 1) {
-- echo "Comment";
-- } elseif ($comments[$i]["type"] == 3) {
-- echo "Acknowledgment";
-- }
-- echo "</td>";
-- echo "<td>";
-- if ($comments[$i]["type"] == 1) {
-- echo "<a href='command.php?cmd=DEL_HOST_COMMENT&id=" . $comments[$i]["id"] . "&host=" . $hostname . "&hostid=" . $hostid . "'><img src='images/delete.gif' alt='delete' title='Delete comment' border=0></a>";
-- } elseif ($comments[$i]["type"] == 3) {
-- echo "<a href='command.php?cmd=REMOVE_HOST_ACKNOWLEDGEMENT&host=" . $hostname . "&hostid=" . $hostid . "'><img src='images/delete.gif' alt='Remove' title='Remove problem acknowledgment' border=0></a>";
-- }
-- echo "</td>";
--
--
-- if($rowColor == $background1) {
-- $rowColor = $background2;
-- } else {
-- $rowColor = $background1;
-- }
-- }
--
--
--
--
--
--
--
--?>
-- </tbody>
-- </table>
-- </td>
-- </tr>
-- <tr>
-- <td>
-- <?php
-- echo "<a href='command.php?cmd=ADD_HOST_COMMENT&host=" . $hostname . "&hostid=" . $hostid . "'><img src='images/comment.gif' alt='Add a comment' title='Add a comment' border=0></a>";
-- echo "<a href='command.php?cmd=DEL_ALL_HOST_COMMENTS&host=" . $hostname . "&hostid=" . $hostid . "'><img src='images/delete.gif' alt='Delete all comments' title='Delete all comments' border=0></a>";
-- ?>
-- </td>
-- </tr>
-- </tbody>
-- </table>
-- </td>
-- <td></td>
-- <tr><td> </td><td> </td></tr>
-- <tr><td> </td><td> </td></tr>
-- <tr>
--
--
--
--
--
-- <td valign="top" colspan='2'>
-- <table width="60%" border="0" align="center">
-- <thead>
-- <tr align="center" class="textHeaderDark" bgcolor='#00438C'>
-- <td align="center"><strong>Graph Mapping</strong></td>
-- </tr>
-- </thead>
-- <tbody>
-- <tr>
-- <td width="60%" valign="top">
-- <table width="100%" align="center" cellpadding="3">
-- <tbody>
--
--<?php
--
--$cacti_graphs = db_fetch_assoc("
--select
-- graph_templates_graph.id,
-- graph_templates_graph.local_graph_id,
-- graph_templates_graph.height,
-- graph_templates_graph.width,
-- graph_templates_graph.title_cache as title,
-- graph_templates.name,
-- graph_local.host_id
-- from graph_local,graph_templates_graph
-- left join graph_templates on graph_local.graph_template_id=graph_templates.id
-- where graph_local.id=graph_templates_graph.local_graph_id
-- and graph_templates_graph.title_cache like '%'
-- order by graph_templates_graph.title_cache,graph_local.host_id");
--
-- $row_count = count($cacti_graphs);
--/* http://logindev/cacti/graph_image.php?local_graph_id=6&rra_id=0 */
--?>
--
-- <FORM NAME="gm" ACTION="" method="post">
-- <tr bgcolor='<?php echo $background1; ?>'>
-- <td>Associated graph:</td>
-- <td>
-- <select name="local_graph_id" size="1">
-- <?php
-- echo "<OPTION VALUE='NULL'>None</option>";
-- for($i = 0; $i < $row_count; $i++) {
-- echo "<OPTION VALUE='" . $cacti_graphs[$i]["local_graph_id"] . "'>" . $cacti_graphs[$i]["title"] . "</option>";
-- }
-- ?>
--
--
-- </select>
-- </td>
-- <td><INPUT TYPE="submit" VALUE="Map"></td>
-- </tr>
-- </FORM>
--
--
-- </tbody>
-- </table>
-- <?php
-- if ($host_config["cacti_graph_id"]) {
-- echo "<table align='center'>";
-- echo "<tr><td width='100%'>";
-- echo "<img src='../../graph_image.php?local_graph_id=" . $host_config["cacti_graph_id"] . "&rra_id=0'>";
-- echo "</td></tr>";
-- }
-- ?>
-- </td>
-- </tr>
-- </tbody>
-- </table>
--
-- </td>
--
-- </tr>
-- </table>
--
--<?php
--
--
--}
--
--
--
--
--?>
-+<?php
-+/*
-+ +-------------------------------------------------------------------------+
-+ | Nagios Plugin 0.1a for cacti 0.8.6f |
-+ | Copyright (C) 2005 Billy Gunn (billy at gunn.org) |
-+ | |
-+ | 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; either version 2 |
-+ | of the License, or (at your option) any later version. |
-+ | |
-+ | 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. |
-+ +-------------------------------------------------------------------------+
-+ | Cacti and Nagios are the copyright of their respective owners. |
-+ +-------------------------------------------------------------------------+
-+*/
-+
-+chdir('../../');
-+include_once("./include/auth.php");
-+include_once("./include/config.php");
-+
-+// Refresh the page at a user supplied interval
-+header("Refresh: " . read_config_option("npc_refresh") . "; URL=" . $_SERVER["REQUEST_URI"]);
-+
-+/* set default action */
-+if (!isset($_REQUEST["type"])) { $_REQUEST["type"] = ""; }
-+
-+switch ($_REQUEST["type"]) {
-+ case '1':
-+
-+ hostInfo();
-+ include_once("./include/bottom_footer.php");
-+ break;
-+
-+ case '2':
-+
-+ serviceInfo();
-+ include_once("./include/bottom_footer.php");
-+ break;
-+
-+ default:
-+
-+ hostInfo();
-+ include_once("./include/bottom_footer.php");
-+ break;
-+}
-+
-+
-+function formatTime($time) {
-+
-+ $days = floor($time/60/60/24);
-+ $time -= $days*60*60*24;
-+ $hours = floor($time/60/60);
-+ $time -= $hours*60*60;
-+ $minutes = floor($time/60);
-+ $time -= $minutes*60;
-+ $seconds = $time;
-+
-+ return ($days . "d " . $hours . "h " . $minutes . "m " . $seconds . "s");
-+}
-+
-+
-+function serviceInfo() {
-+
-+ $hostid = $_REQUEST["hostid"];
-+ $serviceid = $_REQUEST["serviceid"];
-+ $hostname = $_REQUEST["hostname"];
-+ $serviceName = ereg_replace("\+", " ", $_REQUEST["service"]);
-+
-+
-+ if (isset($_POST["local_graph_id"])) {
-+ db_execute("update npc_service set cacti_graph_id = " . $_POST["local_graph_id"] . " where id = " . $serviceid);
-+ header("Location: extinfo.php?type=2&hostid=" . $hostid . "&hostname=" . $hostname . "&serviceid=" . $serviceid . "&service=" . $_REQUEST["service"]);
-+ }
-+
-+ include_once("top_npc_header.php");
-+
-+ $background1 = "#F5F5F5";
-+ $background2 = "#E7E9F2";
-+ $rowColor = $background1;
-+
-+ $service_detail = db_fetch_row("
-+select distinct
-+ service_soft_state as 'Current Status',
-+ duration as 'State Duration',
-+ check_command as 'Check Command',
-+ plugin_output as 'Plugin Output',
-+ performance_data as 'Performance Data',
-+ current_attempt as 'Current Attempt',
-+ from_unixtime(last_check) as 'Last Check',
-+ from_unixtime(next_check) as 'Next Check',
-+ check_latency as 'Check Latency',
-+ check_execute_time as 'Check Duration',
-+ hostid,
-+ name,
-+ host_soft_state as 'Host Soft State',
-+ host_notifications as 'Host Notifications',
-+ service as 'Service',
-+ cacti_graph_id,
-+ serviceid,
-+ service_hard_state,
-+ service_notifications as 'Service Notifications',
-+ max_attempts as 'Max Attempts'
-+from
-+ (
-+ select
-+ npc_host.id as hostid,
-+ npc_host.name,
-+ npc_hostgroup_membership.groupid as hostgroup,
-+ npc_host_history.soft_state as host_soft_state,
-+ npc_host.notifications_enabled as host_notifications,
-+ npc_service.id as serviceid,
-+ npc_service.cacti_graph_id,
-+ npc_service.service_description as service,
-+ npc_service_history.soft_state as service_soft_state,
-+ npc_service_history.hard_state as service_hard_state,
-+ npc_service.notifications_enabled as service_notifications,
-+ npc_service_check.last_check,
-+ npc_service_check.next_check,
-+ npc_service_check.check_execute_time,
-+ npc_service_check.check_latency,
-+ npc_service_check.check_command,
-+ npc_service_check.performance_data,
-+ unix_timestamp() - npc_service_history.started as duration,
-+ npc_service_history.current_attempt,
-+ npc_service_check.max_attempts,
-+ npc_service_history.plugin_output
-+ from
-+ npc_host,
-+ npc_host_history,
-+ npc_hostgroup_membership,
-+ npc_service,
-+ npc_service_check,
-+ npc_service_history
-+ where
-+ npc_host.id = npc_hostgroup_membership.hostid and
-+ npc_host.id = npc_service.hostid and
-+ npc_host.id = npc_host_history.hostid and
-+ npc_service.id = npc_service_check.serviceid and
-+ npc_service.id = npc_service_history.serviceid and
-+ npc_service_history.lasted is null and
-+ npc_host_history.lasted is null and
-+ npc_service.configured = TRUE and
-+ npc_service.has_been_checked = TRUE and
-+ npc_host.has_been_checked = TRUE
-+ union
-+ select
-+ npc_host.id as hostid,
-+ npc_host.name,
-+ 0 as hostgroup,
-+ npc_host_history.soft_state as host_soft_state,
-+ npc_host.notifications_enabled as host_notifications,
-+ npc_service.id as serviceid,
-+ npc_service.cacti_graph_id,
-+ npc_service.service_description as service,
-+ npc_service_history.soft_state as service_soft_state,
-+ npc_service_history.hard_state as service_hard_state,
-+ npc_service.notifications_enabled as service_notifications,
-+ npc_service_check.last_check,
-+ npc_service_check.next_check,
-+ npc_service_check.check_execute_time,
-+ npc_service_check.check_latency,
-+ npc_service_check.check_command,
-+ npc_service_check.performance_data,
-+ unix_timestamp() - npc_service_history.started as duration,
-+ npc_service_history.current_attempt,
-+ npc_service_check.max_attempts,
-+ npc_service_history.plugin_output
-+ from
-+ npc_host,
-+ npc_host_history,
-+ npc_service,
-+ npc_service_check,
-+ npc_service_history
-+ where
-+ npc_host.id not in (select hostid from npc_hostgroup_membership) and
-+ npc_host.id = npc_service.hostid and
-+ npc_host.id = npc_host_history.hostid and
-+ npc_service.id = npc_service_check.serviceid and
-+ npc_service.id = npc_service_history.serviceid and
-+ npc_service_history.lasted is null and
-+ npc_host_history.lasted is null and
-+ npc_service.configured = TRUE and
-+ npc_service.has_been_checked = TRUE and
-+ npc_host.has_been_checked = TRUE
-+ union
-+ select
-+ npc_host.id as hostid,
-+ npc_host.name,
-+ npc_hostgroup_membership.groupid as hostgroup,
-+ -1 as host_soft_state,
-+ npc_host.notifications_enabled as host_notifications,
-+ npc_service.id as serviceid,
-+ npc_service.cacti_graph_id,
-+ npc_service.service_description as service,
-+ npc_service_history.soft_state as service_soft_state,
-+ npc_service_history.hard_state as service_hard_state,
-+ npc_service.notifications_enabled as service_notifications,
-+ npc_service_check.last_check,
-+ npc_service_check.next_check,
-+ npc_service_check.check_execute_time,
-+ npc_service_check.check_latency,
-+ npc_service_check.check_command,
-+ npc_service_check.performance_data,
-+ unix_timestamp() - npc_service_history.started as duration,
-+ npc_service_history.current_attempt,
-+ npc_service_check.max_attempts,
-+ npc_service_history.plugin_output
-+ from
-+ npc_host,
-+ npc_hostgroup_membership,
-+ npc_service,
-+ npc_service_check,
-+ npc_service_history
-+ where
-+ npc_host.id = npc_hostgroup_membership.hostid and
-+ npc_host.id = npc_service.hostid and
-+ npc_service.id = npc_service_check.serviceid and
-+ npc_service.id = npc_service_history.serviceid and
-+ npc_service_history.lasted is null and
-+ npc_service.configured = TRUE and
-+ npc_service.has_been_checked = TRUE and
-+ npc_host.has_been_checked = FALSE
-+ union
-+ select
-+ npc_host.id as hostid,
-+ npc_host.name,
-+ 0 as hostgroup,
-+ -1 as host_soft_state,
-+ npc_host.notifications_enabled as host_notifications,
-+ npc_service.id as serviceid,
-+ npc_service.cacti_graph_id,
-+ npc_service.service_description as service,
-+ npc_service_history.soft_state as service_soft_state,
-+ npc_service_history.hard_state as service_hard_state,
-+ npc_service.notifications_enabled as service_notifications,
-+ npc_service_check.last_check,
-+ npc_service_check.next_check,
-+ npc_service_check.check_execute_time,
-+ npc_service_check.check_latency,
-+ npc_service_check.check_command,
-+ npc_service_check.performance_data,
-+ unix_timestamp() - npc_service_history.started as duration,
-+ npc_service_history.current_attempt,
-+ npc_service_check.max_attempts,
-+ npc_service_history.plugin_output
-+ from
-+ npc_host,
-+ npc_service,
-+ npc_service_check,
-+ npc_service_history
-+ where
-+ npc_host.id not in (select hostid from npc_hostgroup_membership) and
-+ npc_host.id = npc_service.hostid and
-+ npc_service.id = npc_service_check.serviceid and
-+ npc_service.id = npc_service_history.serviceid and
-+ npc_service_history.lasted is null and
-+ npc_service.configured = TRUE and
-+ npc_service.has_been_checked = TRUE and
-+ npc_host.has_been_checked = FALSE
-+ union
-+ select
-+ npc_host.id as hostid,
-+ npc_host.name,
-+ npc_hostgroup_membership.groupid as hostgroup,
-+ npc_host_history.soft_state as host_soft_state,
-+ npc_host.notifications_enabled as host_notifications,
-+ npc_service.id as serviceid,
-+ npc_service.cacti_graph_id,
-+ npc_service.service_description as service,
-+ -1 as service_soft_state,
-+ -1 as service_hard_state,
-+ npc_service.notifications_enabled as service_notifications,
-+ npc_service_check.last_check,
-+ npc_service_check.next_check,
-+ npc_service_check.check_execute_time,
-+ npc_service_check.check_latency,
-+ npc_service_check.check_command,
-+ npc_service_check.performance_data,
-+ 0 as duration,
-+ 0 as current_attempt,
-+ npc_service_check.max_attempts,
-+ null as plugin_output
-+ from
-+ npc_host,
-+ npc_host_history,
-+ npc_hostgroup_membership,
-+ npc_service,
-+ npc_service_check
-+ where
-+ npc_host.id = npc_hostgroup_membership.hostid and
-+ npc_host.id = npc_service.hostid and
-+ npc_host.id = npc_host_history.hostid and
-+ npc_service.id = npc_service_check.serviceid and
-+ npc_host_history.lasted is null and
-+ npc_service.configured = TRUE and
-+ npc_service.has_been_checked = FALSE and
-+ npc_host.has_been_checked = TRUE
-+ union
-+ select
-+ npc_host.id as hostid,
-+ npc_host.name,
-+ 0 as hostgroup,
-+ npc_host_history.soft_state as host_soft_state,
-+ npc_host.notifications_enabled as host_notifications,
-+ npc_service.id as serviceid,
-+ npc_service.cacti_graph_id,
-+ npc_service.service_description as service,
-+ -1 as service_soft_state,
-+ -1 as service_hard_state,
-+ npc_service.notifications_enabled as service_notifications,
-+ npc_service_check.last_check,
-+ npc_service_check.next_check,
-+ npc_service_check.check_execute_time,
-+ npc_service_check.check_latency,
-+ npc_service_check.check_command,
-+ npc_service_check.performance_data,
-+ 0 as duration,
-+ 0 as current_attempt,
-+ npc_service_check.max_attempts,
-+ null as plugin_output
-+ from
-+ npc_host,
-+ npc_host_history,
-+ npc_service,
-+ npc_service_check
-+ where
-+ npc_host.id not in (select hostid from npc_hostgroup_membership) and
-+ npc_host.id = npc_service.hostid and
-+ npc_host.id = npc_host_history.hostid and
-+ npc_service.id = npc_service_check.serviceid and
-+ npc_host_history.lasted is null and
-+ npc_service.configured = TRUE and
-+ npc_service.has_been_checked = FALSE and
-+ npc_host.has_been_checked = TRUE
-+ union
-+ select
-+ npc_host.id as hostid,
-+ npc_host.name,
-+ npc_hostgroup_membership.groupid as hostgroup,
-+ -1 as host_soft_state,
-+ npc_host.notifications_enabled as host_notifications,
-+ npc_service.id as serviceid,
-+ npc_service.cacti_graph_id,
-+ npc_service.service_description as service,
-+ -1 as service_soft_state,
-+ -1 as service_hard_state,
-+ npc_service.notifications_enabled as service_notifications,
-+ npc_service_check.last_check,
-+ npc_service_check.next_check,
-+ npc_service_check.check_execute_time,
-+ npc_service_check.check_latency,
-+ npc_service_check.check_command,
-+ npc_service_check.performance_data,
-+ 0 as duration,
-+ 0 as current_attempt,
-+ npc_service_check.max_attempts,
-+ null as plugin_output
-+ from
-+ npc_host,
-+ npc_hostgroup_membership,
-+ npc_service,
-+ npc_service_check
-+ where
-+ npc_host.id = npc_hostgroup_membership.hostid and
-+ npc_host.id = npc_service.hostid and
-+ npc_service.id = npc_service_check.serviceid and
-+ npc_service.configured = TRUE and
-+ npc_service.has_been_checked = FALSE and
-+ npc_host.has_been_checked = FALSE
-+ union
-+ select
-+ npc_host.id as hostid,
-+ npc_host.name,
-+ 0 as hostgroup,
-+ -1 as host_soft_state,
-+ npc_host.notifications_enabled as host_notifications,
-+ npc_service.id as serviceid,
-+ npc_service.cacti_graph_id,
-+ npc_service.service_description as service,
-+ -1 as service_soft_state,
-+ -1 as service_hard_state,
-+ npc_service.notifications_enabled as service_notifications,
-+ npc_service_check.last_check,
-+ npc_service_check.next_check,
-+ npc_service_check.check_execute_time,
-+ npc_service_check.check_latency,
-+ npc_service_check.check_command,
-+ npc_service_check.performance_data,
-+ 0 as duration,
-+ 0 as current_attempt,
-+ npc_service_check.max_attempts,
-+ null as plugin_output
-+ from
-+ npc_host,
-+ npc_service,
-+ npc_service_check
-+ where
-+ npc_host.id not in (select hostid from npc_hostgroup_membership) and
-+ npc_host.id = npc_service.hostid and
-+ npc_service.id = npc_service_check.serviceid and
-+ npc_service.configured = TRUE and
-+ npc_service.has_been_checked = FALSE and
-+ npc_host.has_been_checked = FALSE
-+ order by
-+ name
-+ ) as host_details where hostid = $hostid and service = '$serviceName'");
-+
-+ $service_detail["flapping"] = db_fetch_cell("select id from npc_flapping_service where id = $serviceid");
-+ $service_config = db_fetch_row("select active_checks_enabled, passive_checks_enabled, event_handler_enabled, flap_detection_enabled, notifications_enabled, failure_prediction_enabled, process_performance_data, obsess_over_service, event_handler from npc_service where hostid = $hostid and service_description = '$serviceName'");
-+ $comments = db_fetch_assoc("select id,serviceid,timestamp,author,comment,persist,type from npc_comment where serviceid = '$serviceid'");
-+ $row_count = count($comments);
-+
-+?>
-+
-+
-+
-+
-+ <table width="98%" border="0" cellpadding="0" cellspacing="0" align="center">
-+ <tr class="textSubHeaderDark" bgcolor='#6d88ad'>
-+ <td>
-+ <h2> [ <?php echo $serviceName; ?> ] on
-+ <a href="extinfo.php?type=1&hostid=<?php echo $hostid; ?>&hostname=<?php echo $hostname; ?>"><?php echo $hostname; ?></a></h2>
-+ </td>
-+ <td align='right' nowrap>
-+ <FORM NAME="cl" ACTION="command.php" method="POST">Command:
-+ <INPUT TYPE='hidden' NAME='host' VALUE='<?php echo $hostname; ?>'>
-+ <INPUT TYPE='hidden' NAME='hostid' VALUE='<?php echo $service_detail["hostid"]; ?>'>
-+ <INPUT TYPE='hidden' NAME='service' VALUE='<?php echo $serviceName; ?>'>
-+ <INPUT TYPE='hidden' NAME='serviceid' VALUE='<?php echo $service_detail["serviceid"]; ?>'>
-+ <select name="command" size="1">
-+
-+<?php
-+ if (read_config_option("nagios_commands")) {
-+
-+ echo "<OPTION VALUE='NULL'>Execute a command</option>";
-+
-+ if ($service_config["active_checks_enabled"]) {
-+ echo "<strong><OPTION VALUE='DISABLE_SVC_CHECK'>Disable active checks</option></strong>";
-+ echo "<OPTION VALUE='SCHEDULE_SVC_CHECK'>Re-schedule the next check</option>";
-+ } else {
-+ echo "<OPTION VALUE='ENABLE_SVC_CHECK'>Enable Active Checks</option>";
-+ }
-+ if ($service_config["passive_checks_enabled"]) {
-+ echo "<OPTION VALUE='PROCESS_SVC_CHECK_RESULT'>Submit passive check result</option>";
-+ echo "<OPTION VALUE='DISABLE_PASSIVE_SVC_CHECKS'>Stop accepting passive checks</option>";
-+ } else {
-+ echo "<OPTION VALUE='ENABLE_PASSIVE_SVC_CHECKS'>Start accepting passive checks</option>";
-+ }
-+ if ($service_config["obsess_over_service"]) {
-+ echo "<OPTION VALUE='STOP_OBSESSING_OVER_SVC'>Stop obsessing</option>";
-+ } else {
-+ echo "<OPTION VALUE='START_OBSESSING_OVER_SVC'>Start obsessing</option>";
-+ }
-+ if ($service_detail["Current Status"] == 1 || $service_detail["Current Status"] == 2 || $service_detail["Current Status"] == 3 && $service_detail["Current Status"] == $service_detail["service_hard_state"]) {
-+ if (!db_fetch_cell("select * from npc_comment where serviceid = $serviceid and type = 4;")) {
-+ echo "<OPTION VALUE='ACKNOWLEDGE_SVC_PROBLEM'>Acknowledge This Service Problem</option>";
-+ } elseif (db_fetch_cell("select * from npc_comment where serviceid = $serviceid and type = 4;")) {
-+ echo "<OPTION VALUE='REMOVE_SVC_ACKNOWLEDGEMENT'>Remove Problem Acknowledgement</option>";
-+ }
-+ }
-+ if ($service_config["notifications_enabled"]) {
-+ echo "<OPTION VALUE='DISABLE_SVC_NOTIFICATIONS'>Disable Notifications</option>";
-+ if ($service_detail["Current Status"] != 0) {
-+ echo "<OPTION VALUE='DELAY_SVC_NOTIFICATION'>Delay Next Service Notification</option>";
-+ }
-+ } else {
-+ echo "<OPTION VALUE='ENABLE_SVC_NOTIFICATIONS'>Enable Notifications</option>";
-+ }
-+ echo "<OPTION VALUE='SCHEDULE_SVC_DOWNTIME'>Schedule Downtime</option>";
-+ if ($service_config["event_handler_enabled"]) {
-+ echo "<OPTION VALUE='DISABLE_SVC_EVENT_HANDLER'>Disable Event Handler</option>";
-+ } else {
-+ echo "<OPTION VALUE='ENABLE_SVC_EVENT_HANDLER'>Enable Event Handler</option>";
-+ }
-+ if ($service_config["flap_detection_enabled"]) {
-+ echo "<OPTION VALUE='DISABLE_SVC_FLAP_DETECTION'>Disable Flap Detection</option>";
-+ } else {
-+ echo "<OPTION VALUE='ENABLE_SVC_FLAP_DETECTION'>Enable Flap Detection</option>";
-+ }
-+ echo "<OPTION VALUE='ADD_SVC_COMMENT'>Add Service Comment</option>";
-+ echo "<OPTION VALUE='DEL_ALL_SVC_COMMENTS'>Delete All Service Comments</option>";
-+ } else {
-+ echo "<OPTION VALUE=''>Command execution disabled</option>";
-+ }
-+?>
-+
-+ </select>
-+ <input type='image' src='../../images/button_go.gif' alt='Go' value='Execute' align='absmiddle'>
-+ </form>
-+
-+
-+ </td>
-+ </tr>
-+
-+ <tr><td> </td><td> </td></tr>
-+ <tr>
-+ <td valign="top">
-+ <table width="100%" border="0" align="left" valign="top">
-+ <thead>
-+ <tr class="textHeaderDark" bgcolor='#00438C'>
-+ <td align="center"><strong>Service State Information</strong></td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+ <tr>
-+ <td width="100%" valign="top">
-+ <table width="100%" align="center" cellpadding="3">
-+ <thead>
-+ <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-+ <td>Parameter</td>
-+ <td>Value</td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+
-+
-+<?php
-+
-+
-+ foreach ($service_detail as $key => $value) {
-+
-+
-+ switch($key)
-+ {
-+ case "Current Status":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ switch($value)
-+ {
-+ case "-1":
-+ echo "<td class='statusPENDING'><strong>PENDING</strong></td>";
-+ break;
-+ case "0":
-+ echo "<td class='statusOK'><strong>OK</strong></td>";
-+ break;
-+ case "1":
-+ echo "<td class='statusWARNING'><strong>WARNING</strong></td>";
-+ break;
-+ case "2":
-+ echo "<td class='statusCRITICAL'><strong>CRITICAL</strong></td>";
-+ break;
-+ case "3":
-+ echo "<td class='statusUNKNOWN'><strong>UNKNOWN</strong></td>";
-+ break;
-+ }
-+ echo "</tr>";
-+ break;
-+ case "State Duration":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . formatTime($value) . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Check Command":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Plugin Output":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Performance Data":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Current Attempt":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "/" . $service_detail["Max Attempts"] . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Last Check":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ if (preg_match('/1969-12-31/', $value)) {
-+ echo "<td>N/A</td>";
-+ } else {
-+ echo "<td>" . $value . "</td>";
-+ }
-+ echo "</tr>";
-+ break;
-+ case "Next Check":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Check Latency":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Check Duration":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "flapping":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>Flapping:</td>";
-+ if ($service_detail["flapping"]) {
-+ echo "<td>Yes</td>";
-+ } else {
-+ echo "<td>No</td>";
-+ }
-+ echo "</tr>";
-+ break;
-+ }
-+
-+ if($rowColor == $background1) {
-+ $rowColor = $background2;
-+ } else {
-+ $rowColor = $background1;
-+ }
-+
-+ if ($key == "flapping") {
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>Event Handler:</td>";
-+ if (!$service_config["event_handler"]) {
-+ echo "<td>N/A</td>";
-+ } else {
-+ echo "<td>" . $service_config["event_handler"] . "</td>";
-+ }
-+ echo "</tr>";
-+ }
-+
-+
-+ }
-+
-+
-+?>
-+
-+ </tbody>
-+ </table>
-+
-+ </td>
-+ </tr>
-+ </tbody>
-+ </table>
-+
-+ </td>
-+
-+ <td valign="top">
-+ <table width="70%" border="0" align="right">
-+ <thead>
-+ <tr class="textHeaderDark" bgcolor='#00438C'>
-+ <td align="center"><strong>Service Monitoring Options</strong></td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+ <tr>
-+ <td width="70%" valign="top">
-+ <table width="100%" align="center" cellpadding="3">
-+ <thead>
-+ <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-+ <td>Parameter</td>
-+ <td>Value</td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+
-+<?php
-+ $rowColor = $background1;
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+
-+
-+ foreach ($service_config as $key => $value) {
-+
-+ if ($key == "event_handler") { continue; }
-+
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+
-+ switch($key)
-+ {
-+ case "active_checks_enabled":
-+ echo "<td>Active Checks:</td>";
-+ break;
-+ case "passive_checks_enabled":
-+ echo "<td>Passive Checks:</td>";
-+ break;
-+ case "event_handler_enabled":
-+ echo "<td>Event Handler:</td>";
-+ break;
-+ case "flap_detection_enabled":
-+ echo "<td>Flap Detection:</td>";
-+ break;
-+ case "notifications_enabled":
-+ echo "<td>Notifications:</td>";
-+ break;
-+ case "failure_prediction_enabled":
-+ echo "<td>Failure Prediction:</td>";
-+ break;
-+ case "process_performance_data":
-+ echo "<td>Process Performance Data:</td>";
-+ break;
-+ case "obsess_over_service":
-+ echo "<td>Obsess Over Service:</td>";
-+ break;
-+ }
-+
-+ if ($value == 0) {
-+ echo "<td class='optionDISABLED'>Disabled</td></tr>";
-+ } else {
-+ echo "<td class='optionENABLED'>Enabled</td></tr>";
-+ }
-+
-+ if($rowColor == $background1) {
-+ $rowColor = $background2;
-+ } else {
-+ $rowColor = $background1;
-+ }
-+
-+
-+ }
-+
-+?>
-+ </tbody>
-+ </table>
-+ </td>
-+ </tr>
-+ </table>
-+
-+ </td>
-+
-+
-+
-+<?php
-+
-+
-+
-+
-+ echo "</tr>";
-+ echo "<tr>";
-+
-+?>
-+ <tr><td> </td><td> </td></tr>
-+ <tr><td> </td><td> </td></tr>
-+ <td valign="top" colspan='2'>
-+ <table width="60%" border="0" align="center">
-+ <thead>
-+ <tr class="textHeaderDark" bgcolor='#00438C'>
-+ <td align="center"><strong>Service Comments</strong></td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+ <tr>
-+ <td width="60%" valign="top">
-+ <table width="100%" align="center" cellpadding="3">
-+ <thead>
-+ <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-+ <td>Entry Time</td>
-+ <td>Author</td>
-+ <td>Comment</td>
-+ <td>Persistent</td>
-+ <td>Type</td>
-+ <td>Delete</td>
-+ <tbody>
-+<?php
-+ for($i = 0; $i < $row_count; $i++) {
-+
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td nowrap>" . $comments[$i]["timestamp"] . "</td>";
-+ echo "<td>" . $comments[$i]["author"] . "</td>";
-+ echo "<td>" . $comments[$i]["comment"] . "</td>";
-+ echo "<td>";
-+ if ($comments[$i]["persist"]) {
-+ echo "Yes";
-+ } else {
-+ echo "No";
-+ }
-+ echo "</td>";
-+ echo "<td>";
-+ if ($comments[$i]["type"] == 2) {
-+ echo "Comment";
-+ } elseif ($comments[$i]["type"] == 4) {
-+ echo "Acknowledgment";
-+ }
-+ echo "</td>";
-+ echo "<td>";
-+ if ($comments[$i]["type"] == 2) {
-+ echo "<a href='command.php?cmd=DEL_SVC_COMMENT&id=" . $comments[$i]["id"] . "&host=" . $hostname . "&hostid=" . $hostid . "&service=" . $_REQUEST["service"] . "&serviceid=" . $serviceid . "'><img src='images/delete.gif' alt='delete' title='Delete comment' border=0></a>";
-+ } elseif ($comments[$i]["type"] == 4) {
-+ echo "<a href='command.php?cmd=REMOVE_SVC_ACKNOWLEDGEMENT&host=" . $hostname . "&hostid=" . $hostid . "&service=" . $_REQUEST["service"] . "&serviceid=" . $serviceid . "'><img src='images/delete.gif' alt='Remove' title='Remove problem acknowledgment' border=0></a>";
-+ }
-+ echo "</td>";
-+
-+
-+ if($rowColor == $background1) {
-+ $rowColor = $background2;
-+ } else {
-+ $rowColor = $background1;
-+ }
-+ }
-+
-+
-+
-+
-+
-+
-+
-+?>
-+ </tbody>
-+ </table>
-+ </td>
-+ </tr>
-+ <tr>
-+ <td>
-+ <?php
-+ echo "<a href='command.php?cmd=ADD_SVC_COMMENT&host=" . $hostname . "&hostid=" . $hostid . "&service=" . $_REQUEST["service"] . "&serviceid=" . $serviceid . "'><img src='images/comment.gif' alt='Add a comment' title='Add a comment' border=0></a>";
-+ echo "<a href='command.php?cmd=DEL_ALL_SVC_COMMENTS&host=" . $hostname . "&hostid=" . $hostid . "&service=" . $_REQUEST["service"] . "&serviceid=" . $serviceid . "'><img src='images/delete.gif' alt='Delete all comments' title='Delete all comments' border=0></a>";
-+ ?>
-+ </td>
-+ </tr>
-+ </tbody>
-+ </table>
-+ </td>
-+ <td></td>
-+ <tr><td> </td><td> </td></tr>
-+ <tr><td> </td><td> </td></tr>
-+ <tr>
-+
-+
-+
-+
-+
-+ <td valign="top" colspan='2'>
-+ <table width="60%" border="0" align="center">
-+ <thead>
-+ <tr align="center" class="textHeaderDark" bgcolor='#00438C'>
-+ <td align="center"><strong>Graph Mapping</strong></td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+ <tr>
-+ <td width="60%" valign="top">
-+ <table width="100%" align="center" cellpadding="3">
-+ <tbody>
-+
-+<?php
-+
-+$cacti_graphs = db_fetch_assoc("
-+select
-+ graph_templates_graph.id,
-+ graph_templates_graph.local_graph_id,
-+ graph_templates_graph.height,
-+ graph_templates_graph.width,
-+ graph_templates_graph.title_cache as title,
-+ graph_templates.name,
-+ graph_local.host_id
-+ from graph_local,graph_templates_graph
-+ left join graph_templates on graph_template_id=graph_templates.id
-+ where graph_local.id=graph_templates_graph.local_graph_id
-+ and graph_templates_graph.title_cache like '%'
-+ order by graph_templates_graph.title_cache,graph_local.host_id");
-+
-+ $row_count = count($cacti_graphs);
-+/* http://logindev/cacti/graph_image.php?local_graph_id=6&rra_id=0 */
-+?>
-+
-+ <FORM NAME="gm" ACTION="" method="post">
-+ <tr bgcolor='<?php echo $background1; ?>'>
-+ <td>Associated graph:</td>
-+ <td>
-+ <select name="local_graph_id" size="1">
-+ <?php
-+ echo "<OPTION VALUE='NULL'>None</option>";
-+ for($i = 0; $i < $row_count; $i++) {
-+ echo "<OPTION VALUE='" . $cacti_graphs[$i]["local_graph_id"] . "'>" . $cacti_graphs[$i]["title"] . "</option>";
-+ }
-+ ?>
-+
-+
-+ </select>
-+ </td>
-+ <td><INPUT TYPE="submit" VALUE="Map"></td>
-+ </tr>
-+ </FORM>
-+
-+
-+ </tbody>
-+ </table>
-+ <?php
-+ if ($service_detail["cacti_graph_id"]) {
-+ echo "<table align='center'>";
-+ echo "<tr><td width='100%'>";
-+ echo "<img src='../../graph_image.php?local_graph_id=" . $service_detail["cacti_graph_id"] . "&rra_id=0'>";
-+ echo "</td></tr>";
-+ }
-+ ?>
-+ </td>
-+ </tr>
-+ </tbody>
-+ </table>
-+
-+ </td>
-+
-+ </tr>
-+ </table>
-+
-+<?php
-+
-+
-+}
-+
-+
-+function hostInfo() {
-+
-+ $hostid = $_REQUEST["hostid"];
-+ $hostname = $_REQUEST["hostname"];
-+
-+ if (isset($_POST["local_graph_id"])) {
-+ db_execute("update npc_host set cacti_graph_id = " . $_POST["local_graph_id"] . " where id = " . $hostid);
-+ header("Location: extinfo.php?type=1&hostid=" . $hostid . "&hostname=" . $hostname);
-+ }
-+
-+ include_once("top_npc_header.php");
-+
-+ $background1 = "#F5F5F5";
-+ $background2 = "#E7E9F2";
-+ $rowColor = $background1;
-+
-+ $host_flapping["flapping"] = db_fetch_cell("select id from npc_flapping_host where id = $hostid");
-+
-+ $host_history = db_fetch_row("select started, soft_state, hard_state, current_attempt, plugin_output from npc_host_history where hostid = $hostid order by started desc;");
-+
-+ $host_check = db_fetch_row("select check_command, check_execute_time, check_latency, from_unixtime(last_check) as last_check, from_unixtime(next_check) as next_check, max_attempts, last_notification, next_notification, no_more_notifications, check_type, performance_data from npc_host_check where hostid = $hostid;");
-+
-+ $host_config = db_fetch_row("select active_checks_enabled, passive_checks_enabled, event_handler_enabled, flap_detection_enabled, notifications_enabled, failure_prediction_enabled, process_performance_data, obsess_over_host, event_handler, cacti_graph_id from npc_host where id = $hostid");
-+
-+ $comments = db_fetch_assoc("select id,serviceid,timestamp,author,comment,persist,type from npc_comment where hostid = $hostid");
-+
-+ $graphView = db_fetch_cell("select id from graph_tree_items where host_id = (select id from host where npc_host_id = $hostid)");
-+
-+ $row_count = count($comments);
-+
-+ $duration = date("U") - $host_history["started"];
-+
-+?>
-+
-+
-+
-+
-+ <table width="98%" border="0" cellpadding="0" cellspacing="0" align="center">
-+ <tr class="textSubHeaderDark" bgcolor='#6d88ad'>
-+ <td>
-+ <h2> <strong><?php echo $hostname; ?></strong></h2>
-+ </td>
-+ <td align='right' nowrap>
-+ <FORM NAME="cl" ACTION="command.php" method="POST">Command:
-+ <INPUT TYPE='hidden' NAME='host' VALUE='<?php echo $hostname; ?>'>
-+ <INPUT TYPE='hidden' NAME='hostid' VALUE='<?php echo $hostid; ?>'>
-+ <select name="command" size="1">
-+
-+<?php
-+ if (read_config_option("nagios_commands")) {
-+
-+ echo "<OPTION VALUE='NULL'>Execute a command</option>";
-+
-+ if ($host_config["active_checks_enabled"]) {
-+ echo "<OPTION VALUE='DISABLE_HOST_CHECK'>Disable active checks</option>";
-+ echo "<OPTION VALUE='SCHEDULE_HOST_CHECK'>Re-schedule the next check</option>";
-+ echo "<OPTION VALUE='SCHEDULE_HOST_SVC_CHECKS'>Schedule a check of all services</option>";
-+ } else {
-+ echo "<OPTION VALUE='ENABLE_HOST_CHECK'>Enable Active Checks</option>";
-+ }
-+ echo "<OPTION VALUE='DISABLE_HOST_SVC_CHECKS'>Disable checks of all services</option>";
-+ echo "<OPTION VALUE='ENABLE_HOST_SVC_CHECKS'>Enabble checks of all services</option>";
-+ if ($host_config["passive_checks_enabled"]) {
-+ echo "<OPTION VALUE='PROCESS_HOST_CHECK_RESULT'>Submit passive check result</option>";
-+ echo "<OPTION VALUE='DISABLE_PASSIVE_HOST_CHECKS'>Stop accepting passive checks</option>";
-+ } else {
-+ echo "<OPTION VALUE='ENABLE_PASSIVE_HOST_CHECKS'>Start accepting passive checks</option>";
-+ }
-+ if ($host_config["obsess_over_service"]) {
-+ echo "<OPTION VALUE='STOP_OBSESSING_OVER_HOST'>Stop obsessing</option>";
-+ } else {
-+ echo "<OPTION VALUE='START_OBSESSING_OVER_HOST'>Start obsessing</option>";
-+ }
-+ if ($host_history["soft_state"] == 1 || $host_history["soft_state"] == 2 && $host_history["soft_state"] == $host_history["hard_state"]) {
-+ if (!db_fetch_cell("select * from npc_comment where hostid = $hostid and type = 4;")) {
-+ echo "<OPTION VALUE='ACKNOWLEDGE_HOST_PROBLEM'>Acknowledge This Host Problem</option>";
-+ } elseif (db_fetch_cell("select * from npc_comment where hostid = $hostid and type = 4;")) {
-+ echo "<OPTION VALUE='REMOVE_HOST_ACKNOWLEDGEMENT'>Remove Problem Acknowledgement</option>";
-+ }
-+ }
-+ if ($host_config["notifications_enabled"]) {
-+ echo "<OPTION VALUE='DISABLE_HOST_NOTIFICATIONS'>Disable Notifications</option>";
-+ if ($host_history["soft_state"] != 0) {
-+ echo "<OPTION VALUE='DELAY_HOST_NOTIFICATION'>Delay Next Service Notification</option>";
-+ }
-+ } else {
-+ echo "<OPTION VALUE='ENABLE_HOST_NOTIFICATIONS'>Enable Notifications</option>";
-+ }
-+ echo "<OPTION VALUE='SCHEDULE_HOST_DOWNTIME'>Schedule Downtime</option>";
-+ if ($host_config["event_handler_enabled"]) {
-+ echo "<OPTION VALUE='DISABLE_HOST_EVENT_HANDLER'>Disable Event Handler</option>";
-+ } else {
-+ echo "<OPTION VALUE='ENABLE_HOST_EVENT_HANDLER'>Enable Event Handler</option>";
-+ }
-+ if ($host_config["flap_detection_enabled"]) {
-+ echo "<OPTION VALUE='DISABLE_HOST_FLAP_DETECTION'>Disable Flap Detection</option>";
-+ } else {
-+ echo "<OPTION VALUE='ENABLE_HOST_FLAP_DETECTION'>Enable Flap Detection</option>";
-+ }
-+ echo "<OPTION VALUE='ADD_HOST_COMMENT'>Add Host Comment</option>";
-+ echo "<OPTION VALUE='DEL_ALL_HOST_COMMENTS'>Delete All Host Comments</option>";
-+ } else {
-+ echo "<OPTION VALUE='NULL'>Command execution disabled</option>";
-+ }
-+?>
-+
-+ </select>
-+ <input type='image' src='../../images/button_go.gif' alt='Go' value='Execute' align='absmiddle'>
-+ </form>
-+
-+
-+ </td>
-+ </tr>
-+ <tr><td></td><td></td></tr>
-+ <tr bgcolor='#a9b7cb'>
-+ <td><a href='statusDetail.php?filter=showHost&name=<?php echo $hostname; ?>'>View Services</a> | <?php if ($graphView) { ?><a href='<?php echo $config['url_path']?>graph_view.php?action=tree&tree_id=1&leaf_id=<?php echo $graphView; ?>'>View Graphs</a> | <?php } ?><a href='hostConfig.php?name=<?php echo $hostname; ?>&hostid=<?php echo $hostid; ?>'>Configure</a></td>
-+ <td> </td></tr>
-+ </tr>
-+
-+ <tr><td> </td><td> </td></tr>
-+ <tr>
-+ <td valign="top">
-+ <table width="100%" border="0" align="left" valign="top">
-+ <thead>
-+ <tr class="textHeaderDark" bgcolor='#00438C'>
-+ <td align="center"><strong>Host State Information</strong></td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+ <tr>
-+ <td width="100%" valign="top">
-+ <table width="100%" align="center" cellpadding="3">
-+ <thead>
-+ <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-+ <td>Parameter</td>
-+ <td>Value</td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+
-+
-+<?php
-+
-+
-+ $host_detail = array(
-+ 'Current Status' => $host_history["soft_state"],
-+ 'State Duration' => formatTime($duration),
-+ 'Check Command' => $host_check["check_command"],
-+ 'Plugin Output' => $host_history["plugin_output"],
-+ 'Performance Data' => $host_check["performance_data"],
-+ 'Current Attempt' => $host_history["current_attempt"],
-+ 'Last Check' => $host_check["last_check"],
-+ 'Next Check' => $host_check["next_check"],
-+ 'Check Latency' => $host_check["check_latency"],
-+ 'Check Duration' => $host_check["check_execute_time"],
-+ 'flapping' => $host_flapping["flapping"],
-+ 'Event Handler' => $host_config["event_handler"],
-+ );
-+
-+ foreach ($host_detail as $key => $value) {
-+
-+
-+ switch($key)
-+ {
-+ case "Current Status":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ switch($value)
-+ {
-+ case "-1":
-+ echo "<td class='statusPENDING'><strong>PENDING</strong></td>";
-+ break;
-+ case "0":
-+ echo "<td class='statusHOSTUP'><strong>UP</strong></td>";
-+ break;
-+ case "1":
-+ echo "<td class='statusHOSTDOWN'><strong>DOWN</strong></td>";
-+ break;
-+ case "2":
-+ echo "<td class='statusHOSTUNREACHABLE'><strong>UNREACHABLE</strong></td>";
-+ break;
-+ }
-+ echo "</tr>";
-+ break;
-+ case "State Duration":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Check Command":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Plugin Output":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Performance Data":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Current Attempt":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "/" . $host_check["max_attempts"] . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Last Check":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ if (preg_match('/1969-12-31/', $value)) {
-+ echo "<td>N/A</td>";
-+ } else {
-+ echo "<td>" . $value . "</td>";
-+ }
-+ echo "</tr>";
-+ break;
-+ case "Next Check":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ if (preg_match('/1969-12-31/', $value)) {
-+ echo "<td>N/A</td>";
-+ } else {
-+ echo "<td>" . $value . "</td>";
-+ }
-+ echo "</tr>";
-+ break;
-+ case "Check Latency":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "Check Duration":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ echo "<td>" . $value . "</td>";
-+ echo "</tr>";
-+ break;
-+ case "flapping":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>Flapping:</td>";
-+ if ($host_detail["flapping"]) {
-+ echo "<td>Yes</td>";
-+ } else {
-+ echo "<td>No</td>";
-+ }
-+ echo "</tr>";
-+ break;
-+ case "Event Handler":
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td>" . $key . ":</td>";
-+ if (!$value) {
-+ echo "<td>N/A</td>";
-+ } else {
-+ echo "<td>" . $value . "</td>";
-+ }
-+ echo "</tr>";
-+ break;
-+ }
-+
-+ if($rowColor == $background1) {
-+ $rowColor = $background2;
-+ } else {
-+ $rowColor = $background1;
-+ }
-+
-+ }
-+
-+
-+?>
-+
-+ </tbody>
-+ </table>
-+
-+ </td>
-+ </tr>
-+ </tbody>
-+ </table>
-+
-+ </td>
-+
-+ <td valign="top">
-+ <table width="70%" border="0" align="right">
-+ <thead>
-+ <tr class="textHeaderDark" bgcolor='#00438C'>
-+ <td align="center"><strong>Host Monitoring Options</strong></td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+ <tr>
-+ <td width="70%" valign="top">
-+ <table width="100%" align="center" cellpadding="3">
-+ <thead>
-+ <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-+ <td>Parameter</td>
-+ <td>Value</td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+
-+<?php
-+ $rowColor = $background1;
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+
-+
-+ foreach ($host_config as $key => $value) {
-+
-+ if ($key == "event_handler") { continue; }
-+ if ($key == "cacti_graph_id") { continue; }
-+
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+
-+ switch($key)
-+ {
-+ case "active_checks_enabled":
-+ echo "<td>Active Checks:</td>";
-+ break;
-+ case "passive_checks_enabled":
-+ echo "<td>Passive Checks:</td>";
-+ break;
-+ case "event_handler_enabled":
-+ echo "<td>Event Handler:</td>";
-+ break;
-+ case "flap_detection_enabled":
-+ echo "<td>Flap Detection:</td>";
-+ break;
-+ case "notifications_enabled":
-+ echo "<td>Notifications:</td>";
-+ break;
-+ case "failure_prediction_enabled":
-+ echo "<td>Failure Prediction:</td>";
-+ break;
-+ case "process_performance_data":
-+ echo "<td>Process Performance Data:</td>";
-+ break;
-+ case "obsess_over_host":
-+ echo "<td>Obsess Over Host:</td>";
-+ break;
-+ }
-+
-+ if ($value == 0) {
-+ echo "<td class='optionDISABLED'>Disabled</td></tr>";
-+ } else {
-+ echo "<td class='optionENABLED'>Enabled</td></tr>";
-+ }
-+
-+ if($rowColor == $background1) {
-+ $rowColor = $background2;
-+ } else {
-+ $rowColor = $background1;
-+ }
-+
-+
-+ }
-+
-+?>
-+ </tbody>
-+ </table>
-+ </td>
-+ </tr>
-+ </table>
-+
-+ </td>
-+
-+
-+
-+<?php
-+
-+
-+
-+
-+ echo "</tr>";
-+ echo "<tr>";
-+
-+?>
-+ <tr><td> </td><td> </td></tr>
-+ <tr><td> </td><td> </td></tr>
-+ <td valign="top" colspan='2'>
-+ <table width="60%" border="0" align="center">
-+ <thead>
-+ <tr class="textHeaderDark" bgcolor='#00438C'>
-+ <td align="center"><strong>Host Comments</strong></td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+ <tr>
-+ <td width="60%" valign="top">
-+ <table width="100%" align="center" cellpadding="3">
-+ <thead>
-+ <tr align="center" class="textSubHeaderDark" bgcolor='#6d88ad'>
-+ <td>Entry Time</td>
-+ <td>Author</td>
-+ <td>Comment</td>
-+ <td>Persistent</td>
-+ <td>Type</td>
-+ <td>Delete</td>
-+ <tbody>
-+<?php
-+ for($i = 0; $i < $row_count; $i++) {
-+
-+ echo "<tr bgcolor='" . $rowColor . "'>";
-+ echo "<td nowrap>" . $comments[$i]["timestamp"] . "</td>";
-+ echo "<td>" . $comments[$i]["author"] . "</td>";
-+ echo "<td>" . $comments[$i]["comment"] . "</td>";
-+ echo "<td>";
-+ if ($comments[$i]["persist"]) {
-+ echo "Yes";
-+ } else {
-+ echo "No";
-+ }
-+ echo "</td>";
-+ echo "<td>";
-+ if ($comments[$i]["type"] == 1) {
-+ echo "Comment";
-+ } elseif ($comments[$i]["type"] == 3) {
-+ echo "Acknowledgment";
-+ }
-+ echo "</td>";
-+ echo "<td>";
-+ if ($comments[$i]["type"] == 1) {
-+ echo "<a href='command.php?cmd=DEL_HOST_COMMENT&id=" . $comments[$i]["id"] . "&host=" . $hostname . "&hostid=" . $hostid . "'><img src='images/delete.gif' alt='delete' title='Delete comment' border=0></a>";
-+ } elseif ($comments[$i]["type"] == 3) {
-+ echo "<a href='command.php?cmd=REMOVE_HOST_ACKNOWLEDGEMENT&host=" . $hostname . "&hostid=" . $hostid . "'><img src='images/delete.gif' alt='Remove' title='Remove problem acknowledgment' border=0></a>";
-+ }
-+ echo "</td>";
-+
-+
-+ if($rowColor == $background1) {
-+ $rowColor = $background2;
-+ } else {
-+ $rowColor = $background1;
-+ }
-+ }
-+
-+
-+
-+
-+
-+
-+
-+?>
-+ </tbody>
-+ </table>
-+ </td>
-+ </tr>
-+ <tr>
-+ <td>
-+ <?php
-+ echo "<a href='command.php?cmd=ADD_HOST_COMMENT&host=" . $hostname . "&hostid=" . $hostid . "'><img src='images/comment.gif' alt='Add a comment' title='Add a comment' border=0></a>";
-+ echo "<a href='command.php?cmd=DEL_ALL_HOST_COMMENTS&host=" . $hostname . "&hostid=" . $hostid . "'><img src='images/delete.gif' alt='Delete all comments' title='Delete all comments' border=0></a>";
-+ ?>
-+ </td>
-+ </tr>
-+ </tbody>
-+ </table>
-+ </td>
-+ <td></td>
-+ <tr><td> </td><td> </td></tr>
-+ <tr><td> </td><td> </td></tr>
-+ <tr>
-+
-+
-+
-+
-+
-+ <td valign="top" colspan='2'>
-+ <table width="60%" border="0" align="center">
-+ <thead>
-+ <tr align="center" class="textHeaderDark" bgcolor='#00438C'>
-+ <td align="center"><strong>Graph Mapping</strong></td>
-+ </tr>
-+ </thead>
-+ <tbody>
-+ <tr>
-+ <td width="60%" valign="top">
-+ <table width="100%" align="center" cellpadding="3">
-+ <tbody>
-+
-+<?php
-+
-+$cacti_graphs = db_fetch_assoc("
-+select
-+ graph_templates_graph.id,
-+ graph_templates_graph.local_graph_id,
-+ graph_templates_graph.height,
-+ graph_templates_graph.width,
-+ graph_templates_graph.title_cache as title,
-+ graph_templates.name,
-+ graph_local.host_id
-+ from graph_local,graph_templates_graph
-+ left join graph_templates on graph_template_id=graph_templates.id
-+ where graph_local.id=graph_templates_graph.local_graph_id
-+ and graph_templates_graph.title_cache like '%'
-+ order by graph_templates_graph.title_cache,graph_local.host_id");
-+
-+ $row_count = count($cacti_graphs);
-+/* http://logindev/cacti/graph_image.php?local_graph_id=6&rra_id=0 */
-+?>
-+
-+ <FORM NAME="gm" ACTION="" method="post">
-+ <tr bgcolor='<?php echo $background1; ?>'>
-+ <td>Associated graph:</td>
-+ <td>
-+ <select name="local_graph_id" size="1">
-+ <?php
-+ echo "<OPTION VALUE='NULL'>None</option>";
-+ for($i = 0; $i < $row_count; $i++) {
-+ echo "<OPTION VALUE='" . $cacti_graphs[$i]["local_graph_id"] . "'>" . $cacti_graphs[$i]["title"] . "</option>";
-+ }
-+ ?>
-+
-+
-+ </select>
-+ </td>
-+ <td><INPUT TYPE="submit" VALUE="Map"></td>
-+ </tr>
-+ </FORM>
-+
-+
-+ </tbody>
-+ </table>
-+ <?php
-+ if ($host_config["cacti_graph_id"]) {
-+ echo "<table align='center'>";
-+ echo "<tr><td width='100%'>";
-+ echo "<img src='../../graph_image.php?local_graph_id=" . $host_config["cacti_graph_id"] . "&rra_id=0'>";
-+ echo "</td></tr>";
-+ }
-+ ?>
-+ </td>
-+ </tr>
-+ </tbody>
-+ </table>
-+
-+ </td>
-+
-+ </tr>
-+ </table>
-+
-+<?php
-+
-+
-+}
-+
-+
-+
-+
-+?>
diff --git a/cacti-plugin-npc-path_headers.patch b/cacti-plugin-npc-path_headers.patch
deleted file mode 100644
index 6f44c9e..0000000
--- a/cacti-plugin-npc-path_headers.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff -uNr npc.orig/neb/inserter.c npc/neb/inserter.c
---- npc.orig/neb/inserter.c 2005-11-12 15:44:11.000000000 +0100
-+++ npc/neb/inserter.c 2006-03-28 09:09:33.000000000 +0200
-@@ -44,16 +44,16 @@
- #include <mysql/errmsg.h>
-
- /* include the needed event broker header files */
--#include "../include/nebmodules.h"
--#include "../include/nebcallbacks.h"
--#include "../include/nebstructs.h"
--#include "../include/broker.h"
-+#include "nagios/nebmodules.h"
-+#include "nagios/nebcallbacks.h"
-+#include "nagios/nebstructs.h"
-+#include "nagios/broker.h"
-
- /* include some Nagios stuff as well */
--#include "../include/config.h"
--#include "../include/common.h"
--#include "../include/nagios.h"
--#include "../include/objects.h"
-+#include "nagios/config.h"
-+#include "nagios/common.h"
-+#include "nagios/nagios.h"
-+#include "nagios/objects.h"
-
- #include <sys/types.h>
- #include <string.h>
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/cacti-plugin-npc.git/commitdiff/9e291d54dcb118678bf065ff6c9a0e5c6f378e58
More information about the pld-cvs-commit
mailing list