Monitoring Windows server - Can't detect Ops agent | C2C Community
Solved

Monitoring Windows server - Can't detect Ops agent

  • 21 September 2022
  • 14 replies
  • 93 views

Userlevel 2

Hello,

I am trying to monitor a Windows server VM on GCP. I installed the agent and it seems that it is running.

Screenshot 2022-09-20 7.01.33 PM.png

But from the monitoring page it is not detected.

Screenshot 2022-09-20 7.10.12 PM.png

I noticed the following error on the server. Screenshot 2022-09-20 7.02.11 PM.png

 Can anyone help me to solve this?

icon

Best answer by seijimanoan 22 September 2022, 14:45

View original

14 replies

Userlevel 7
Badge +17

Hi @ahmedadelfrg ,

Thank you for the question. Based on your screenshot, I'm simply attempting to debug your question. Please ensure that you follow any possible hints in order to solve the question.

 

First of all, If you make any configuration changes, you must restart the agent to apply the updated configurations.

Google Note :

There will be no new feature development for the Monitoring agent for Windows. We recommend that you use the Ops Agent for new workloads and eventually transition your existing VMs to use the new agent.

 

I don’t know which server configuration are you using but Google cloud doc says-

n1-standard-1 virtual machines are too small to run Windows and the Ops Agent, so you must use a larger VM.

 

if it still not detect Then try following step:

 

Make sure you have install the agent, with the following option:

Important Hints: 

  • Not detected showing your invetory tab details: You don't have an agent installed. If Cloud Monitoring doesn't detect any agents installed on the Compute Engine instance, then you can install an agent by doing the following:

    • Select the VM instances on which you want to install agents.
    • Click the Install/update agents option on the Instances table, which brings up an installation workflow in the dashboard, and follow the instructions.

      You can also install or update agents from the VM Details page for a specific VM.

      The Ops Agent collects both metrics and logs by default. You can change this default behavior by configuring the Ops Agent.

  • Ops Agent: You are running the Ops Agent. If you don't see a green checkmark beside the entry, then there is an agent upgrade available, based on the detected operating system of your VM.

    When you hover over the Ops Agent indicator in the table, you see information about the version of the Ops Agent. If you are running an older version, you also see a recommendation to upgrade your agent.

Secondly, Check your Windows VM instance images compatibility with ops agent.

Based on Google cloud documentation

The agent supports the following Windows operating systems:

  • Windows Server: windows-2012-r2, windows-2016, windows-2019
  • Windows Server Core: windows-2012-r2-core, windows-2016-core, windows-2019-core, windows-20h2-core

 

Also, You should check the Agent access requirements:

 

Installing the agent requires access to the following DNS name:

  • Google Cloud package repository: packages.cloud.google.com

Running the agent requires access to the following DNS names:

  • OAuth2 token server: www.googleapis.com

  • Monitoring APIs: monitoring.googleapis.com

  • Logging APIs: logging.googleapis.com

To fix this error, enable the Logging API and set the Logs Writer role.

To fix this error, enable the Monitoring API and set the Monitoring Metric Writer role.

If it still not working then don’t forget to check the following port:

Running the agent requires the following ports to be open on the machine:

  • 20201

  • 20202

If it is still not work then check below step:
Have you run Sysprep before creating the image (https://cloud.google.com/compute/docs/instances/windows/creating-windows-os-image)?

Configuring an HTTP proxy

If you use an HTTP proxy, run the following command from an administrator command prompt. This sets the HTTP_PROXY and HTTPS_PROXY environment variables so that the agent can send data using outbound HTTPS:

 

 

 

setx HTTP_PROXY http://proxy-ip

:proxy-port

/m
setx HTTPS_PROXY http://proxy-ip

:proxy-port

/m
setx no_proxy metadata.google.internal /m

Determining the agent version

Run the following command on Windows:

googet installed google-cloud-ops-agent

Restarting the agent

  1. Connect to your instance using RDP or a similar tool and login to Windows.

  2. Open a PowerShell terminal with administrator privileges by right-clicking the PowerShell icon and selecting Run as Administrator.

  3. Run the following PowerShell command:

 

 
Restart-Service google-cloud-ops-agent -Force

 

To upgrade to the latest agent release:

  1. Connect to your instance using RDP or a similar tool and login to Windows.

  2. Open a PowerShell terminal with administrator privileges by right-clicking the PowerShell icon and selecting Run as Administrator.

Note: If you're upgrading your agent from a version earlier than 2.0.3 to version 2.0.3 or later, the upgrade removes the old config file. If you customized your agent configuration, be sure to save a backup of your configuration file before upgrading, and then to apply the necessary changes to the configuration file after the upgrade.

Copy-Item -Path "C:\Program Files\Google\Cloud Operations\Ops Agent\config\config.yaml" -Destination "C:\Program Files\Google\Cloud Operations\Ops Agent\config\config.bak"

Run the following PowerShell commands to remove your installed agent and to run the installation command:

googet -noconfirm remove google-cloud-ops-agent
googet -noconfirm install google-cloud-ops-agent

I hope it will help you to overcome the issue. If you're still facing difficulties please share more about your server configuration and third-party uses. ​

Extra Credit:

https://cloud.google.com/monitoring/agent/ops-agent/configuration#logging-config

https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/configuration#windows

https://cloud.google.com/logging/docs/agent/ops-agent/troubleshooting#data-not-ingested

https://lantern.splunk.com/Observability/Use_Cases/Investigation_and_Troubleshooting/Deploying_and_troubleshooting_OpenTelemetry_successfully

 

 

Userlevel 7
Badge +58

Hi @ahmedadelfrg,

have you checked @malamin’s answer? It help you?

Userlevel 2

I restarted the server but it still did not detected the Ops agent. I think the issue on the following:

 

 

Installing the agent requires access to the following DNS name:

  • Google Cloud package repository: packages.cloud.google.com

Running the agent requires access to the following DNS names:

  • OAuth2 token server: www.googleapis.com

  • Monitoring APIs: monitoring.googleapis.com

  • Logging APIs: logging.googleapis.com

To fix this error, enable the Logging API and set the Logs Writer role.

To fix this error, enable the Monitoring API and set the Monitoring Metric Writer role.

If it still not working then don’t forget to check the following port:

Running the agent requires the following ports to be open on the machine:

  • 20201

  • 20202

 

How can allow these names on a windows server? and also how I can open ports?

Userlevel 6
Badge +6

I restarted the server but it still did not detected the Ops agent. I think the issue on the following:

 

 

Installing the agent requires access to the following DNS name:

  • Google Cloud package repository: packages.cloud.google.com

Running the agent requires access to the following DNS names:

  • OAuth2 token server: www.googleapis.com

  • Monitoring APIs: monitoring.googleapis.com

  • Logging APIs: logging.googleapis.com

To fix this error, enable the Logging API and set the Logs Writer role.

To fix this error, enable the Monitoring API and set the Monitoring Metric Writer role.

If it still not working then don’t forget to check the following port:

Running the agent requires the following ports to be open on the machine:

  • 20201

  • 20202

 

How can allow these names on a windows server? and also how I can open ports?

 

Hey, how are you @ahmedadelfrg ?

As @malamin replied, maybe you can begin with

  • To fix this error, enable the Logging API and set the Logs Writer role.
  • To fix this error, enable the Monitoring API and set the Monitoring Metric Writer role.

Be sure your project has those APIs enabled. Just search for “Cloud Logging API” and enable that. And add Logs Writer role to the VM service account.

So search for “Stackdriver Monitoring API” and enable that. And add Monitoring Metric Writer role to the VM service account.

Ps. About the DNS entries, try to ping’em and resolve their DNS (nslookup) for double check.

Userlevel 7
Badge +58

Great answer. Thanks @seijimanoan 

Hi @ahmedadelfrg. Is @seijimanoan’s answer helpful?

Userlevel 2

Thank you so much for your support. It works now ❤

Userlevel 7
Badge +17

You’re Superman! @ahmedadelfrg.  I'm glad to hear you've resolved the issue.

Otherwise, I'm attempting to write an answer to your second question about how to open the ports for you.

 

 

 

Userlevel 7
Badge +17

Thank you very much, @ilias  and @seijimanoan , for your help with this post. It was wonderful to interact with each other in this post.

Also, I agreed with @ilias  about @seijimanoan  pointing out the correct point in the answer. It was fantastic.

 

Userlevel 2

Thank you @malamin, I also have another question. Can I monitor an on-prem Windows server with this Ops agent? Is it the same process? 

Userlevel 7
Badge +58

Great to hear - read that your problem was solved @ahmedadelfrg 😁

Thanks for your help @malamin & @seijimanoan 👏 Can you check the new question that @ahmedadelfrg wrote?

Thank you @malamin, I also have another question. Can I monitor an on-prem Windows server with this Ops agent? Is it the same process? 

 

Userlevel 6
Badge +6

Great to hear - read that your problem was solved @ahmedadelfrg 😁

Thanks for your help @malamin & @seijimanoan 👏 Can you check the new question that @ahmedadelfrg wrote?

Thank you @malamin, I also have another question. Can I monitor an on-prem Windows server with this Ops agent? Is it the same process? 

 

Good morning from Brazil, my friends :)

@ahmedadelfrg You would need some Network knowledge to set up that as desired.

Two resources below to figure it out:

  • On this link, pay attention for Agent access requirements.
  • To achieve that, so you need to set up a Cloud VPN or Cloud Interconnect with your on-premise network. And establish all the needed routes with BGP propagation et cetera. This second resource, Configure Private Google Access for on-premises hosts, explains further.

I hope it helps.

Userlevel 7
Badge +58

Thanks for your quick response @seijimanoan 😉

And it’s just 09:48 am there now.

 

Userlevel 7
Badge +17

Good morning from Brazil, my friends :)

@ahmedadelfrgYou would need some Network knowledge to set up that as desired.

Two resources below to figure it out:

  • On this link, pay attention for Agent access requirements.
  • To achieve that, so you need to set up a Cloud VPN or Cloud Interconnect with your on-premise network. And establish all the needed routes with BGP propagation et cetera. This second resource, Configure Private Google Access for on-premises hosts, explains further.

 

Hi@ahmedadelfrg. I hope @seijimanoan’s answer will help you. 

Userlevel 2

Thank you @malamin for your reply from Egypt :)

There is a Cloud VPN connection already between my VPC and on-prem network. How can I establish the connection to the monitor dashboard? I want to track network load on multiple on-prem servers.

Reply