How To Securely Manage Secrets with HashiCorp Vault on Ubuntu 16.04
0

Introduction

Alerta is an internet application accustomed combine and de-duplicate alerts from numerous monitoring systems and visualize them on a screen that is single. Alerta can integrate with many monitoring that is well-known like Nagios, Zabbix, Sensu, InfluxData Kapacitor, and others.

In this guide you will arranged Alerta and configure it to show notifications from Nagios, the open-source that is popular system.

Prerequisites

To follow this guide, you will require:

  • Two Ubuntu 16.04 servers arranged by after the Ubuntu 16.04 initial host setup guide, including a sudo non-root individual and a firewall.
  • On the Ubuntu that is first server which can be in which you will run Nagios, install these elements:
  • On the Ubuntu that is second server which can be in which we will install Alerta within guide, install these elements:

Step 1 — setting up the Nagios-to-Alerta Gateway

You can expand Nagios’ functionality with Nagios Event Broker (NEB) modules. NEB is Nagios’ occasion integration process, and NEB modules are provided libraries that enable you to incorporate other solutions with Nagios. The NEB module that will send notifications to Alerta.( in this step, we’ll install the Nagios to Alerta Gateway**********)

Log into the Nagios host as your user that is non-root:

The Nagios to Alerta Gateway doesn’t have preconfigured system packages, which means you’ll need to build it from supply. To accomplish this, you will have to install some development tools and files. You will require Git set up in order to fetch the foundation rule from GitHub.

  • sudo apt-get install -y git curl gcc make libcurl4-openssl-dev

With the prerequisites installed, make use of Git to clone the foundation rule from task’s GitHub repository:

  • git clone https://github.com/alerta/nagios-alerta.git

Then modification on brand new nagios-alerta directory:

Then compile the nagios-alerta module making use of make:

You'll understand output that is following**********)

Output

cd ./src && make nagios4 make[1]: Entering directory '/home/sammy/nagios-alerta/src' gcc -fPIC -g -O2 -DHAVE_CONFIG_H -I../include -I../include/nagios4 -lcurl -o alerta-neb.o alerta-neb.c -shared -lcurl make[1]: making directory '/home/sammy/nagios-alerta/src'

If the truth is different things, make sure you have actually every one of the prerequisites set up.

Now run the installation task:

You'll see this production, showing the module ended up being set up in /usr/lib/nagios:

Output

cd ./src && make install make[1]: Entering directory '/home/sammy/nagios-alerta/src' [ -d /usr/lib/nagios ] || mkdir /usr/lib/nagios install -m 0644 alerta-neb.o /usr/lib/nagios make[1]: making directory '/home/sammy/nagios-alerta/src'

With the module set up, we could configure Nagios to make use of this module that is new

Step 2 — Configure Nagios-to-Alerta Gateway

Let's configure Nagios to deliver notification communications to Alerta.

First, allow the newly set up Alerta broker module into the Nagios configuration file that is main. Start the Nagios setup file within editor:

  • sudo vi /usr/local/nagios/etc/nagios.cfg

Find the area containing the broker_module directives:

/usr/local/nagios/etc/nagios.cfg

...
# EVENT BROKER MODULE(S)
# This directive can be used to specify a meeting broker module which should
# by packed by Nagios at startup.  Utilize directives that are multiple you would like
# to load one or more module.  Arguments which should be passed away to
# the module at startup are divided from module course by an area.
#
[...]
#broker_module=/somewhere/module1.o
#broker_module=/somewhere/module2.o arg1 arg2=3 debug=0
...

To configure the Alerta module, you will need to offer two mandatory arguments:

Add this line on file to configure the Alerta integration:

/usr/local/nagios/etc/nagios.cfg

...
broker_module=/usr/lib/nagios/alerta-neb.o http://your_alerta_server_ip/api key=ALERTA_API_KEY
...

There are extra arguments that are optional can specify besides:

  • env: This specifies the surroundings title. The standard environment title is Production.
  • hard_only: Forwards leads to rough state just. You'll find more information about Nagios State kinds into the Nagios paperwork. Set this to 1 allow this mode.
  • debug: - enable debug mode the module. Set this to 1 allow this mode.

To specify most of these choices, instead use this line:

/usr/local/nagios/etc/nagios.cfg

...
broker_module=/usr/lib/nagios/alerta-neb.o http://your_alerta_server_ip/api key=ALERTA_API_KEY env=Production hard_only=1 debug=1
...

Save the file and leave the editor.

In purchase to recognize alerts by environment and solution title, you will have to arranged environment and solution names Nagios Custom Object that is using Variables. To get this done, utilize the _Environment and _Service factors within setup. Let us configure those now.

Open the standard Nagios host item setup file, which you'll want to get in the /usr/local/nagios/etc/objects/ directory:

  • sudo vi /usr/local/nagios/etc/objects/localhost.cfg

We'll mark all alerts with this particular host as Production alerts, so we'll phone the standard solution Nagios. Get the host that is following:

/usr/local/nagios/etc/objects/localhost.cfg

...
define host{
        usage                     linux-server            ; Name of host template to make use of
                                                        ; This host meaning will inherit all factors which are defined
                                                        ; in (or inherited by) the linux-server host definition that is template.
        host_name               localhost
        alias                   localhost
        target                 127.0.0.1
        }

...

Add the _Environment and _Service values on setup:

/usr/local/nagios/etc/objects/localhost.cfg

...
        host_name               localhost
        alias                   localhost
        target                 127.0.0.1
        _Environment            Manufacturing
        _Service                Nagios
        }
...

Now mark most of the activities related to too little area on system partitio as System alerts. Choose this part of the file which describes just how to look for free area:

/usr/local/nagios/etc/objects/localhost.cfg

...
define solution{
        usage                             local-service         ; Name of solution template to make use of
        host_name                       localhost
        service_description             Root Partition
        check_command                   check_local_disk!20per cent!10per cent!/
        }
...

Modify it to associate it because of the System solution:

/usr/local/nagios/etc/objects/localhost.cfg

...
define solution{
        usage                             local-service         ; Name of solution template to make use of
        host_name                       localhost
        service_description             Root Partition
        check_command                   check_local_disk!20per cent!10per cent!/
        _Service                        System
        }
...

Save the file and leave the editor. Restart Nagios to use these brand new settings:

  • sudo systemctl restart nagios.service

Check the Nagios log file to make sure that the solution is operating correctly:

  • tail /usr/local/nagios/var/nagios.log

You'll understand output that is following**********)

Output

... [1505804481] [alerta] Initialising Nagios-Alerta Gateway module, v3.5.0 [1505804481] [alerta] debug is on [1505804481] [alerta] states=difficult (only) [1505804481] [alerta] ahead solution checks, host checks and downtime to http://your_alerta_server_ip/api [1505804481] Event broker module '/usr/lib/nagios/alerta-neb.o' initialized effectively. [1505804481] effectively launched demand file worker with pid 25416

Now Nagios will be sending a notification when any system or solution goes down. Let us produce a test occasion.

Step 3 — producing a Alert that is test to Nagios-Alerta Integration

Let's generate a test tuned in to make sure all things are linked. Automagically, Nagios monitors the quantity of free disk area in your host. We will produce a file that is temporary's adequate to trigger Nagios' file system use alert.

First, decide how much space that is free have actually on Nagios host. You should use the df demand to learn:

You'll see production such as the ( that is following**********)

Output

Filesystem Size Applied Avail Utilizeper cent Installed On /dev/vda1 20G 3.1G 16G 17per cent /

Look at number of free area available. The free space is 16GB in this case. Your space that is free may.

Use the fallocate demand generate a file that occupies significantly more than 80per cent of this available disk area, which will be sufficient to trigger the alert:

  • fallocate -l 14G /tmp/temp.img

Within a minutes that are few Nagios will trigger an alert about the amount of free disk space and will send the notification message to Alerta. You will see this notification that is new the Alerta dashboard:

Alerta displaying the free space alert from Nagios

Now so you can reclaim your disk space:( that you know the alerts are working, delete the temporary file you created**********)

After a moment Nagios will be sending the data recovery message. The alert will fade away from Alerta that is main dashboard you could see all shut activities by picking Closed.

Alerta's closed alerts

You can click the occasion line to look at more information.

Conclusion

In this guide, you configured Nagios to deliver notifications to some other host operating Alerta.

Alerta offers you a lace that is convenient track alerts from many systems. For example, if some right elements of your infrastructure usage Nagios yet others utilize Zabbix, you are able to merge notifications from both systems into one panel.

Apple to suspend iTunes shop help for “obsolete” first-gen Apple television

Previous article

How exactly to Install Webmin in your VPS

Next article

You may also like

Comments

Leave a reply

Your email address will not be published. Required fields are marked *

More in Linux