Skip to content

Commit

Permalink
make Zabbix copy-all-to-clipboard work again
Browse files Browse the repository at this point in the history
  • Loading branch information
Henri Wahl committed Sep 25, 2023
1 parent 93371ae commit 24e97b5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Nagstamon/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
DESKTOP_WAYLAND = False

# detection of somehow quirky desktop enviroments which might need a fix
QUIRKY_DESKTOPS = ('cinnamon', 'gnome-flashback-metacity')
QUIRKY_DESKTOPS = ('cinnamon', 'gnome-flashback-metacity')
if os.environ.get('CINNAMON_VERSION') or\
os.environ.get('DESKTOP_SESSION') in QUIRKY_DESKTOPS or \
os.environ.get('XDG_SESSION_DESKTOP') in QUIRKY_DESKTOPS:
Expand Down
7 changes: 4 additions & 3 deletions Nagstamon/QUI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3897,14 +3897,15 @@ def action_clipboard_action_all(self):
for line_number in range(len(list_host)):
host = list_host[line_number]
service = list_service[line_number]

# item to access all properties of host/service object
# defaults to host
item = self.server.hosts[host]
text += 'Host: {0}\n'.format(host)
# if it is a service switch to service object
if service != '' and item.services.get(service):
item = item.services[service]
# collect all services to be able to serve Zabbix too, which uses IDs instead of service names
services_dict = {v.service:v for k, v in item.services.items()}
if service != '' and services_dict.get(service):
item = services_dict[service]
text += 'Service: {0}\n'.format(service)
# the other properties belong to both hosts and services
text += 'Status: {0}\n'.format(item.status)
Expand Down
4 changes: 2 additions & 2 deletions Nagstamon/Servers/Icinga.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ def _get_status_HTML(self):
n['status_information'] = ''
else:
n['status_information'] = str(tds[4].string)
# attempts are not shown in case of hosts so it defaults to 'N/A'
n['attempt'] = 'N/A'
# attempts are not shown in case of hosts so it defaults to 'n/a'
n['attempt'] = 'n/a'
else:
# attempts are shown for hosts
# to fix http://sourceforge.net/tracker/?func=detail&atid=1101370&aid=3280961&group_id=236865 .attempt needs
Expand Down
2 changes: 1 addition & 1 deletion Nagstamon/Servers/Zabbix.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def _get_status(self):
'status': 'UP', # Host is OK by default
'last_check': 'n/a',
'duration': '',
'attempt': 'N/A',
'attempt': 'n/a',
'status_information': '',
# status flags
'passiveonly': False,
Expand Down

0 comments on commit 24e97b5

Please sign in to comment.