{"id":12586,"date":"2022-05-06T23:30:51","date_gmt":"2022-05-06T20:30:51","guid":{"rendered":"https:\/\/kifarunix.com\/?p=12586"},"modified":"2024-03-09T14:22:57","modified_gmt":"2024-03-09T11:22:57","slug":"install-sensu-go-on-debian-11","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-sensu-go-on-debian-11\/","title":{"rendered":"Install Sensu Go on Debian 11"},"content":{"rendered":"\n
Follow through this tutorial to learn how to install Sensu Go on Debian 11. Sensu<\/a> is an opensource infrastructure and application monitoring tool.<\/p>\n\n\n\n Before you can proceed, check the recommended system hardware requirements<\/a>.<\/p>\n\n\n\n There are different deployment architectures<\/a> for Sensu Go. We will use standalone deployment in this guide.<\/p>\n\n\n\n Sensu Go works in a client-server architecture with the Sensu Backend serving as the server while Sensu agent serving as the client.<\/p>\n\n\n\n According to Sensu component reference page;<\/p>\n\n\n\n Sensu Backend is a service that manages check requests and observability data. Every Sensu backend includes an integrated structure for scheduling checks using subscriptions, an event processing pipeline that applies event filters, mutators, and handlers, an embedded etcd datastore for storing configuration and state, and the Sensu API, Sensu web UI, and sensuctl command line tool<\/em>.<\/p>\n\n\n\n The Sensu agent is a lightweight client that runs on the infrastructure components you want to monitor. Agents register with the Sensu backend as monitoring entities with Install Sensu Go APT repositories on Debian 11;<\/p>\n\n\n\n Install Sensu Go backend;<\/p>\n\n\n\n Run the command below to install Sensu Go command line tool that helps you to control Sensu Go resources.<\/p>\n\n\n\n The binary that sensu-go-cli installs is called You can start Sensu and run it on the foreground or run it as a service.<\/p>\n\n\n\n To run it on the foreground, just execute the command below;<\/p>\n\n\n\n Press You can learn about the usage of the command sensu-backend from the help page.<\/p>\n\n\n\n To run Sensu as a service, download the sample configuration by running the command below;<\/p>\n\n\n\n The sample configuration is highly commented;<\/p>\n\n\n\n You can then start and enable Sensu Go backend to run on system boot with the default configuration settings;<\/p>\n\n\n\n Check the status of the Sensu Go backend command;<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n Next, run the Sensu initialization command ( The basic usage of the sensu-backend init<\/strong> command can be checked on the help information;<\/p>\n\n\n\n Thus, to create Sensu admin account username and password, you have to pass the following options to the You can also use the following variables for both username and password respectively;<\/p>\n\n\n\n For example, to create the account using the variables, first disable bash history;<\/p>\n\n\n\n Set the username\/password variables;<\/p>\n\n\n\n Initialize Sensu instance<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n Enable the bash history;<\/p>\n\n\n\n You can always verify the user credentials or reset the user password using the Before you can use Sensu CLI command, you need to initialize sensuctl configuration<\/p>\n\n\n\n Go through the prompts accordingly.<\/p>\n\n\n\n Sample output;<\/p>\n\n\n\n You can also run the command in non-interactive mode;<\/p>\n\n\n\n Change admin password;<\/p>\n\n\n\n Reset user’s forgotten password;<\/p>\n\n\n\n The Sensu Go web UI service listens on port<\/a> 3000\/tcp by default.<\/p>\n\n\n\n If the Firewall is running, open this port to allow external access.<\/p>\n\n\n\n The access your Sensu Go Web UI using the address Login using the credentials created above.<\/p>\n\n\n\n Sensu Dashboard<\/p>\n\n\n\n And that is all.<\/p>\n\n\n\n In our next guide, we will learn how to install Sensu agents and start monitoring your end points.<\/p>\n\n\n\n Install Sensu Agent on Ubuntu\/Debian<\/a><\/p>\n\n\n\n Install Sensu Agent on Windows systems<\/a><\/p>\n\n\n\n Install Sensu<\/a><\/p>\n\n\n\nInstall Sensu Go on Debian 11<\/h2>\n\n\n\n
\n
\n
\n
type: \"agent\"<\/code>. Agent entities are responsible for creating check and metrics events to send to the backend event pipeline.<\/em><\/p>\n\n\n\n
Install Sensu Go Backend on Debian 11<\/h3>\n\n\n\n
sudo apt install curl -y<\/code><\/pre>\n\n\n\n
curl -s https:\/\/packagecloud.io\/install\/repositories\/sensu\/stable\/script.deb.sh | sudo bash<\/code><\/pre>\n\n\n\n
sudo apt install sensu-go-backend<\/code><\/pre>\n\n\n\n
Install Sensu Go Command Line tool;<\/h3>\n\n\n\n
sudo apt install sensu-go-cli<\/code><\/pre>\n\n\n\n
sensuctl<\/code><\/strong>.<\/p>\n\n\n\n
Configure and Start Sensu Go Backend on Debian 11<\/h3>\n\n\n\n
sudo -u sensu sensu-backend start<\/code><\/pre>\n\n\n\n
Ctrl+c<\/code><\/strong> to stop.<\/p>\n\n\n\n
sensu-backend --help<\/code><\/pre>\n\n\n\n
curl -sL https:\/\/docs.sensu.io\/sensu-go\/latest\/files\/backend.yml -o \/etc\/sensu\/backend.yml<\/code><\/pre>\n\n\n\n
cat \/etc\/sensu\/backend.yml<\/code><\/pre>\n\n\n\n
---\n# Sensu backend configuration\n\n\n##\n# backend configuration\n##\n#labels:\n# example_key: \"example value\"\n#annotations:\n# example\/key: \"example value\"\n#assets-burst-limit: 100\n#assets-rate-limit: 1.39\n#agent-rate-limit: 100\n#cache-dir: \"\/var\/cache\/sensu\/sensu-backend\"\n#config-file: \"\/etc\/sensu\/backend.yml\"\n#debug: false\n#deregistration-handler: \"example_handler\"\nlog-level: \"debug\" #available log levels: panic, fatal, error, warn, info, debug, trace\n#state-dir: \"\/var\/lib\/sensu\/sensu-backend\"\n#require-fips: false\n#require-openssl: false\n#eventd-buffer-size: 100\n#eventd-workers: 100\n#keepalived-buffer-size: 100\n#keepalived-workers: 100\n#pipelined-buffer-size: 100\n#pipelined-workers: 100\n\n\n##\n# api configuration\n##\n#api-listen-address: \"[::]:8080\" #listen on all IPv4 and IPv6 addresses\n#api-request-limit: 512000\n#api-url: \"http:\/\/localhost:8080\"\n\n\n##\n# tls configuration\n##\n#agent-auth-cert-file: \/path\/to\/tls\/backend-1.pem\n#agent-auth-crl-urls: http:\/\/localhost\/CARoot.crl\n#agent-auth-key-file: \/path\/to\/tls\/backend-1-key.pem\n#agent-auth-trusted-ca-file: \/path\/to\/tls\/ca.pem\n#agent-burst-limit: null\n#agent-host: \"[::]\" #listen on all IPv4 and IPv6 addresses\n#agent-port: 8081\n#agent-rate-limit: null\n#cert-file: \"\/path\/to\/tls\/backend-1.pem\"\n#insecure-skip-tls-verify: false\n#jwt-private-key-file: \/path\/to\/key\/private.pem\n#jwt-public-key-file: \/path\/to\/key\/public.pem\n#key-file: \"\/path\/to\/tls\/backend-1-key.pem\"\n#trusted-ca-file: \"\/path\/to\/tls\/ca.pem\"\n#dashboard-cert-file: \"\/path\/to\/tls\/separate-webui-cert.pem\"\n#dashboard-host: \"[::]\"\n#dashboard-key-file: \"\/path\/to\/tls\/separate-webui-key.pem\"\n#dashboard-port: 3000\n\n\n##\n# etcd datastore configuration\n##\n#etcd-advertise-client-urls:\n# - http:\/\/localhost:2378\n# - http:\/\/localhost:2379\n#etcd-cert-file: \"\/path\/to\/tls\/backend-1.pem\"\n#etcd-cipher-suites:\n# - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384\n# - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384\n# - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256\n# - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\n# - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305\n# - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305\n#etcd-client-cert-auth: false\n#etcd-client-urls:\n# - https:\/\/10.0.0.1:2379\n# - https:\/\/10.1.0.1:2379\n#etcd-discovery:\n# - https:\/\/discovery.etcd.io\/3e86b59982e49066c5d813af1c2e2579cbf573de\n#etcd-discovery-srv:\n# - example.org\n#etcd-initial-advertise-peer-urls:\n# - https:\/\/10.0.0.1:2380\n# - https:\/\/10.1.0.1:2380\n#etcd-initial-cluster: \"backend-0=https:\/\/10.0.0.1:2380,backend-1=https:\/\/10.1.0.1:2380,backend-2=https:\/\/10.2.0.1:2380\"\n#etcd-initial-cluster-state: \"new\"\n#etcd-initial-cluster-token: \"unique_token_for_this_cluster\"\n#etcd-key-file: \"\/path\/to\/tls\/backend-1-key.pem\"\n#etcd-listen-client-urls:\n# - https:\/\/10.0.0.1:2379\n# - https:\/\/10.1.0.1:2379\n#etcd-listen-peer-urls:\n# - https:\/\/10.0.0.1:2380\n# - https:\/\/10.1.0.1:2380\n#etcd-name: \"backend-0\"\n#etcd-peer-cert-file: \"\/path\/to\/tls\/backend-1.pem\"\n#etcd-peer-client-cert-auth: false\n#etcd-peer-key-file: \"\/path\/to\/tls\/backend-1-key.pem\"\n#etcd-peer-trusted-ca-file: \".\/ca.pem\"\n#etcd-trusted-ca-file: \".\/ca.pem\"\n#no-embed-etcd: false\n#etcd-election-timeout: 3000\n#etcd-heartbeat-interval: 300\n#etcd-max-request-bytes: 1572864\n#etcd-quota-backend-bytes: 4294967296\n<\/code><\/pre>\n\n\n\n
sudo systemctl enable --now sensu-backend<\/code><\/pre>\n\n\n\n
systemctl status sensu-backend<\/code><\/pre>\n\n\n\n
\u25cf sensu-backend.service - The Sensu Backend service.\n Loaded: loaded (\/lib\/systemd\/system\/sensu-backend.service; enabled; vendor preset: enabled)\n Active: active (running) since Fri 2022-05-06 22:26:58 EAT; 8s ago\n Main PID: 3462 (sensu-backend)\n Tasks: 8 (limit: 1133)\n Memory: 30.8M\n CPU: 358ms\n CGroup: \/system.slice\/sensu-backend.service\n \u2514\u25003462 \/usr\/sbin\/sensu-backend start -c \/etc\/sensu\/backend.yml\n\nMay 06 22:27:04 debian11 sensu-backend[3462]: {\"component\":\"tessend\",\"key\":\"a8e65cb0-0a5f-41da-84d0-8c73cdef80c1\",\"level\":\"debug\",\"msg\":\"added a key to the ring\",\"time\":\"2>\nMay 06 22:27:04 debian11 sensu-backend[3462]: {\"component\":\"tessend\",\"level\":\"debug\",\"metric_name\":\"backend_count\",\"metric_value\":1,\"msg\":\"collected a metric for tessen\",\">\nMay 06 22:27:04 debian11 sensu-backend[3462]: {\"component\":\"tessend\",\"level\":\"debug\",\"metric_name\":\"entity_class_backend_count\",\"metric_value\":1,\"msg\":\"collected a metric >\nMay 06 22:27:04 debian11 sensu-backend[3462]: {\"component\":\"etcd\",\"level\":\"debug\",\"caller\":\"v3rpc\/interceptor.go:182\",\"msg\":\"request stats\",\"start time\":\"2022-05-06T22:27:>\nMay 06 22:27:04 debian11 sensu-backend[3462]: {\"component\":\"etcd\",\"level\":\"debug\",\"caller\":\"v3rpc\/interceptor.go:182\",\"msg\":\"request stats\",\"start time\":\"2022-05-06T22:27:>\nMay 06 22:27:04 debian11 sensu-backend[3462]: {\"component\":\"tessend\",\"level\":\"debug\",\"msg\":\"added a backend to tessen\",\"time\":\"2022-05-06T22:27:04+03:00\",\"values\":[\"a8e65c>\nMay 06 22:27:04 debian11 sensu-backend[3462]: {\"component\":\"etcd\",\"level\":\"debug\",\"caller\":\"v3rpc\/interceptor.go:182\",\"msg\":\"request stats\",\"start time\":\"2022-05-06T22:27:>\nMay 06 22:27:04 debian11 sensu-backend[3462]: {\"component\":\"etcd\",\"level\":\"debug\",\"caller\":\"v3rpc\/interceptor.go:182\",\"msg\":\"request stats\",\"start time\":\"2022-05-06T22:27:>\nMay 06 22:27:05 debian11 sensu-backend[3462]: {\"component\":\"etcd\",\"level\":\"debug\",\"caller\":\"v3rpc\/interceptor.go:182\",\"msg\":\"request stats\",\"start time\":\"2022-05-06T22:27:>\nMay 06 22:27:06 debian11 sensu-backend[3462]: {\"component\":\"etcd\",\"level\":\"debug\",\"caller\":\"v3rpc\/interceptor.go:182\",\"msg\":\"request stats\",\"start time\":\"2022-05-06T22:27\n<\/code><\/pre>\n\n\n\n
Create Sensu Administrator Account<\/h3>\n\n\n\n
sensu-backend init<\/strong><\/code>) below to create Sensu administrator account username and password.<\/p>\n\n\n\n
sensu-backend init --help<\/code><\/pre>\n\n\n\n
initialize a new sensu installation\n\nUsage:\n sensu-backend init [flags]\n\nGeneral Flags:\n --cluster-admin-api-key string cluster admin API key\n --cluster-admin-password string cluster admin password\n --cluster-admin-username string cluster admin username\n -c, --config-file string path to sensu-backend config file (default \"\/etc\/sensu\/backend.yml\")\n -h, --help help for init\n --ignore-already-initialized exit 0 if the cluster has already been initialized\n --interactive interactive mode\n --timeout string duration to wait before a connection attempt to etcd is considered failed (must be >= 1s) (default \"5s\")\n --wait continuously retry to establish a connection to etcd until it is successful\n\nStore Flags:\n --etcd-advertise-client-urls strings list of this member's client URLs to advertise to clients (default [http:\/\/localhost:2379])\n --etcd-cert-file string path to the client server TLS cert file\n --etcd-cipher-suites strings list of ciphers to use for etcd TLS configuration\n --etcd-client-cert-auth enable client cert authentication\n --etcd-client-log-level string etcd client logging level [panic, fatal, error, warn, info, debug] (default \"error\")\n --etcd-client-urls string client URLs to use when operating as an etcd client\n --etcd-key-file string path to the client server TLS key file\n --etcd-max-request-bytes uint maximum etcd request size in bytes (use with caution) (default 1572864)\n --etcd-trusted-ca-file string path to the client server TLS trusted CA cert file\n<\/code><\/pre>\n\n\n\n
sensu-backend init<\/code><\/strong> command.<\/p>\n\n\n\n
--cluster-admin-username <username> --cluster-admin-password <password><\/code><\/pre>\n\n\n\n
SENSU_BACKEND_CLUSTER_ADMIN_USERNAME=<username>\nSENSU_BACKEND_CLUSTER_ADMIN_PASSWORD=<password><\/code><\/pre>\n\n\n\n
set +o history<\/code><\/pre>\n\n\n\n
export SENSU_BACKEND_CLUSTER_ADMIN_USERNAME=sensuadmin<\/strong>\nexport SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD=password<\/strong><\/code><\/pre>\n\n\n\n
sensu-backend init<\/code><\/pre>\n\n\n\n
{\"component\":\"cmd\",\"level\":\"info\",\"msg\":\"attempting to connect to etcd server: http:\/\/localhost:2379\",\"time\":\"2022-05-06T22:38:13+03:00\"}\n{\"component\":\"backend.seeds\",\"level\":\"info\",\"msg\":\"seeding etcd store with initial data\",\"time\":\"2022-05-06T22:38:14+03:00\"}\n{\"component\":\"store\",\"level\":\"warning\",\"msg\":\"migrating etcd database to a new version\",\"time\":\"2022-05-06T22:38:15+03:00\"}\n{\"component\":\"store\",\"database_version\":1,\"level\":\"info\",\"msg\":\"successfully upgraded database\",\"time\":\"2022-05-06T22:38:15+03:00\"}\n{\"component\":\"store\",\"database_version\":2,\"level\":\"info\",\"msg\":\"successfully upgraded database\",\"time\":\"2022-05-06T22:38:16+03:00\"}\n{\"component\":\"store\",\"level\":\"warning\",\"msg\":\"migrating enterprise etcd database to a new version\",\"time\":\"2022-05-06T22:38:16+03:00\"}\n{\"component\":\"store\",\"database_version\":1,\"level\":\"info\",\"msg\":\"successfully upgraded database\",\"time\":\"2022-05-06T22:38:16+03:00\"}\n{\"component\":\"store\",\"database_version\":2,\"level\":\"info\",\"msg\":\"successfully upgraded database\",\"time\":\"2022-05-06T22:38:17+03:00\"}\n<\/code><\/pre>\n\n\n\n
set -o history<\/code><\/pre>\n\n\n\n
sensuctl<\/code><\/strong> command.<\/p>\n\n\n\n
sensuctl configure<\/code><\/pre>\n\n\n\n
? Authentication method: username\/password\n? Sensu Backend API URL: http:\/\/127.0.0.1:8080\n? Namespace: default\n? Preferred output format: tabular\n? Username: sensuadmin\n? Password: ********\n<\/code><\/pre>\n\n\n\n
sensuctl configure -n \\\n--username 'YOUR_USERNAME' \\\n--password 'YOUR_PASSWORD' \\\n--namespace default \\\n--url 'http:\/\/127.0.0.1:8080'\n<\/code><\/pre>\n\n\n\n
sensuctl user change-password --interactive<\/code><\/pre>\n\n\n\n
sensuctl user reset-password USERNAME --interactive<\/code><\/pre>\n\n\n\n
Accessing Sensu Go Web UI<\/h3>\n\n\n\n
sudo ss -altnp | grep sensu<\/code><\/pre>\n\n\n\n
LISTEN 0 4096 127.0.0.1:2379 0.0.0.0:* users:((\"sensu-backend\",pid=3462,fd=8)) \nLISTEN 0 4096 127.0.0.1:2380 0.0.0.0:* users:((\"sensu-backend\",pid=3462,fd=7)) \nLISTEN 0 4096 *:8080 *:* users:((\"sensu-backend\",pid=3462,fd=18))\nLISTEN 0 4096 *:8081 *:* users:((\"sensu-backend\",pid=3462,fd=19))\nLISTEN 0 4096 *:3000 *:* users:((\"sensu-backend\",pid=3462,fd=20))\n<\/code><\/pre>\n\n\n\n
sudo ufw allow 3000\/tcp<\/code><\/pre>\n\n\n\n
http:\/\/server-address-or-IP:3000<\/code><\/strong>.<\/p>\n\n\n\n
<\/figure><\/div><\/a><\/div>\n\n\n\n
<\/figure><\/a><\/div>\n\n\n\n
Reference<\/h3>\n\n\n\n
Other Tutorials<\/h3>\n\n\n\n