Ad Widget

Collapse

[?] How to monitor connection state on windows server?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zadops
    Junior Member
    • Jun 2015
    • 1

    #1

    [?] How to monitor connection state on windows server?

    Hello,

    We're building a new monitor system and my manager decided to choose zabbix. It's OK if we just use the default templates to monitor the systems' health

    But he asks me to monitor also the connection state on them, like how many ESTABLISHED, SYN_SENT, TIME_WAIT, LISTEN... connections there are on the servers

    I could do it fine on CentOS systems, thanks to this tutorial
    It’s strange that zabbix-agent lacks for information about network socket states. At least it would be nice to monitor number of ESTAB, TIME_WAIT and CLOSE_WAIT connections. Good that we can extend zabbix-agent - so I made this: Installation: Save this as /etc/zabbix/zabbix_agentd.conf.d/ss.conf: # Only UDP count returned on any sock[*] key query # All other items send to trap keys at the same time UserParameter=sock[*], /bin/ss -ant | grep -v State | awk 'BEGIN {s["CLOSE-WAIT"]=0;s["ESTAB"]=0;s["FIN-WAIT-1"]=0;s["FIN-WAIT-2"]=0;s["LAST-ACK"]=0;s["SYN-RECV"]=0;s["SYN-SENT"]=0;s["TIME-WAIT"]=0} {s[$$1]++} END {for (i in s) {print "- sock["i"]", s[i]}}' | /usr/bin/zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -i - >/dev/null; /bin/ss -anu | wc -l Import template with counters and graph template_app_sockets.xml How it works:

    and it runs really well

    but on windows servers, I have no idea. have been google for a couple of days but still haven't found any solution yet

    So if anybody has faced and solved this issue, please guide me. I really appreciate

    Thanks in adv
  • sancho
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2015
    • 295

    #2
    Hello zadops,
    Starting with a template for linux, I've modified for use in windows.
    To work to do the following changes to the agent computer that you want to monitor (the agent configuration is located in C:\Program Files\Zabbix Agent\zabbix_agentd.conf)

    Remote commands are enabled:
    EnableRemoteCommands=1

    The following lines are added in the user parameters:
    UserParameter=sockstat.sockets, netstat -ano | find /V "hola" /C
    UserParameter=sockstat.tcp.inuse, netstat -ano | findstr ESTABLISHED
    UserParameter=sockstat.tcp.inuse.count, netstat -ano | find /C "ESTABLISHED"
    UserParameter=sockstat.tcp.orphan, netstat -ano | findstr CLOSE_WAIT
    UserParameter=sockstat.tcp.orphan.count, netstat -ano | find /C "CLOSE_WAIT"
    UserParameter=sockstat.tcp.timewait, netstat -ano | findstr TIME_WAIT
    UserParameter=sockstat.tcp.timewait.count, netstat -ano | find /C "TIME_WAIT"
    UserParameter=sockstat.tcp.allocated, netstat -ano | findstr LISTENING
    UserParameter=sockstat.tcp.allocated.count, netstat -ano | find /C "LISTENING"
    UserParameter=sockstat.udp.inuse, netstat -ano | findstr UDP
    UserParameter=sockstat.udp.inuse.count, netstat -ano | find /C "UDP"
    Then the agent service on the computer restarts and you can add the template to Host, a few minutes longer should receive the data.
    I attached the template, it sure can be improved, I'm not a programmer.
    Hope you serve, and sorry for my horrible English

    The template and a sample image are in this post.
    Last edited by sancho; 13-08-2016, 04:35.

    Comment

    Working...