-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mirrors/monitor: Split files out using the Snippets syntax
- Loading branch information
Showing
6 changed files
with
26 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
port_list_input=${1//:/|} | ||
port_list=${port_list_input:-"80|443"} | ||
netstat -ntW | gawk '{print tolower($6),gensub(/^(.+):([^:]+)$/,"\\1 \\2","g",$4)}' | grep -P " ($port_list)\$" | sort | uniq -c | sort -k 4 -k 3 | awk "{printf(\"connection,protocol=tcp,port=%s,address=%s %s=%s\n\",\$4,\$3,\$2,\$1)}" | ||
netstat -ntW | gawk '{print tolower($6),gensub(/^(.+):([^:]+)$/,"\\2","g",$4)}' | grep -P " ($port_list)\$" | sort | uniq -c | sort -k 3 | awk "{printf(\"connection,protocol=tcp,port=%s,address=any %s=%s\n\",\$3,\$2,\$1)}" |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
sudo nfacct list | awk '-F[ ,;]' "{printf(\"nfacct,object=%s bytes=%i,pkgs=%i\n\",\$11,\$8,\$4)}" |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
ps -e -o s= -o comm= | grep -v '^S' | sort | uniq -c | awk '{printf("process,state=%s,name=%s count=%i\n",$2,$3,$1)}' |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[[inputs.exec]] | ||
commands = [ | ||
"/opt/monitor/telegraf/connection.sh 21:80:443:873:9418", | ||
"/opt/monitor/telegraf/nfacct.sh", | ||
"/opt/monitor/telegraf/process.sh", | ||
] | ||
timeout = "5s" | ||
data_format = "influx" |
This file contains 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 characters
This file contains 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 characters