Skip to content

Commit

Permalink
Enable monitoring menu action for Zabbix
Browse files Browse the repository at this point in the history
It opens the "problems" view inside Zabbix, filtered to problems of the given host.
  • Loading branch information
ProfessorLogout committed Nov 4, 2024
1 parent 5a37b6c commit cb3f09d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Nagstamon/Servers/Zabbix.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(self, **kwds):
'5': 'DISASTER'}

# Entries for monitor default actions in context menu
self.MENU_ACTIONS = ["Acknowledge", "Downtime"]
self.MENU_ACTIONS = ["Monitor", "Acknowledge", "Downtime"]
# URLs for browser shortlinks/buttons on popup window
self.BROWSER_URLS = {'monitor': '$MONITOR$',
'hosts': '$MONITOR-CGI$/hosts.php?ddreset=1',
Expand Down Expand Up @@ -465,12 +465,8 @@ def open_monitor(self, host, service=""):
"""
open monitor from treeview context menu
"""
if service == "":
url = self.urls['human_host'] + urllib.parse.urlencode(
{'x': 'site=' + self.hosts[host].site + '&host=' + host}).replace('x=', '%26')
else:
url = self.urls['human_service'] + urllib.parse.urlencode(
{'x': 'site=' + self.hosts[host].site + '&host=' + host + '&service=' + service}).replace('x=', '%26')
host_id = self.hosts[host].hostid
url = f"{self.monitor_url}/zabbix.php?action=problem.view&hostids%5B%5D={host_id}&filter_set=1&show_suppressed=1"

if conf.debug_mode is True:
self.debug(server=self.get_name(), host=host, service=service,
Expand Down

0 comments on commit cb3f09d

Please sign in to comment.