Netdata Install : Différence entre versions
(→Slack) |
|||
| (7 révisions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 1 : | Ligne 1 : | ||
{| style="color: black; background-color: #ffffcc; width: 100%;" | {| style="color: black; background-color: #ffffcc; width: 100%;" | ||
| style="width: 30%; background-color: white; text-align: center;"| | | style="width: 30%; background-color: white; text-align: center;"| | ||
| − | [[Fichier: 41965.png| | + | [[Fichier: 41965.png|100px|center]] |
| style="width: 70%; background-color: white;"| | | style="width: 70%; background-color: white;"| | ||
| Ligne 50 : | Ligne 50 : | ||
====='''Centos / Fedora / Redhat:'''===== | ====='''Centos / Fedora / Redhat:'''===== | ||
| − | $ yum install zlib-devel libuuid-devel libmnl-devel gcc make git autoconf autogen automake pkgconfig | + | $ yum install epel-release -y |
| − | + | $ yum install zlib-devel libuuid-devel libmnl-devel gcc make git autoconf autogen automake pkgconfig curl jq nodejs | |
| + | |||
Puis il suffit alors de cloner le dépôt Github, puis d’exécuter netdata-installer.sh: | Puis il suffit alors de cloner le dépôt Github, puis d’exécuter netdata-installer.sh: | ||
| Ligne 125 : | Ligne 126 : | ||
==== <div style="background-color: #81BEF7">'''Configuration des notifications d'alarmes'''</div> ==== | ==== <div style="background-color: #81BEF7">'''Configuration des notifications d'alarmes'''</div> ==== | ||
| − | =====Slack===== | + | ====='''Slack'''===== |
Vous devez configurer dans Slack un channel ainsi qu'un Webhook : | Vous devez configurer dans Slack un channel ainsi qu'un Webhook : | ||
* https://csirt-exploitation.slack.com/apps/A0F7XDUAZ-webhooks-entrants?page=1 | * https://csirt-exploitation.slack.com/apps/A0F7XDUAZ-webhooks-entrants?page=1 | ||
| + | |||
| + | Dans le fichier /etc/netdata/health_alarm_notify.conf mettez les paramtres suivants avec la valeur '''NO''' hormis pour Slack : | ||
| + | |||
| + | SEND_EMAIL="NO" | ||
| + | SEND_PUSHOVER="NO" | ||
| + | SEND_PUSHBULLET="NO" | ||
| + | SEND_TWILIO="NO" | ||
| + | SEND_MESSAGEBIRD="NO" | ||
| + | SEND_KAVENEGAR="NO" | ||
| + | SEND_TELEGRAM="NO" | ||
| + | SEND_SLACK="'''YES'''" | ||
| + | SEND_ALERTA="NO" | ||
| + | SEND_FLOCK="NO" | ||
| + | SEND_DISCORD="NO" | ||
| + | SEND_HIPCHAT="NO" | ||
| + | SEND_KAFKA="NO" | ||
| + | SEND_PD="NO" | ||
| + | SEND_IRC="NO" | ||
| + | SEND_CUSTOM="NO" | ||
| + | |||
| + | La configuration de Slcak doit se faire comme le démontre l'exemple suivant : | ||
| + | |||
| + | #------------------------------------------------------------------------------ | ||
| + | # slack (slack.com) global notification options | ||
| + | |||
| + | # multiple recipients can be given like this: | ||
| + | # "CHANNEL1 CHANNEL2 ..." | ||
| + | |||
| + | # enable/disable sending slack notifications | ||
| + | SEND_SLACK="'''YES'''" | ||
| + | |||
| + | # Login to slack.com and create an incoming webhook. You need only one for all | ||
| + | # your netdata servers (or you can have one for each of your netdata). | ||
| + | # Without it, netdata cannot send slack notifications. | ||
| + | # Get yours from: https://api.slack.com/incoming-webhooks | ||
| + | SLACK_WEBHOOK_URL="'''https://hooks.slack.com/services/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jvo'''" | ||
| + | |||
| + | La configuration de votre Recipient doit être le Channel Slack créé : | ||
| + | |||
| + | # if a role's recipients are not configured, a notification will be send to | ||
| + | # this slack channel (empty = do not send a notification for unconfigured | ||
| + | # roles): | ||
| + | DEFAULT_RECIPIENT_SLACK="'''exploitation'''" | ||
| + | |||
| + | Pour tester il suffit de lancer le script suivant avec l'argument '''test''' : | ||
| + | |||
| + | $ '''/usr/libexec/netdata/plugins.d/alarm-notify.sh test''' | ||
| + | |||
| + | ====='''Résultats dans Slack'''===== | ||
| + | |||
| + | [[Fichier: Slack Alerte.png|800px|center]] | ||
| + | |||
| + | |||
| + | |||
| + | '''...To be continued''' | ||
Version actuelle datée du 19 avril 2018 à 20:33
|
Sommaire
Introduction
Lors d'incident de sécurité il est très difficile d'avoir l'ensemble des compteurs d'un système afin de connaitre quels organes est impactés. Netdata est une solution de monitoring très légère qui affiche via un Dashboard l’ensemble des informations sur l’usage des ressources de votre serveur. On y retrouve l’usage CPU, RAM, des disques avec chaque partitions mais également le détail des applications comme memcached, postfix ou redis. Cependant, à la différence des autres solutions, Netdata ne liste absolument aucune information pouvant présenter un risque sur le plan sécurité. L’avantage est qu’il n’est pas nécessaire de limiter l’accès au Dashboard et Netdata dispose de son propre serveur web qui ne démarre que lorsque vous consulter la page.
Installer Netdata
Vous pouvez utiliser le kickstart script pour installer netdata :
$ cd /usr/src/
Tous les systèmes linux:
$ bash <(curl -Ss https://my-netdata.io/kickstart.sh) all
Si vous choisissez l’installation manuelle, il faut d’abord installer les packages suivant :
Debian / Ubuntu:
$ apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autogen automake pkg-config curl jq nodejs
Centos / Fedora / Redhat:
$ yum install epel-release -y $ yum install zlib-devel libuuid-devel libmnl-devel gcc make git autoconf autogen automake pkgconfig curl jq nodejs
Puis il suffit alors de cloner le dépôt Github, puis d’exécuter netdata-installer.sh:
$ git clone https://github.com/firehol/netdata.git --depth=1 $ cd netdata $ ./netdata-installer.sh
^ |.-. .-. .-. .-. . netdata | '-' '-' '-' '-' real-time performance monitoring, done right! +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+---> You are about to build and install netdata to your system. It will be installed at these locations: - the daemon at /usr/sbin/netdata - config files in /etc/netdata - web files in /usr/share/netdata - plugins in /usr/libexec/netdata - cache files in /var/cache/netdata - db files in /var/lib/netdata - log files in /var/log/netdata - pid file at /var/run/netdata.pid - logrotate file at /etc/logrotate.d/netdata This installer allows you to change the installation path. Press Control-C and run the same command with --help for help. Press ENTER to build and install netdata to your system >
... Omitted terminal return ...
Maintenance de Netdata
netdata by default listens on all IPs on port 19999, so you can access it with: http://this.machine.ip:19999/ To stop netdata run: $ systemctl stop netdata To start netdata run: $ systemctl start netdata Uninstall script generated: ./netdata-uninstaller.sh Update script generated : ./netdata-updater.sh netdata-updater.sh can work from cron. It will trigger an email from cron only if it fails (it does not print anything when it can update netdata). Run this to automatically check and install netdata updates once per day: sudo ln -s /usr/src/netdata/netdata-updater.sh /etc/cron.daily/netdata-updater
Interface de Netdata
Pour se connecter à l'instance de Netdata, il suffit simplement d'entrer l'URL du serveur en http sur le port 19999 :
Les alarmes remontent dans la section Alarm dans la barre des taches :
Configuration des notifications d'alarmes
Slack
Vous devez configurer dans Slack un channel ainsi qu'un Webhook :
Dans le fichier /etc/netdata/health_alarm_notify.conf mettez les paramtres suivants avec la valeur NO hormis pour Slack :
SEND_EMAIL="NO" SEND_PUSHOVER="NO" SEND_PUSHBULLET="NO" SEND_TWILIO="NO" SEND_MESSAGEBIRD="NO" SEND_KAVENEGAR="NO" SEND_TELEGRAM="NO" SEND_SLACK="YES" SEND_ALERTA="NO" SEND_FLOCK="NO" SEND_DISCORD="NO" SEND_HIPCHAT="NO" SEND_KAFKA="NO" SEND_PD="NO" SEND_IRC="NO" SEND_CUSTOM="NO"
La configuration de Slcak doit se faire comme le démontre l'exemple suivant :
#------------------------------------------------------------------------------ # slack (slack.com) global notification options # multiple recipients can be given like this: # "CHANNEL1 CHANNEL2 ..." # enable/disable sending slack notifications SEND_SLACK="YES" # Login to slack.com and create an incoming webhook. You need only one for all # your netdata servers (or you can have one for each of your netdata). # Without it, netdata cannot send slack notifications. # Get yours from: https://api.slack.com/incoming-webhooks SLACK_WEBHOOK_URL="https://hooks.slack.com/services/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jvo"
La configuration de votre Recipient doit être le Channel Slack créé :
# if a role's recipients are not configured, a notification will be send to # this slack channel (empty = do not send a notification for unconfigured # roles): DEFAULT_RECIPIENT_SLACK="exploitation"
Pour tester il suffit de lancer le script suivant avec l'argument test :
$ /usr/libexec/netdata/plugins.d/alarm-notify.sh test
Résultats dans Slack
...To be continued


