{"id":12597,"date":"2022-05-07T01:38:02","date_gmt":"2022-05-06T22:38:02","guid":{"rendered":"https:\/\/kifarunix.com\/?p=12597"},"modified":"2024-03-09T14:20:52","modified_gmt":"2024-03-09T11:20:52","slug":"install-sensu-agent-on-ubuntu-debian","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-sensu-agent-on-ubuntu-debian\/","title":{"rendered":"Install Sensu Agent on Ubuntu\/Debian"},"content":{"rendered":"\n<p>This guide will take you through how to install Sensu agent on Ubuntu\/Debian systems. We are using Ubuntu 22.04 and Debian 11 specifically on this setup to install Sensu agents.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install Sensu Agent on Ubuntu\/Debian<\/h2>\n\n\n\n<p>In order to start collecting remote system metrics for monitoring using Sensu Go server, you need to install Sensu agents on the hosts being monitored.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install Sensu agent on Debian<\/h3>\n\n\n\n<p>To install Sensu agent on Debian;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install Sensu APT repository;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -s https:\/\/packagecloud.io\/install\/repositories\/sensu\/stable\/script.deb.sh | sudo bash<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install Sensu Agent on Debian 11<\/li>\n<\/ul>\n\n\n\n<p>Once the repository is installed, ran the command below to install Sensu agent on Debian 11;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install sensu-go-agent<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Sensu agent on Ubuntu 22.04<\/h3>\n\n\n\n<p>To install Sensu agent on Ubuntu;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install Sensu APT repository;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -s https:\/\/packagecloud.io\/install\/repositories\/sensu\/stable\/script.deb.sh | sudo bash<\/code><\/pre>\n\n\n\n<p>For Ubuntu 22.04, you need to use the repository for Ubuntu 20.04 since there is no Sensu APT repos for Ubuntu 22.04 as of this writing.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/packagecloud.io\/install\/repositories\/sensu\/stable\/script.deb.sh<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>os=ubuntu dist=focal bash .\/script.deb.sh<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install Sensu Agent on Ubuntu<\/li>\n<\/ul>\n\n\n\n<p>Once the repository is installed, ran the command below to install Sensu agent on Ubuntu;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install sensu-go-agent<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configure and Run Sensu Agent<\/h3>\n\n\n\n<p>You can run Sensu agent with or without defining a configuration file.<\/p>\n\n\n\n<p>To run without defining a configuration file, use the command below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u sensu sensu-agent start --backend-url &lt;sensu-server-web-socket-url&gt;<\/code><\/pre>\n\n\n\n<p>Sensu backend web socket listens on port 8081. Ensure this port is opened on the server to allow agents to connect. The protocol is WS or WSS.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u sensu sensu-agent start --backend-url ws:\/\/127.0.0.1:8081<\/code><\/pre>\n\n\n\n<p>or <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u sensu sensu-agent start --backend-url ws:\/\/192.168.56.124:8081<\/code><\/pre>\n\n\n\n<p>To run Sensu agent with a configuration file, download and install the sample configuration;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo curl -sL https:\/\/docs.sensu.io\/sensu-go\/latest\/files\/agent.yml -o \/etc\/sensu\/agent.yml<\/code><\/pre>\n\n\n\n<p>This is how sample config looks like;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>---\n# Sensu agent configuration\n\n\n##\n# agent configuration\n##\n#name: \"hostname\"\n#namespace: \"default\"\n#subscriptions:\n#  - example\n#labels:\n#  example_key: \"example value\"\n#annotations:\n#  example\/key: \"example value\"\n#agent-managed-entity: false\n#allow-list: \/etc\/sensu\/check-allow-list.yaml\n#assets-burst-limit: 100\n#assets-rate-limit: 1.39\n#backend-handshake-timeout: 15\n#backend-heartbeat-interval: 30\n#backend-heartbeat-timeout: 45\n#backend-url:\n#  - \"ws:\/\/127.0.0.1:8081\"\n#cache-dir: \"\/var\/cache\/sensu\/sensu-agent\"\n#config-file: \"\/etc\/sensu\/agent.yml\"\n#deregister: false\n#deregistration-handler: \"example_handler\"\n#detect-cloud-provider: false\n#disable-assets: false\n#keepalive-critical-timeout: 0\n#keepalive-handlers:\n#  - slack\n#  - email\n#keepalive-interval: 20\n#keepalive-warning-timeout: 120\nlog-level: \"debug\" # available log levels: panic, fatal, error, warn, info, debug\n#user: \"agent\"\n#password: \"P@ssw0rd!\"\n#redact:\n#  - password\n#  - passwd\n#  - pass\n#  - api_key\n#  - api_token\n#  - access_key\n#  - secret_key\n#  - private_key\n#  - secret\n#require-fips: false\n#require-openssl: false\n\n\n##\n# api configuration\n##\n#api-host: \"127.0.0.1\"\n#api-port: 3031\n#disable-api: false\n#events-burst-limit: 10\n#events-rate-limit: 10.0\n\n\n##\n# socket configuration\n##\n#socket-host: \"127.0.0.1\"\n#socket-port: 3030\n#disable-sockets: false\n\n\n##\n# statsd configuration\n##\n#statsd-disable: false\n#statsd-event-handlers:\n#  - example_handler\n#statsd-flush-interval: 10\n#statsd-metrics-host: \"127.0.0.1\"\n#statsd-metrics-port: 8125\n\n\n##\n# tls configuration\n##\n#cert-file: \"\/path\/to\/tls\/agent.pem\"\n#trusted-ca-file: \"\/path\/to\/tls\/ca.pem\"\n#key-file: \"\/path\/to\/tls\/agent-key.pem\"\n#insecure-skip-tls-verify: false\n<\/code><\/pre>\n\n\n\n<p>The default Sensu backend URL is <strong><code>ws:\/\/127.0.0.1:8081<\/code><\/strong>.<\/p>\n\n\n\n<p>If you are using a remove Sensu backend;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vim \/etc\/sensu\/agent.yml<\/code><\/pre>\n\n\n\n<p>update the backend url from;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#backend-url:\n#  - \"ws:\/\/127.0.0.1:8081\"<\/code><\/pre>\n\n\n\n<p>To (<em>replace &lt;sensu-backend-IP&gt; with Sensu backend IP address<\/em>);<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>backend-url:\n  - \"ws:\/\/&lt;sensu-backend-IP&gt;:8081\"<\/code><\/pre>\n\n\n\n<p>At the very least, Sensu agent just requires the backend url to be defined.<\/p>\n\n\n\n<p>Next, start and enable the Sensu agent service to run on system boot;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable --now sensu-agent<\/code><\/pre>\n\n\n\n<p>Check the Status;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status sensu-agent<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\u25cf sensu-agent.service - The Sensu Agent process.\n     Loaded: loaded (\/lib\/systemd\/system\/sensu-agent.service; enabled; vendor preset: enabled)\n     Active: active (running) since Sat 2022-05-07 01:17:26 EAT; 3s ago\n   Main PID: 4246 (sensu-agent)\n      Tasks: 7 (limit: 1133)\n     Memory: 8.3M\n        CPU: 62ms\n     CGroup: \/system.slice\/sensu-agent.service\n             \u2514\u25004246 \/usr\/sbin\/sensu-agent start -c \/etc\/sensu\/agent.yml\n\nMay 07 01:17:27 debian11 sensu-agent[4246]: {\"component\":\"agent\",\"header\":\"Accept: application\/octet-stream\",\"level\":\"debug\",\"msg\":\"setting header\",\"time\":\"2022-05-07T01:1&gt;\nMay 07 01:17:28 debian11 sensu-agent[4246]: {\"component\":\"agent\",\"level\":\"info\",\"msg\":\"successfully connected\",\"time\":\"2022-05-07T01:17:28+03:00\"}\nMay 07 01:17:28 debian11 sensu-agent[4246]: {\"component\":\"agent\",\"header\":\"Accept: [application\/octet-stream application\/json]\",\"level\":\"debug\",\"msg\":\"received header\",\"ti&gt;\nMay 07 01:17:28 debian11 sensu-agent[4246]: {\"component\":\"agent\",\"format\":\"protobuf\",\"level\":\"debug\",\"msg\":\"setting serialization\/deserialization\",\"time\":\"2022-05-07T01:17&gt;\nMay 07 01:17:28 debian11 sensu-agent[4246]: {\"component\":\"agent\",\"header\":\"Content-Type: application\/octet-stream\",\"level\":\"debug\",\"msg\":\"setting header\",\"time\":\"2022-05-0&gt;\nMay 07 01:17:28 debian11 sensu-agent[4246]: {\"component\":\"agent\",\"level\":\"debug\",\"msg\":\"maxSessionLength is 0s, agent won't periodically disconnect\",\"time\":\"2022-05-07T01:&gt;\nMay 07 01:17:28 debian11 sensu-agent[4246]: {\"component\":\"agent\",\"content_type\":\"application\/octet-stream\",\"level\":\"info\",\"msg\":\"message received\",\"payload_size\":143,\"time&gt;\nMay 07 01:17:28 debian11 sensu-agent[4246]: {\"component\":\"agent\",\"level\":\"debug\",\"msg\":\"received an entity config from the backend\",\"time\":\"2022-05-07T01:17:28+03:00\"}\nMay 07 01:17:28 debian11 sensu-agent[4246]: {\"component\":\"agent\",\"level\":\"debug\",\"msg\":\"successfully received the initial entity config\",\"time\":\"2022-05-07T01:17:28+03:00\"}\nMay 07 01:17:28 debian11 sensu-agent[4246]: {\"check\":\"keepalive\",\"component\":\"agent\",\"entity\":\"debian11\",\"event_uuid\":\"14a4c0f8-301c-4fe2-9db3-119c8a53274a\",\"level\":\"info\n<\/code><\/pre>\n\n\n\n<p>In case of any issue, check the logs using journalctl command;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>journalctl -u sensu-agent<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Very Sensu Agents Connectivity with Sensu Backend Server<\/h3>\n\n\n\n<p>Login back to Sensu backend and confirm the status of the agents.<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/sensu-agents.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1889\" height=\"949\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/sensu-agents.png\" alt=\"Install Sensu Agent on Ubuntu\/Debian\" class=\"wp-image-12600\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/sensu-agents.png?v=1651876060 1889w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/sensu-agents-768x386.png?v=1651876060 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/sensu-agents-1536x772.png?v=1651876060 1536w\" sizes=\"(max-width: 1889px) 100vw, 1889px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>You can click on any of the Entities to view more details;<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/sensu-agent-details.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1898\" height=\"941\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/sensu-agent-details.png\" alt=\"Install Sensu Agent on Ubuntu\/Debian\" class=\"wp-image-12602\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/sensu-agent-details.png?v=1651876350 1898w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/sensu-agent-details-768x381.png?v=1651876350 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/sensu-agent-details-1536x762.png?v=1651876350 1536w\" sizes=\"(max-width: 1898px) 100vw, 1898px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>Sensu agent is now installed on Ubuntu\/Debian.<\/p>\n\n\n\n<p>Next, follow the guide below to learn how to monitor Linux system metrics using Sensu.<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-monitor-linux-system-metrics-using-sensu\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Monitor Linux System Metrics using Sensu<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Reference<\/h3>\n\n\n\n<p><a href=\"https:\/\/docs.sensu.io\/sensu-go\/latest\/operations\/deploy-sensu\/install-sensu\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Sensu<\/a><\/p>\n\n\n\n<p>Other Tutorials;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-nagios-nrpe-agents-on-ubuntu\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Nagios NRPE Agents on Ubuntu 22.04\/Ubuntu 20.04<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-and-enroll-elastic-agents-to-fleet-manager-in-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Enroll Elastic Agents to Fleet Manager in Linux<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-wazuh-agent-on-rocky-linux-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Wazuh Agent on Rocky Linux 8<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide will take you through how to install Sensu agent on Ubuntu\/Debian systems. We are using Ubuntu 22.04 and Debian 11 specifically on this<\/p>\n","protected":false},"author":1,"featured_media":12604,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,72],"tags":[5055,5053,5058,5056,5057,5054,4412],"class_list":["post-12597","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-monitoring","tag-debian-11-sensu-agents","tag-install-sensu-agent-on-ubuntu-debian","tag-install-sensu-agent-ubuntu-22-04","tag-sensu-agents-debian-11","tag-sensu-agents-ubuntu-22-04","tag-sensu-go-agents-ubuntu","tag-ubuntu-22-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/12597"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=12597"}],"version-history":[{"count":6,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/12597\/revisions"}],"predecessor-version":[{"id":20539,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/12597\/revisions\/20539"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/12604"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=12597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=12597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=12597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}