Ad Widget

Collapse

Empty graph on netstat monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sevmax
    Junior Member
    • Jun 2012
    • 6

    #1

    Empty graph on netstat monitoring

    Hi zabbix community,
    Please guide about following question.
    I'm trying to monitor number of opened connections to MySQL using netstat.
    On DB server I created file: /etc/zabbix/agent.d/netstat.conf
    Code:
    UserParameter=netstat_mysql_connection,netstat -ntp | grep mysql | grep ESTABLISH | wc -l
    And added this trigger to Zabbix server. It is shown as monitored item, but graph is empty.

    Two questions:
    1. What should I modify to make graph working ?
    2. Is there any better way to get number of connections to MySQL server on port 3306?

    Thank you in advance!
  • nickiv
    Junior Member
    • Jun 2012
    • 1

    #2
    Hello, sevmax.

    Most surely your empty graph is result of running zabbix agent under sestricted Linux User.

    Netstat -p parameter requires superuser privileges. You can confirm it by running your command after changing user to zabbix, like that:

    su zabbix
    netstat -ntp | grep mysql | grep ESTABLISH | wc -l
    exit

    I dont know yet how to overcome this limitation of netstat. But you can monitor Mysql Connections through server status.

    mysqladmin -uroot status -p<password>|cut -f2 -d":"|cut -f1 -d"T"

    Comment

    • sevmax
      Junior Member
      • Jun 2012
      • 6

      #3
      Thank you, nickiv.
      I was experimenting and found that this construction is working:

      Code:
      netstat -nt | grep 3306 | grep ESTABLISH | wc -l

      Comment

      Working...