From f6ae4843ec52f237b8c01c9fdcc9130a34518944 Mon Sep 17 00:00:00 2001
From: Stephen Soltesz <soltesz@cs.princeton.edu>
Date: Mon, 22 Dec 2008 22:10:40 +0000
Subject: [PATCH] fixed errors with includes in scanapi fixed arguments in
 automate-default.sh allow additional comments for acknowledged issues.

---
 automate-default.sh                                | 6 +++---
 monitor/scanapi.py                                 | 1 -
 web/MonitorWeb/monitorweb/controllers.py           | 6 +++---
 web/MonitorWeb/monitorweb/templates/actionlist.kid | 2 ++
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/automate-default.sh b/automate-default.sh
index d01650e..046c1ac 100755
--- a/automate-default.sh
+++ b/automate-default.sh
@@ -77,9 +77,9 @@ ps ax | grep locfg | grep -v grep | awk '{print $1}' | xargs -r kill || :
 echo "Performing uptime changes for sites, nodes, and pcus"
 ########################
 # 3. record last-changed for sites, nodes and pcus.
-${MONITOR_SCRIPT_ROOT}/sitebad.py --increment || :
-${MONITOR_SCRIPT_ROOT}/nodebad.py --increment || :
-${MONITOR_SCRIPT_ROOT}/pcubad.py --increment || :
+${MONITOR_SCRIPT_ROOT}/sitebad.py || :
+${MONITOR_SCRIPT_ROOT}/nodebad.py || :
+${MONITOR_SCRIPT_ROOT}/pcubad.py || :
 
 echo "Archiving pkl files"
 #########################
diff --git a/monitor/scanapi.py b/monitor/scanapi.py
index 4a00eef..bbc99d7 100644
--- a/monitor/scanapi.py
+++ b/monitor/scanapi.py
@@ -20,7 +20,6 @@ from monitor.database.info.model import *
 from monitor.sources import comon
 from monitor.wrapper import plc, plccache
 
-from nodequery import verify,query_to_dict,node_select
 import traceback
 from nodecommon import nmap_port_status
 
diff --git a/web/MonitorWeb/monitorweb/controllers.py b/web/MonitorWeb/monitorweb/controllers.py
index 0cb05d4..f4832ba 100644
--- a/web/MonitorWeb/monitorweb/controllers.py
+++ b/web/MonitorWeb/monitorweb/controllers.py
@@ -135,8 +135,8 @@ def prep_node_for_display(node):
 
 	node.history = HistoryNodeRecord.by_hostname(node.hostname)
 
-	if node.port_status:
-		node.ports = format_ports(node.port_status)
+	node.ports = format_ports(node.port_status)
+
 	try:
 		exists = node.plc_node_stats['last_contact']
 	except:
@@ -408,7 +408,7 @@ class Root(controllers.RootController):
 		session.bind = metadata.bind
 		filtercount = {'active' : 0, 'acknowledged': 0, 'all' : 0}
 		# With Acknowledgement
-		sql_ack = 'SELECT DISTINCT h.host,t.description,t.priority,t.lastchange,a.message '+ \
+		sql_ack = 'SELECT DISTINCT h.host,t.description,t.priority,t.lastchange,a.message,e.eventid '+ \
               ' FROM triggers t,hosts h,items i,functions f, hosts_groups hg,escalations e,acknowledges a ' + \
               ' WHERE f.itemid=i.itemid ' + \
                   ' AND h.hostid=i.hostid ' + \
diff --git a/web/MonitorWeb/monitorweb/templates/actionlist.kid b/web/MonitorWeb/monitorweb/templates/actionlist.kid
index eb79269..d9cc923 100644
--- a/web/MonitorWeb/monitorweb/templates/actionlist.kid
+++ b/web/MonitorWeb/monitorweb/templates/actionlist.kid
@@ -36,6 +36,7 @@ def zabbix_event_ack_link(eventid):
 					<th>Issue (severity)</th>
 					<th>Last change</th>
 					<th>Notes (acknowledged)</th>
+					<th></th>
 				</tr>
 			</thead>
 			<tbody>
@@ -55,6 +56,7 @@ def zabbix_event_ack_link(eventid):
 					<!-- NOTE: only one of the next two columns will be displayed. -->
 					<td py:if="val"><a href="${zabbix_event_ack_link(node[5])}">Provide Ack</a></td>
 					<td py:if="not val" py:content="node[5]">Message from user</td>
+					<td py:if="not val"><a href="${zabbix_event_ack_link(node[6])}">Add</a></td>
 				</tr>
 			</tbody>
 		</table>
-- 
2.47.0