How to configure Netdata monitoring using Slack Alarm

To Configure Netdata Monitoring using Slack Alarm

Introduction:

Netdata is an open-source tool designed to get real-time metrics including CPU usage, disk activity, bandwidth usage, website visits, etc. It can display it in live, and easy-to-interpret charts. For connecting Netdata to your Slack channel, you must create a webhook interface that can be used by Netdata to send the actual messages.

Installation Process:

First and foremost you have to login to slack workspace with the following steps Enter 6 characetr code received in your email id This is the workspace Provide the name for the team Logged in page of slack Now to assign the webhook to your slack open the incoming webhook Copy the webhook URL to configure in netdata alarm file To configure Slack alarm on netdata we have to move to the following directory

[root@linuxhelp ~]# cd /etc/netdata

Now list the files

[root@linuxhelp netdata]# ll
total 432
-rw-r--r--. 1 root root  46870 Jan 12 01:55 \
drwxr-xr-x. 2 root root      6 Jan  9 04:48 charts.d
drwxr-xr-x. 2 root root      6 Jan  9 04:48 custom-plugins.d
-rwxr-xr-x. 1 root root   2045 Jan 11 04:11 edit-config
drwxr-xr-x. 2 root root      6 Jan  9 04:48 go.d
-rw-r--r--. 1 root root      0 Jan 12 01:43 health_
-rwxr--r--. 1 root root  46867 Jan 12 07:17 health_alarm_notify.conf
drwxr-xr-x. 2 root root     79 Jan 12 06:59 health.d
-rw-r--r--. 1 root root 339587 Jan  9 04:49 netdata.conf
drwxr-xr-x. 2 root root      6 Jan  9 04:48 node.d
lrwxrwxrwx. 1 root root     23 Jan 11 04:11 orig -> /usr/lib/netdata/conf.d
drwxr-xr-x. 2 root root      6 Jan  9 04:48 python.d
drwxr-xr-x. 2 root root      6 Jan  9 04:48 ssl
drwxr-xr-x. 2 root root      6 Jan  9 04:48 statsd.d

now open alarm_notify.conf file using vim editor

[root@linuxhelp netdata]# vim health_alarm_notify.conf

And provide the details like the below snap After the configuration process we need to reload the netdata service

[root@linuxhelp netdata]# systemctl restart netdata

Now check the status

 [root@localhost ~]# systemctl status netdata
● netdata.service - Real time performance monitoring
   Loaded: loaded (/usr/lib/systemd/system/netdata.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2021-01-13 05:23:59 EST; 1min 21s ago
  Process: 8618 ExecStartPre=/bin/chown -R netdata:netdata /var/run/netdata (code=exited, status=0/SUCCESS)
  Process: 8612 ExecStartPre=/bin/mkdir -p /var/run/netdata (code=exited, status=0/SUCCESS)
  Tasks: 34
   CGroup: /system.slice/netdata.service
           ├─8621 /usr/sbin/netdata -P /var/run/netdata/netdata.pid -D
           ├─8628 /usr/sbin/netdata --special-spawn-server
           ├─8769 bash /usr/libexec/netdata/plugins.d/tc-qos-helper.sh 1

Jan 13 05:23:59 localhost.localdomain systemd[1]: Started Real time performan...
Jan 13 05:24:00 localhost.localdomain netdata[8621]: CONFIG: cannot load clou...
Jan 13 05:24:00 localhost.localdomain netdata[8621]: 2021-01-13 05:24:00: net...
Hint: Some lines were ellipsized, use -l to show in full.

Now move to the following location

[root@localhost ~]$ cd /etc/netdata/health.d

List the files

[root@localhost health.d]# ll
total 56
-rw-r--r--. 1 root root 46870 Jan 11 10:34 \
-rw-r--r--. 1 root root  1677 Jan 12 09:03 cpu.conf
-rwxr--r--. 1 root root     0 Jan 12 06:59 health_alarm_notify.conf
-rw-r--r--. 1 root root   190 Jan 12 08:57 ram.conf 

Now configure the CPU to load file according to your need

[root@localhost health.d]# vim cpu.conf

Now load netdata dashboard to reflex the changes in the netdata alarm Now to test slack alarm is connected to netdata we will send some dummy test alert to slack using following command

[root@localhost netdata]# /usr/libexec/netdata/plugins.d/alarm-notify.sh test

#SENDING TEST WARNING ALARM TO ROLE: sysadmin
2021-01-13 06:14:19: alarm-notify.sh: INFO: sent slack notification for: localhost.localdomain test.chart.test_alarm is WARNING to '#test'
2021-01-13 06:14:19: alarm-notify.sh: INFO: sent email notification for: localhost.localdomain test.chart.test_alarm is WARNING to 'root'
#OK

#SENDING TEST CRITICAL ALARM TO ROLE: sysadmin
2021-01-13 06:14:20: alarm-notify.sh: INFO: sent slack notification for: localhost.localdomain test.chart.test_alarm is CRITICAL to '#test'
2021-01-13 06:14:20: alarm-notify.sh: INFO: sent email notification for: localhost.localdomain test.chart.test_alarm is CRITICAL to 'root'
#OK

#SENDING TEST CLEAR ALARM TO ROLE: sysadmin
2021-01-13 06:14:21: alarm-notify.sh: INFO: sent slack notification for: localhost.localdomain test.chart.test_alarm is CLEAR to '#test'
2021-01-13 06:14:21: alarm-notify.sh: INFO: sent email notification for: localhost.localdomain test.chart.test_alarm is CLEAR to 'root'
#OK

Now check these alert on slack Now configure the ram.conf file according to the need in load range

[root@localhost netdata]# cd/health.d/ram.conf

After configuration restart the netdata service

[root@localhost netdata]# systemctl restart netdata

Now go to the slack and check for the RAM load alert

With this, the configuration of slack on netdata comes to an end.

Tag : Netdata Slack
FAQ
Q
Does Netdata provide cloud service?
A
Yes we can access the monitoring process using cloud services.
Q
How to restart netdata service?
A
you can use the command systemctl restart netdata to reflex the changes that you have made.
Q
What is the command to test slack alarm in Netdata?
A
The command used for that is /usr/libexec/netdata/plugins.d/alarm-notify.sh test.
Q
Can we create a health entity in Netdata?
A
yes, we can create your own health entity of any range of number in the health.d file
Q
What is Netdata?
A
Netdata is an open-source tool designed to collect real-time metrics, such as CPU usage, disk activity, bandwidth usage, website visits, etc., and then display them in live, easy-to-interpret charts.