Last active
July 29, 2019 17:01
-
-
Save deepak7093/3476a3c1ba5c4f227a92a87f740217bb to your computer and use it in GitHub Desktop.
Revisions
-
deepak7093 revised this gist
Jul 29, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -67,5 +67,6 @@ Run `# echo 0 > /etc/netdata/scripts/flag.txt` Run `# crontab -e` Add `* * * * * run-parts /etc/netdata/scripts/etc_host_check.sh` 9. Now you must be able to gauge metrics under netdata statsd. -
deepak7093 revised this gist
Jul 29, 2019 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,8 +61,11 @@ else Run ` # touch /etc/netdata/scripts/flag.txt` Run `# echo 0 > /etc/netdata/scripts/flag.txt` 8. Now set cronjob to run script every 1 min Run `# crontab -e` Add `* * * * * run-parts /etc/netdata/scripts/etc_host_check.sh` 9. Now you must be able to gauge metrics under netdata statsd. -
deepak7093 revised this gist
Jul 29, 2019 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ 2. Create config file `/etc/netdata/statsd.d/file.conf` with below content Run ` # mkdir -p /etc/netdata/statsd.d/` Run `# vi /etc/netdata/statsd.d/file.conf` ``` [app] @@ -23,8 +24,11 @@ Run `# vi /etc/netdata/statsd.d/file.conf` ``` 3. Create dir to store user scripts Run `# mkdir -p /etc/netdata/scripts/` 4. Run `# vi /etc/netdata/scripts/etc_host_check.sh` Add content ``` #!/bin/bash @@ -53,7 +57,9 @@ else 5. Change `localhost` to your `netdata server ip` in above script. 6. Change <GIT_URL> to your original conf file. 7. Run `# mkdir -p /etc/netdata/scripts/` Run ` # touch /etc/netdata/scripts/flag.txt` Run `# echo 0 > /etc/netdata/scripts/flag.txt` 8. Now set cronjob to run script every 1 min Run `# crontab -e` -
deepak7093 revised this gist
Jul 29, 2019 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -53,9 +53,10 @@ else 5. Change `localhost` to your `netdata server ip` in above script. 6. Change <GIT_URL> to your original conf file. 7. Run `# mkdir -p /etc/netdata/scripts/` Run ` # touch /etc/netdata/scripts/flag.txt` Run `# echo 0 > /etc/netdata/scripts/flag.txt` 8. Now set cronjob to run script every 1 min Run `# crontab -e` Add `* * * * * run-parts /etc/netdata/scripts/etc_host_check.sh` 9. Now you must be able to gauge metrics under netdata statsd. -
deepak7093 revised this gist
Jul 29, 2019 . 1 changed file with 40 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ # Netdata host file integrity check with statsd 1. Check statsd plugin status Statsd is enabled by default, if not enable it inside, `/etc/netdata/netdata.conf` under [statsd] section. Default port is 8125. 2. Create config file `/etc/netdata/statsd.d/file.conf` with below content Run ` # mkdir -p /etc/netdata/statsd.d/` Run `# vi /etc/netdata/statsd.d/file.conf` ``` [app] name = filecheckapp @@ -22,4 +22,40 @@ vi /etc/netdata/statsd.d/file.conf dimension = resolve 'resolve me' last 1 1 ``` 3. Create dir to store user scripts Run `# mkdir -p /etc/netdata/scripts/` 4. Run `# vi /etc/netdata/scripts/etc_host_check.sh` Add content ``` #!/bin/bash rm original_host wget <GIT_URL> -O original_host base_md5=`md5sum original_host | cut -d' ' -f1` server_md5=`md5sum /etc/hosts | cut -d' ' -f1` flag=`cat /etc/netdata/scripts/flag.txt` if [[ $base_md5 == $server_md5 ]] && [[ $flag == 0 ]]; then echo "No change Required" elif [[ $base_md5 == $server_md5 ]] && [[ $flag == 1 ]]; then echo "OK : Host has valid /etc/hosts conf !!!" echo 0 > /etc/netdata/scripts/flag.txt; echo "hosts:-1|g" | nc -w 1 -u localhost 8125; elif [[ $base_md5 != $server_md5 ]] && [[ $flag == 0 ]]; then echo 1 > /etc/netdata/scripts/flag.txt; echo "WARNING: /etc/hosts file got changed." echo "hosts:+1|g" | nc -w 1 -u localhost 8125; else echo "Do nothig.." ``` 5. Change `localhost` to your `netdata server ip` in above script. 6. Change <GIT_URL> to your original conf file. 7. Run `# mkdir -p /etc/netdata/scripts/` ` # touch /etc/netdata/scripts/flag.txt` `# echo 0 > /etc/netdata/scripts/flag.txt` 8. Now set cronjob to run script every 1 min `# crontab -e` `* * * * * run-parts /etc/netdata/scripts/etc_host_check.sh` -
deepak7093 revised this gist
Jul 29, 2019 . 1 changed file with 23 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,25 @@ # Netdata file integrity check with statsd 1. Check statsd plugin status Statsd is enabled by default, if not enable it inside, `/etc/netdata/netdata.conf` under [statsd] section. Default port is 8125. 2. Create config file `/etc/netdata/statsd.d/file.conf` with below content mkdir -p /etc/netdata/statsd.d/ vi /etc/netdata/statsd.d/file.conf ``` [app] name = filecheckapp metrics = hosts resolve private charts = yes [file_chart1] title = Files Integrity Check family = file_family context = filecheckapp.filecheck units = filecheck type = area dimension = hosts 'hosts me' last 1 1 dimension = resolve 'resolve me' last 1 1 ``` 3. -
deepak7093 created this gist
Jul 29, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ 1. Check statsd plugin status Statsd is enabled by default, if not enable it inside, `/etc/netdata/netdata.conf`. Default port is 8125. 2.