1. Support
  2. Knowledge base
  3. Infra
  4. Agent
  5. Connecting the agent through an http proxy server

Connecting the agent through an HTTP proxy server

The Uptrends Infra agent is optimized for secure network environments by connecting outward through HTTPS connections to our cloud servers. Infra agents will push the data they’ve collected to our cloud by initiating an outgoing HTTPS connection, and then pushing the data to our collector service. This way, most firewalls already allow our traffic to pass without any additional configuration.

However, if your organization’s network security policies require all outbound Internet traffic to go through a proxy server, you will need to configure the agent to explicitly use this proxy server.

Two different proxy settings are available for the Infra agent:

  • Covering all agent traffic, including traffic between the agent and sensors, and traffic between the agent and the collector service.
  • Covering only traffic between the agent and the collector service (sensor-related traffic will not go through the proxy server).

Configuring the agent

In order to tell the agent which proxy server to use, you need to create a configuration file in the installation directory of the Uptrends Infra agent. By default, the installation directory would be C:\Program Files\Uptrends Infra Agent for Windows, and \opt\UptrendsInfraAgent for the Linux version.

  1. Using a text editor (e.g. Notepad or Vim), create a new text file named appsettings.json, and paste the following content:

    To configure a proxy for all traffic (between the agent and both the sensors and the collector service):

        {
            "DefaultProxy": {
                "UseProxy": true,
                "ProxyUrl": "http://hostname:port",
                "BypassProxyOnLocal": false,
                "BypassList": [ "" ]
            }
        }

To configure a proxy for only traffic to and from the collector service (sensor-related traffic will not go through the proxy server):

        {
            "CollectorSettings": {
                "Proxy": {
                        "UseProxy": true,
                        "ProxyUrl": "http://hostname:port"
                }
            }                        
        }
  1. In the ProxyUrl field, replace the words hostname and port with the actual host name and port number for your organization’s proxy server.

  2. If you configured the DefaultProxy you can edit the BypassList to allow certain URIs to not use the proxy if needed.

  3. Save the file and restart the UptrendsInfraAgent service to reload the new configuration.

    On Windows, you can use the Restart Uptrends Infra Agent shortcut to restart the agent.

    On Linux, when running the agent as a service, you restart the agent by first stopping it using the command systemctl stop uptrendsinfra and then starting it by using the command systemctl start uptrendsinfra.

    On Linux, in case you are running in console mode the process is slightly different. You have to stop the agent, change and save the settings, and then start the agent again. The agent is started in console mode by the command /opt/UptrendsInfraAgent/Uptrends.Infra.Agent console, stopped with the stop command and started with the start command. You can leave the console mode by selecting the Q key. Note that running the agent as a service is the most common way.

Configuring the agent guard

The agent guard is a service running alongside the Infra agent, to make sure that the agent functions correctly and regulating the agent’s automatic updating process. This tool downloads such updates from our page, and so will also need to be configured to make use of the proxy. To configure use of a proxy for the agent guard, follow these steps:

  1. In the agent guard installation directory (C:\Windows\Uptrends Infra Agent\AgentGuard for Windows, and \opt\UptrendsInfraAgent\AgentGuard on Linux), use a text editor (such as Notepad or Vim) to create a new file named appsettings.json.

  2. In this newly created file, paste the following:

        {
            "DefaultProxy": {
                "UseProxy": true,
                "ProxyUrl": "http://hostname:port",
            }
        }
  1. In the ProxyUrl field, replace the words hostname and port with the actual host name and port number for your organization’s proxy server.

  2. Save the file, and restart the agent service as described above.

Registering the agent through a proxy (Windows only)

If you still need to register the agent, this is done using a separate application Register agent (on Windows only - the Linux agent is registered directly through the console). This application should also contact our servers through the proxy, and this must be set up separately.

  1. In the C:\Program Files\Uptrends Infra Agent\RegisterAgent folder, create a new file Uptrends.Infra.RegisterAgent.dll.config.

  2. Paste the following into that file:

        <?xml version="1.0" encoding="utf-8" ?>
        <configuration>
            <configSections>
                <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" >
                    <section name="Uptrends.Infra.RegisterAgent.Properties.RegisterAgentSettings" type="System.Configuration.ClientSettingsSection, System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
                </sectionGroup>
                <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" >
                    <section name="Uptrends.Infra.RegisterAgent.Properties.RegisterAgentSettings" type="System.Configuration.ClientSettingsSection, System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" requirePermission="false" />
                </sectionGroup>
            </configSections>
            <applicationSettings>
                <Uptrends.Infra.RegisterAgent.Properties.RegisterAgentSettings>
                    <setting name="UseProxy" serializeAs="String">
                        <value>True</value>
                    </setting>
                    <setting name="ProxyUrl" serializeAs="String">
                        <value>http://localhost:8877</value>
                    </setting>
                </Uptrends.Infra.RegisterAgent.Properties.RegisterAgentSettings>
            </applicationSettings>
        </configuration> 
  1. In the ProxyUrl field, replace the words hostname and port with the actual host name and port number for your organization’s proxy server.

  2. Save the file, and register the agent as you normally would.

Service account authorizations (Windows only)

By default, the Uptrends Infra agent service runs under the Local System account. This account may not have the correct authorizations to connect to the Internet through your proxy server. If you encounter any problems or error messages, make sure that the Local System account has the appropriate proxy authorizations.

  • You can use Microsoft Sysinternals PsExec to run a session of Internet Explorer as Local System (command: psexec -s -i "%programfiles%\Internet Explorer\iexplore.exe"). This serves a dual purpose:

    • To enter (and save) the credentials for use when connecting to the proxy server
    • To confirm connectivity with the internet through the proxy.
  • You can also configure the agent to log in under a different account that has the required authorizations to use the proxy server. Please be aware that the service account is also the default account used for all monitoring checks. You can enter alternative sets of credentials through the Uptrends Infra web application.

By using the Uptrends website, you consent to the use of cookies in accordance with our Cookie Policy.