How to Install Sensu on Ubuntu 16.04

Requirements

  • Two free Alibaba cloud instance with Ubuntu 16.04 installed.
  • A static IP address 192.168.0.101 is configured on the first instance (Sensu Server) and 192.168.0.104 is configured on the second instance (Sensu Client).
  • A root password is set up on both instances.

Launch Alibaba Cloud ECS Instance

apt-get update -y

Install RabbitMQ and Redis

apt-get install redis-server apt-transport-https -y
systemctl start redis-server
systemctl enable redis-server
service redis-server status
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2018-10-29 22:09:19 IST; 1min 36s ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Main PID: 24709 (redis-server)
CGroup: /system.slice/redis-server.service
└─24709 /usr/bin/redis-server 127.0.0.1:6379
Oct 29 22:09:19 Node1 systemd[1]: Starting Advanced key-value store...
Oct 29 22:09:19 Node1 run-parts[24710]: run-parts: executing /etc/redis/redis-server.post-up.d/00_example
Oct 29 22:09:19 Node1 systemd[1]: Started Advanced key-value store.
Oct 29 22:10:53 Node1 systemd[1]: Started Advanced key-value store.
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
dpkg -i erlang-solutions_1.0_all.deb
wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | apt-key add -
apt-get update -y
apt-get install socat erlang-nox -y
echo "deb https://dl.bintray.com/rabbitmq/debian xenial main" | tee /etc/apt/sources.list.d/rabbitmq.list
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | apt-key add -
apt-get update -y
apt-get install rabbitmq-server -y
systemctl start rabbitmq-server
systemctl enable rabbitmq-server
systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2018-10-29 22:29:41 IST; 2min 46s ago
Main PID: 31381 (beam.smp)
Status: "Initialized"
CGroup: /system.slice/rabbitmq-server.service
├─31381 /usr/lib/erlang/erts-10.1/bin/beam.smp -W w -A 64 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 10485
├─31470 /usr/lib/erlang/erts-10.1/bin/epmd -daemon
├─31612 erl_child_setup 32768
├─31629 inet_gethost 4
└─31630 inet_gethost 4
Oct 29 22:29:34 Node1 rabbitmq-server[31381]: ## ## RabbitMQ 3.7.8. Copyright (C) 2007-2018 Pivotal Software, Inc.
Oct 29 22:29:34 Node1 rabbitmq-server[31381]: ########## Licensed under the MPL. See http://www.rabbitmq.com/
Oct 29 22:29:34 Node1 rabbitmq-server[31381]: ###### ##
Oct 29 22:29:34 Node1 rabbitmq-server[31381]: ########## Logs: /var/log/rabbitmq/rabbit@Node1.log
Oct 29 22:29:34 Node1 rabbitmq-server[31381]: /var/log/rabbitmq/rabbit@Node1_upgrade.log
Oct 29 22:29:34 Node1 rabbitmq-server[31381]: Starting broker...
Oct 29 22:29:41 Node1 rabbitmq-server[31381]: systemd unit for activation check: "rabbitmq-server.service"
Oct 29 22:29:41 Node1 systemd[1]: Started RabbitMQ broker.
Oct 29 22:29:43 Node1 rabbitmq-server[31381]: completed with 0 plugins.
Oct 29 22:29:58 Node1 systemd[1]: Started RabbitMQ broker.
rabbitmqctl add_vhost /sensu
rabbitmqctl add_user sensu sensupassword
rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*"

Install and Configure Sensu

wget -O- https://sensu.global.ssl.fastly.net/apt/pubkey.gpg |  apt-key add -
echo "deb https://sensu.global.ssl.fastly.net/apt sensu main" | tee /etc/apt/sources.list.d/sensu.list
apt-get update -y
apt-get install sensu -y
systemctl start sensu-server
systemctl enable sensu-server
nano /etc/sensu/conf.d/rabbitmq.json
{
"rabbitmq": {
"host": "127.0.0.1",
"port": 5672,
"vhost": "/sensu",
"user": "sensu",
"password": "sensupassword"
}
}
nano /etc/sensu/conf.d/redis.json
{
"redis": {
"host": "127.0.0.1",
"port": 6379
}
}
nano /etc/sensu/conf.d/api.json
{
"api": {
"host": "localhost",
"bind": "0.0.0.0",
"port": 4567
}
}

Install and Configure Uchiwa Dashboard

apt-get install uchiwa -y
nano /etc/sensu/uchiwa.json
{
"sensu": [
{
"name": "Sensu Server",
"host": "localhost",
"port": 4567,
"timeout": 10
}
],
"uchiwa": {
"host": "0.0.0.0",
"port": 3000,
"refresh": 10
}
}
systemctl restart sensu-server
systemctl restart sensu-api
systemctl restart uchiwa

Monitor Sensu Server

nano /etc/sensu/conf.d/client.json
{
"client": {
"name": "sensu-server",
"address": "127.0.0.1",
"environment": "Test",
"subscriptions": [
"dev",
"ubuntu"
],
"socket": {
"bind": "127.0.0.1",
"port": 3030
}
systemctl restart sensu-client

Configure Sensu Client

wget -O- https://sensu.global.ssl.fastly.net/apt/pubkey.gpg |  apt-key add -
echo "deb https://sensu.global.ssl.fastly.net/apt sensu main" | tee /etc/apt/sources.list.d/sensu.list
apt-get update -y
apt-get install sensu -y
nano /etc/sensu/conf.d/client.json
{
"client": {
"name": "Sensu-Client",
"address": "192.168.0.104",
"environment": "Test",
"subscriptions": [
"web",
"debian"
]
}
}
nano /etc/sensu/conf.d/transport.json
{
"transport": {
"name": "rabbitmq",
"reconnect_on_error": true
}
}
nano /etc/sensu/conf.d/rabbitmq.json
{
"rabbitmq": {
"host": "192.168.0.101",
"port": 5672,
"vhost": "/sensu",
"user": "sensu",
"password": "sensupassword"
}
}
systemctl restart sensu-client

Monitor Apache and Disk Status

nano /etc/sensu/conf.d/apache_check.json
{
"checks": {
"apache-status": {
"command": "check-process.rb -p apache2",
"subscribers": [
"web"
],
"interval": 60
}
}
}
systemctl restart sensu-server
/opt/sensu/embedded/bin/gem install sensu-plugins-process-checks
/opt/sensu/embedded/bin/gem install sensu-plugins-disk-checks
nano /etc/sensu/conf.d/client.json
{
"client": {
"name": "Sensu-Client",
"address": "192.168.0.104",
"environment": "Test",
"subscriptions": [
"web",
"debian"
]
}
}
nano /etc/sensu/conf.d/disk_check.json
{
"checks": {
"disk-status": {
"command": "check-disk-usage.rb -w 70 -c 90",
"standalone": true,
"interval": 60
}
}
}
systemctl restart sensu-client

Original Source

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Who am I to journey into the land of SWE

Design and Implementation of PouchContainer CRI

How Cloud Computing Has Revolutionized O&M?

Using 3D modelling HMS Kit!

How Moka launched its operations in Europe with Forest Admin

Data Estate Modernization: One of the steps towards digital transformation

Continuous Deployment Pipeline for React App on AWS S3 + CloudFront

Should we automate all testing efforts? | Xmartlabs Blog

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

F5 Advanced Web Application Firewall(AWAF) 101

What is containerization and what role does Docker play in it?

Learning note for Docker (1) — How to use insecure docker registry?

Containers 101: Containerization