Install Sensu Agent on Windows systems

0
2

This guide is about how to install Sensu agent on Windows systems. To be able to start collecting remote Windows system metrics for monitoring using Sensu Go server, you need to install Sensu agents on the hosts being monitored.

Install Sensu Agent on Windows systems

Before you can install Sensu agent on Windows system, ensure that you have a Sensu Go backend server running.

The guide on the link below provide easy steps to setup Sensu Go backend server.

Install Sensu Go on Ubuntu 22.04

Install Sensu Go on Debian 11

Next, then install Sensu agent on Windows system and start to collect and monitor system metrics.

We will simplify the agent installations via the Powershell. If you want, you can download the agent and install it the traditional way of double click to install and go through the installation next, next…

We are using Windows 10 in this setup.

Thus, launch Powershell as administrator.

Run the command below to download the current release version of Sensu agent Windows installer. You can subtitute the link and the name of the agent as per the current release version number.

Invoke-WebRequest https://s3-us-west-2.amazonaws.com/sensu.io/sensu-go/6.7.1/sensu-go-agent_6.7.1.6231_en-US.x64.msi  -OutFile "$env:userprofile\sensu-go-agent_6.7.1.6231_en-US.x64.msi"

Next, install Sensu agent on Windows system;

msiexec.exe /i $env:userprofile\sensu-go-agent_6.7.1.6231_en-US.x64.msi /qn

Next, confirm the agent installations;

Get-Package -Name *sensu*

Sample output;

Name                           Version          Source                           ProviderName
----                           -------          ------                           ------------
Sensu Agent                    6.7.1.6231       C:\Program Files\Sensu\sensu-... msi

Configure Sensu Agent on Windows

Rename the sample Sensu configuration file, C:\ProgramData\sensu\config\agent.yml.example, to C:\ProgramData\sensu\config\agent.yml by removing the .example extension.

cp C:\ProgramData\sensu\config\agent.yml.example C:\ProgramData\sensu\config\agent.yml

Next, open the file for editing and define the Senso Go backend URL;

notepad.exe C:\ProgramData\sensu\config\agent.yml
##
# agent configuration
##
backend-url:
  - "ws://192.168.56.129:8081"

Save the file once you have made the changes.

Install Sensu Agent Service on Windows

Next, navigate to Sensu binary directory and install it as a service;

cd 'C:\Program Files\sensu\sensu-agent\bin'
.\sensu-agent.exe service install

The command will install and start Sensu agent service.

Confirm Sensu agent service installation;

Get-Service -Name *sensu*
Status   Name               DisplayName
------   ----               -----------
Running  SensuAgent         Sensu Agent

You can tail the logs;

Get-Content C:\ProgramData\Sensu\log\sensu-agent.log -Tail 50

Sample output;

{"component":"cmd","level":"info","logger-config":{"Path":"C:\\ProgramData\\sensu\\log\\sensu-agent.log","MaxSizeBytes":134217728,"RetentionDuration":604800000000000,"RetentionFiles":10},"msg":"logging to file","time":"2022-05-07T22:09:48+03:00"}
{"component":"cmd","level":"info","msg":"sensu-agent service starting","time":"2022-05-07T22:09:49+03:00"}
{"component":"agent","level":"info","msg":"compacting api queue","time":"2022-05-07T22:09:49+03:00"}
{"component":"agent","level":"info","msg":"finished api queue compaction","time":"2022-05-07T22:09:50+03:00"}
{"component":"agent","level":"info","msg":"using password auth","time":"2022-05-07T22:09:50+03:00"}
{"component":"agent","level":"info","msg":"configuration successfully validated","time":"2022-05-07T22:09:50+03:00"}
{"component":"agent","level":"info","msg":"starting statsd server on address: 127.0.0.1:8125","time":"2022-05-07T22:09:50+03:00"}
{"component":"agent","event":{"Title":"Gostatsd started","Text":"Gostatsd started","DateHappened":1651950590,"Hostname":"WorkBox","AggregationKey":"","SourceTypeName":"","Tags":null,"SourceIP":"","Priority":1,"AlertType":0},"level":"info","msg":"statsd received an eve
,"time":"2022-05-07T22:09:50+03:00"}
{"component":"agent","level":"info","msg":"starting UDP listener on address: 127.0.0.1:3030","time":"2022-05-07T22:09:50+03:00"}
{"component":"agent","level":"info","msg":"starting api on address: 127.0.0.1:3031","time":"2022-05-07T22:09:50+03:00"}
{"component":"agent","level":"info","msg":"starting TCP listener on address: 127.0.0.1:3030","time":"2022-05-07T22:09:50+03:00"}
{"component":"agent","level":"info","msg":"connecting to backend URL \"ws://192.168.56.129:8081\"","time":"2022-05-07T22:09:50+03:00"}
{"component":"agent","level":"info","msg":"successfully connected","time":"2022-05-07T22:09:51+03:00"}
{"component":"agent","content_type":"application/octet-stream","level":"info","msg":"message received","payload_size":31,"time":"2022-05-07T22:09:51+03:00","type":"entity_config"}
{"check":"keepalive","component":"agent","entity":"WorkBox","event_uuid":"0544a7f7-dc0b-4df9-b572-60fe39aa239f","level":"info","msg":"sending event to backend","time":"2022-05-07T22:09:51+03:00"}
{"component":"agent","content_type":"application/octet-stream","level":"info","msg":"message received","payload_size":141,"time":"2022-05-07T22:09:51+03:00","type":"entity_config"}
{"check":"keepalive","component":"agent","entity":"WorkBox","event_uuid":"be872027-4fab-4001-a794-b275fbd0dffb","level":"info","msg":"sending event to backend","time":"2022-05-07T22:10:11+03:00"}
{"check":"keepalive","component":"agent","entity":"WorkBox","event_uuid":"c3f55aff-7f3b-4996-b70a-7fabf08bbc27","level":"info","msg":"sending event to backend","time":"2022-05-07T22:10:31+03:00"}
{"check":"keepalive","component":"agent","entity":"WorkBox","event_uuid":"2e09a1d9-7f5f-4472-a13f-32857c841d51","level":"info","msg":"sending event to backend","time":"2022-05-07T22:10:51+03:00"}
{"check":"keepalive","component":"agent","entity":"WorkBox","event_uuid":"e669cc74-be83-4d46-b138-e34c1eddfcff","level":"info","msg":"sending event to backend","time":"2022-05-07T22:11:11+03:00"}
{"check":"keepalive","component":"agent","entity":"WorkBox","event_uuid":"3cecdb41-bd61-4cae-8445-1aed1ed8ddc4","level":"info","msg":"sending event to backend","time":"2022-05-07T22:11:31+03:00"}
{"check":"keepalive","component":"agent","entity":"WorkBox","event_uuid":"bed71544-5acd-446b-a70f-709154538fc5","level":"info","msg":"sending event to backend","time":"2022-05-07T22:11:51+03:00"}
{"check":"keepalive","component":"agent","entity":"WorkBox","event_uuid":"842a1726-b52c-4f1a-bed7-4609f236e760","level":"info","msg":"sending event to backend","time":"2022-05-07T22:12:11+03:00"}
{"check":"keepalive","component":"agent","entity":"WorkBox","event_uuid":"7765f85d-e03c-4cbe-b107-5c7e814096fd","level":"info","msg":"sending event to backend","time":"2022-05-07T22:12:31+03:00"}
{"check":"keepalive","component":"agent","entity":"WorkBox","event_uuid":"f031344d-fe8c-4119-aeba-48d4a5b542bc","level":"info","msg":"sending event to backend","time":"2022-05-07T22:12:51+03:00"}

As you can see, the agent is successfully connected to the Sensu backend;

{"component":"agent","level":"info","msg":"successfully connected","time":"2022-05-07T22:09:51+03:00"}

Verify Sensu Agent Connection to Sensu Backend

From the Sensu Go backend web ui, you can confirm agent connection as well.

Install Sensu Agent on Windows systems

Windows Sensu agent properties;

Install Sensu Agent on Windows systems

And that is how you can easily install Sensu agent on Windows systems.

Reference;

Sensu Documentation

Other Tutorials

Install Sensu Agent on Rocky Linux

Install Sensu Agent on Ubuntu/Debian

LEAVE A REPLY

Please enter your comment!
Please enter your name here