Comments (18)
A cleaner approach will be the support for hostgroups in general. This is planned but not yet implemented. Another Monitor CGI URL would lead to more mess in my opinion.
from nagstamon.
That's fully true, however I assume it's not an easy task and would probably take some time to get that feature in. In the meanwhile, it would be nice if Acknowledgements and Downtime would work when using a custom Monitor CGI URL (like the one mentioned in the description).
If the planned feature is going to come out soon, then please disregard this and close as "won't fix".
from nagstamon.
With the latest version the usage of a custom URL in Monitor CGI URL has stopped working. I've turned on debugging and below are a few lines from the log file:
DEBUG: 2013-07-15 15:38:03.208000 Icinga Created server.
DEBUG: 2013-07-15 15:38:03.208000 Icinga Infra Created server.
DEBUG: 2013-07-15 15:38:03.349000 Icinga Infra FetchURL: http://my.icinga.server/icinga/cgi-bin/status.cgi?hostgroup=own_Infrastructure&style=detail&servicestatustypes=28&serviceprops=10&hostprops=10/tac.cgi?jsonoutput CGI Data: None
DEBUG: 2013-07-15 15:38:03.349000 Icinga FetchURL: http://my.icinga.server/icinga/cgi-bin/status.cgi?hostgroup=hgroupa&style=detail&servicestatustypes=28&serviceprops=10&hostprops=10/tac.cgi?jsonoutput CGI Data: None
DEBUG: 2013-07-15 15:38:03.349000 Checking for new version...
DEBUG: 2013-07-15 15:38:03.349000 Icinga Infra FetchURL: https://nagstamon.ifw-dresden.de/files-nagstamon/latest_version_0.9.11-devel CGI Data: None
DEBUG: 2013-07-15 15:38:16.753000 Icinga Infra FetchURL: http://my.icinga.server/icinga/cgi-bin/status.cgi?hostgroup=own_Infrastructure&style=detail&servicestatustypes=28&serviceprops=10&hostprops=10/status.cgi?style=hostdetail&hoststatustypes=12&hostprops=262144 CGI Data: None
DEBUG: 2013-07-15 15:38:16.873000 Icinga FetchURL: http://my.icinga.server/icinga/cgi-bin/status.cgi?hostgroup=hgroupa&style=detail&servicestatustypes=28&serviceprops=10&hostprops=10/status.cgi?style=hostdetail&hoststatustypes=12&hostprops=262144 CGI Data: None
ERROR: 2013-07-15 15:38:18.841000 Icinga Traceback (most recent call last):
File "c:\Nagstamon\build\build\pyi.win32\nagstamon\out00-PYZ.pyz\Nagstamon.Server.Icinga", line 361, in _get_status_HTML
UnboundLocalError: local variable 'htobj' referenced before assignment
DEBUG: 2013-07-15 15:38:18.841000 Icinga server return values:
DEBUG: 2013-07-15 15:38:18.841000 Icinga Refreshing output - server is already checking: False
ERROR: 2013-07-15 15:38:18.861000 Icinga Infra Traceback (most recent call last):
File "c:\Nagstamon\build\build\pyi.win32\nagstamon\out00-PYZ.pyz\Nagstamon.Server.Icinga", line 292, in _get_status_HTML
KeyError: 1
ERROR: 2013-07-15 15:38:18.861000 Icinga Infra Traceback (most recent call last):
File "c:\Nagstamon\build\build\pyi.win32\nagstamon\out00-PYZ.pyz\Nagstamon.Server.Icinga", line 361, in _get_status_HTML
UnboundLocalError: local variable 'htobj' referenced before assignment
DEBUG: 2013-07-15 15:38:18.861000 Icinga Infra server return values:
DEBUG: 2013-07-15 15:38:18.861000 Icinga Infra Refreshing output - server is already checking: False
It would be great if at least previous functionality could be restored until host groups get implemented.
from nagstamon.
What does your custom CGI_URL look like?
Please consider testing latest Github commit 29bc1ca where the htobj bug should be fixed.
from nagstamon.
Here it is (hostname sanitized):
http://my.icinga.server/icinga/cgi-bin/status.cgi?hostgroup=own_Infrastructure%2FHosts&style=detail&servicestatustypes=28&serviceprops=10&hostprops=10
I've also tested with the 12th of July build and still doesn't work.
from nagstamon.
Check it out from Github - just the source at the moment is changed.
from nagstamon.
Ok, I just did a git clone then ran it. Here's the output:
DEBUG: 2013-07-16 12:23:03.434000 Icinga Created server.
DEBUG: 2013-07-16 12:23:03.444000 Icinga Infra Created server.
DEBUG: 2013-07-16 12:23:03.554000 Icinga Infra FetchURL: http://my.icinga.server/icinga/cgi-bin/status.cgi?hostgroup=own_Infrastructure%2FHosts&style=detail&servicestatustypes=28&serviceprops=10&hostprops=10/tac.cgi?jsonoutput CGI Data: None
DEBUG: 2013-07-16 12:23:03.554000 Icinga FetchURL: http://my.icinga.server/icinga/cgi-bin/status.cgi?hostgroup=own_Infra&style=detail&servicestatustypes=28&serviceprops=10&hostprops=10/tac.cgi?jsonoutput CGI Data: None
DEBUG: 2013-07-16 12:23:03.554000 Checking for new version...
DEBUG: 2013-07-16 12:23:03.554000 Icinga Infra FetchURL: https://nagstamon.ifw-dresden.de/files-nagstamon/latest_version_0.9.11-devel CGIData: None
DEBUG: 2013-07-16 12:23:16.076000 Icinga Infra FetchURL: http://my.icinga.server/icinga/cgi-bin/status.cgi?hostgroup=own_Infrastructure%2FHosts&style=detail&servicestatustypes=28&serviceprops=10&hostprops=10/status.cgi?style=hostdetail&hoststatustypes=12&hostprops=262144 CGI Data: None
DEBUG: 2013-07-16 12:23:16.236000 Icinga FetchURL: http://my.icinga.server/icinga/cgi-bin/status.cgi?hostgroup=own_Infra&style=detail&servicestatustypes=28&serviceprops=10&hostprops=10/status.cgi?style=hostdetail&hoststatustypes=12&hostprops=262144 CGI Data: None
ERROR: 2013-07-16 12:23:17.906000 Icinga Infra Traceback (most recent call last):
File "D:\cygwin\home\aneagoe\checkouts\Nagstamon\Nagstamon\Nagstamon\Server\Icinga.py", line 280, in _get_status_HTML
trs.pop(0)
IndexError: pop from empty list
DEBUG: 2013-07-16 12:23:17.906000 Icinga Infra server return values:
DEBUG: 2013-07-16 12:23:17.906000 Icinga Infra Refreshing output - server is already checking: False
ERROR: 2013-07-16 12:23:17.986000 Icinga Traceback (most recent call last):
File "D:\cygwin\home\aneagoe\checkouts\Nagstamon\Nagstamon\Nagstamon\Server\Icinga.py", line 280, in _get_status_HTML
trs.pop(0)
IndexError: pop from empty list
DEBUG: 2013-07-16 12:23:17.986000 Icinga server return values:
DEBUG: 2013-07-16 12:23:17.986000 Icinga Refreshing output - server is already checking: False
Looking closer at FetchURL, I noticed it's adding part of the URL again (status.cgi shows up twice in URL):
http://my.icinga.server/icinga/cgi-bin/status.cgi?hostgroup=own_Infra&style=detail&servicestatustypes=28&serviceprops=10&hostprops=10/status.cgi?style=hostdetail&hoststatustypes=12&hostprops=262144
from nagstamon.
Well, adding Nagstamons' own status cgi stuff makes sense as it just takes the given CGI_URL expecting it being the CGI root. I even wonder how it worked in your setup at all before...
from nagstamon.
Not really sure, but used to work like a charm in 0.9.9. I'll try to get that and compare DEBUG outputs... maybe it reveals a clue.
from nagstamon.
Although just partial (only Icinga and without GUI update function) I've created the following patch for hostgroup support. It's quite basic but does the trick, so if you've got time please consider including.
--- Nagstamon.orig/Nagstamon/Nagstamon/Actions.py 2013-07-17 14:28:40.507608100 +0200
+++ Nagstamon/Nagstamon/Nagstamon/Actions.py 2013-07-16 18:06:34.316365300 +0200
@@ -715,6 +715,7 @@
nagiosserver.type = server.type
nagiosserver.monitor_url = server.monitor_url
nagiosserver.monitor_cgi_url = server.monitor_cgi_url
+ nagiosserver.hostgroup = server.hostgroup
# add resources, needed for auth dialog
nagiosserver.Resources = resources
nagiosserver.username = server.username
diff -ur Nagstamon.good/Nagstamon/Nagstamon/Config.py Nagstamon/Nagstamon/Nagstamon/Config.py
--- Nagstamon.good/Nagstamon/Nagstamon/Config.py 2013-07-17 14:28:40.507608100 +0200
+++ Nagstamon/Nagstamon/Nagstamon/Config.py 2013-07-16 18:05:24.747267400 +0200
@@ -495,6 +495,7 @@
self.servers[server_name].name = server_name
self.servers[server_name].monitor_url = self.nagios_url
self.servers[server_name].monitor_cgi_url = self.nagios_cgi_url
+ self.servers[server_name].hostgroup = self.hostgroup
self.servers[server_name].username = self.username
self.servers[server_name].password = self.password
# convert VERY old config files
@@ -685,6 +686,7 @@
self.name = ""
self.monitor_url = ""
self.monitor_cgi_url = ""
+ self.hostgroup = ""
self.username = ""
self.password = ""
self.save_password = True
diff -ur Nagstamon.good/Nagstamon/Nagstamon/Server/Icinga.py Nagstamon/Nagstamon/Nagstamon/Server/Icinga.py
--- Nagstamon.good/Nagstamon/Nagstamon/Server/Icinga.py 2013-07-17 14:28:40.517608200 +0200
+++ Nagstamon/Nagstamon/Nagstamon/Server/Icinga.py 2013-07-16 18:11:58.491821600 +0200
@@ -97,12 +97,16 @@
# hosts (up or down or unreachable)
self.cgiurl_hosts = {"hard": self.monitor_cgi_url + "/status.cgi?style=hostdetail&hoststatustypes=12&hostprops=262144",\
"soft": self.monitor_cgi_url + "/status.cgi?style=hostdetail&hoststatustypes=12&hostprops=524288"}
+ if self.hostgroup:
+ for status_type in "hard", "soft":
+ self.cgiurl_services[status_type] += "&hostgroup=" + self.hostgroup
+ self.cgiurl_hosts[status_type] += "&hostgroup=" + self.hostgroup
+
if self.json:
for status_type in "hard", "soft":
self.cgiurl_services[status_type] += "&jsonoutput"
self.cgiurl_hosts[status_type] += "&jsonoutput"
-
def _get_status(self):
"""
Get status from Icinga Server, prefer JSON if possible
from nagstamon.
Thank you. I will check this when back to work.
from nagstamon.
Is this meant to work only with one hostgroup?
from nagstamon.
Yes. Until now I didn't know you can use more than one at a time but I just checked and that's possible. The way I use it is to specify two server definitions in Nagstamon. Like this the hostgroups are clearly delimited and visible. However, I recon it's also possible to create a list of hostgroups, iterate through it and append to URL (more appealing for users who need to see a lot of hostgroups).
I also wasn't sure how to handle versions older than 1.7, so there the behavior is not modified.
Wish I could help more, but I'm not very familiar with python or programming for that matter :)
from nagstamon.
Hm... every Nagios derivatives seems to handle hostgroups differently... I want at least Nagstamon having kind of a unified interface to hostgroups, but this looks like a bigger task. :-(
Anyway, why don't you just define the hostgroups that interest you for your username in Icinga monitor? Wouldn't this be the easiest way to focus one user to some hostgroups?
from nagstamon.
Had a quick look at the code and they all seem to be different (Centreon, Ninja etc.). This patch could easily be extended to Nagios.py but the rest look completely different and I got nothing to test on.
I'll also look at what you suggested, but for me the problem is solved anyway (I can just apply the patch I posted here).
from nagstamon.
A solution might be to give desired hostgroups in server settings dialog and run a loop through all given hostgroups and request their stauts like
for hg in hostgroups:
get_status(hg)
Default will be "all". This of course will increase the number of requests to the poor monitor server.
from nagstamon.
Well, not exactly. At least for Icinga, things can go better, by adding more hostgroup definition to the URL like this:
http://my.icinga.server/icinga/cgi-bin/status.cgi?hostgroup=Hgroup1&hostgroup=Hgroup2&hostgroup=Hgroup3&style=detail&servicestatustypes=28&serviceprops=10&hostprops=10&scroll=0
I've already tested this and it works just fine, but I'm not sure about the rest (I guess it also works for nagios).
In this case, the following might do the trick when multiple hostgroups are defined:
for hg in self.hostgroup:
for status_type in "hard", "soft":
self.cgiurl_services[status_type] += "&hostgroup=" + hg
self.cgiurl_hosts[status_type] += "&hostgroup=" + hg
from nagstamon.
I've picked this up again and made a more complete implementation of hostgroups for Icinga. I've sent the patch your way for review.
The code now allows for hostgroup adding/editing (in Settings->Server->Edit) and one can specify multiple hostgroups per server definition. For Icinga, as discussed earlier it's not necessary to make a request for every hostgroup definition and the code respects that (it just builds the correct url containing all specified hostgroups).
Although I understand your concern that hostgroups should be unified, I don't think that's straightforward since every monitor handles them differently like you already pointed out. If we specify hostgroups the same way in nagstamon but handle them differently in the Server part (ie Server/Icinga.py) that should be good enough, right?
from nagstamon.
Related Issues (20)
- Nagstamon v.3.14.0 problems to show services HOT 1
- Recheck not working on Thruk 3.12 HOT 6
- Nagstamon 3.14 inplace upgrade No longer working with Thruk instance. HOT 4
- Nagstamon 3.14 not starting since Plasma 6 HOT 34
- Nagstamon 3.14 - Changing network does not refresh the application
- Nagstamon 3.14.0 and 3.10.1 not working with Zabbix 6.4.12 HOT 10
- Nagstamon-3.14.0-win64_setup.exe and threat W64/S-e4cd4610!Eldorado HOT 5
- nagstamon v3.14.0 on Win11 23H2 - icinga KeyError host_name HOT 1
- 3.14 locks up at start HOT 4
- Updating nagstatmon from 3.10.1 to 3.14.0 breaks on Windows 2022 HOT 1
- Nagstamon 3.14.0 and Zabbix 6.2.9 - All information copy not complate
- Regex duration issue
- ValueError when parsing QT_VERSION_STR HOT 8
- AttributeError with Icinga DB 1.2.0 / Icinga DB Web 1.1.2 HOT 2
- Help for integration HOT 3
- [Feature][Integration] Opsgenie HOT 1
- Display own columns from check_MK view in nagstamon HOT 1
- Sorting by duration not saved when restarting nagstamon (minor cosmetic problem) HOT 2
- Nagstamon 3.15-20240506, Fedora 40, Couldn't load VAAPI library HOT 4
- MacOS 14.5 no sound
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nagstamon.