Nagstamon
Nagstamon copied to clipboard
"Use Proxy" option not working
We have several firewallrules in our company so that most internal an external URIs are only accessible via proxy. Direct connections are blocked. While accessing icingaweb in the browser works fine via proxy, nagstamon doesn't even use the proxy configuration. We tried the "Use Proxy from OS" option, also as manually configuring the proxy settings. Doesn't matter, nagstamon still tries to connect directly. Is there a known bug for this behaviour? Or am I missing something?
Which monitoring server do you use?
Icinga2 Am 7. Aug. 2022, 09:07 +0200 schrieb Henri Wahl @.***>:
Which monitoring server do you use? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Icinga2
I assume with IcingaWeb2 monitor in Nagstamon?
Could you please provide some debugging output by enable debugging in the settings dialog of Nagstamon?
Sorry for the late reply. It's kind of difficult to get the users to talk who are affected by this. The it center core team has direct http access to icingaweb2, but all others have to go over the proxy, especially when coming in over vpn. It doesn't matter if they configure to use os proxy settings or setting the proxy manually, nagstamon dismisses these settings and try directly. We were able to see this on our firewall, where the direct connections are blocked and the nagstamon runs into timeout. I already installed Version 3.10, but the issue is still the same. I'll try further to get some logs. but maybe you have already an clue where to search for the issue.
Here is the Debugoutput of Nagstamon
DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DD74CA0> for state "OK" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DD74E50> for state "INFORMATION" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DD74820> for state "UNKNOWN" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC691B0> for state "WARNING" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC692D0> for state "AVERAGE" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC69360> for state "HIGH" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC693F0> for state "CRITICAL" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC69480> for state "DISASTER" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC69510> for state "UNREACHABLE" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC695A0> for state "DOWN" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC69630> for state "ERROR" DEBUG: 2023-01-12 07:05:18.301168 Saving configuration to file c:\users\stopsaka.nagstamon\nagstamon.conf DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DD74DC0> for state "OK" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DD756C0> for state "INFORMATION" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DD74CA0> for state "UNKNOWN" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DD74E50> for state "WARNING" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DD74820> for state "AVERAGE" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC691B0> for state "HIGH" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC692D0> for state "CRITICAL" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC69360> for state "DISASTER" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC693F0> for state "UNREACHABLE" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC69480> for state "DOWN" DEBUG: SystemTrayIcon created icon <Nagstamon.QUI.QIconWithFilename object at 0x000002540DC69510> for state "ERROR" DEBUG: 2023-01-12 07:05:18.309861 Icinga2 Refreshing all hosts and services DEBUG: 2023-01-12 07:05:19.093771 Icinga2 FetchURL: https://icinga2.augsburg.de/icingaweb2/authentication/login CGI Data: None ERROR: 2023-01-12 07:05:29.106417 Icinga2 Traceback (most recent call last): File "urllib3\connection.py", line 174, in _new_conn File "urllib3\util\connection.py", line 95, in create_connection File "urllib3\util\connection.py", line 85, in create_connection TimeoutError: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "urllib3\connectionpool.py", line 703, in urlopen File "urllib3\connectionpool.py", line 386, in _make_request File "urllib3\connectionpool.py", line 1042, in _validate_conn File "urllib3\connection.py", line 358, in connect File "urllib3\connection.py", line 179, in _new_conn urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x000002540DD89C60>, 'Connection to icinga2.augsburg.de timed out. (connect timeout=10)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "requests\adapters.py", line 489, in send File "urllib3\connectionpool.py", line 787, in urlopen File "urllib3\util\retry.py", line 592, in increment urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='icinga2.augsburg.de', port=443): Max retries exceeded with url: /icingaweb2/authentication/login (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000002540DD89C60>, 'Connection to icinga2.augsburg.de timed out. (connect timeout=10)'))_
I think we just found the problem. When defining the proxy manually http://
As Windows itself delivers/saves the proxy config without the ending "/", but nagstamon needs the "/", the option "Use proxy from OS" will not work. Perhaps you shouldn't expect the "/" as mandatory for proxy configuration to work.
Hi @robertkrenn, thanks for investigating.
When set to use OS proxy the property trust_env
of the uses requests library is set: https://requests.readthedocs.io/en/latest/api/#requests.Session.trust_env.
This means Nagstamon does not know about the proxy because the underlaying library cares about.
The configuration is evaluated in https://github.com/HenriWahl/Nagstamon/blob/master/Nagstamon/Servers/Generic.py#L334-L337.
Looks like this should be extended not to let requests do the work, at least at Windows. Then there must be found out how to get the proxy settings from OS. Finally I found the method https://docs.python.org/3/library/urllib.request.html#urllib.request.getproxies being used, which on Windows looks into the registry to find information about the used proxy. This one again uses request.getproxies()
from standard library urllib so I think one could use this call to and add the needed /
.
Tried to apply in https://github.com/HenriWahl/Nagstamon/tree/proxy-issue-825 - can you please check this from source in your environment?
@robertkrenn did this finally work?
We finally go with the manual proxy settings an the final „/“. This works for us Am 18. März 2023, 13:33 +0100 schrieb Henri Wahl @.***>:
@robertkrenn did this finally work? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@robertkrenn does it work without "/" now too?
I have the same problem with proxy: (Caused by ProxyError('Unable to connect to proxy', OSError('Tunnel connection failed: 407 Proxy Authentication Required') I use the " Use proxy from OS" or username, password and proxy address option in Nagstamon 3.12.0 but i have the same issue
The message
407 Proxy Authentication Required
indicates some server response - any idea what causes it?
The message
407 Proxy Authentication Required
indicates some server response - any idea what causes it?
I think it's an authentication error with the proxy. In my office we use a proxy with WEB authentication. I enter the credentials in the Nagstamon proxy configuration but the message always appears.
What credentials are needed for the proxy? Might they be wrong?
What credentials are needed for the proxy? Might they be wrong?
each user has their own credentials to access the proxy and have free access to the internet. these credentials are entered in the settings of each program to use the internet. The credentials are correct and have been checked multiple times.
@Stonerpr91 what monitoring server type do you use?
@Stonerpr91 what monitoring server type do you use?
Nagios monitoring type
@Stonerpr91 as a workaround: did you try @robertkrenn 's trick with the trailing /
?
@Stonerpr91 please try latest testing release 2.13-20231030.