Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- /usr/bin/env ss -ant | \
- awk '{
- if (NR>1) {
- state[$1]++;
- }
- }
- END {
- for (i in state) {
- s=i;
- sub(/ESTAB/, "establ", s);
- sub(/LISTEN/, "listen", s);
- sub(/SYN-SENT/, "synsent", s);
- sub(/SYN-RECV/, "synrecv", s);
- sub(/FIN-WAIT-1/, "finw1", s);
- sub(/FIN-WAIT-2/, "finw2", s);
- sub(/CLOSE-WAIT/, "closew", s);
- sub(/TIME-WAIT/, "timew", s);
- print "- tcp."s, state[i]
- }
- }' | /usr/bin/env zabbix_sender \
- --config /etc/zabbix/zabbix_agentd.conf \
- --input-file - >/dev/null 2>&1
- echo $?
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement