This article will help you get the Tcp plugin for sd-agent configured and returning metrics
Installing the tcp plugin package
Install the tcp plugin on Debian/Ubuntu:
sudo apt-get install sd-agent-tcp-check
Install the tcp plugin on RHEL/CentOS:
sudo yum install sd-agent-tcp-check
Read more about agent plugins.
Configuring the agent to monitor TCP services
1. Configure /etc/sd-agent/conf.d/tcp_check.yaml
init_config: instances: - name: My first service host: myhost.example.com port: 8080 timeout: 1 # The (optional) collect_response_time parameter will instruct the # check to create a metric 'network.tcp.response_time', tagged with # the url, reporting the response time in seconds. # # collect_response_time: false # - name: My second service # host: 127.0.0.1 # port: 80
Configure a name, the host and port and finally a timeout. It's also possible to enable collection of the response time by enabling collect_response_time
2. Restart the agent
sudo /etc/init.d/sd-agent restart
or
sudo systemctl restart sd-agent
Verifying the configuration
Execute info to verify the configuration with the following:
sudo /etc/init.d/sd-agent info
or
/usr/share/python/sd-agent/agent.py info
If the agent has been configured correctly you'll see an output such as:
tcp ----- - instance #0 [OK] - Collected * metrics
You can also view the metrics returned with the following command:
sudo -u sd-agent /usr/share/python/sd-agent/agent.py check tcp_check
Configuring graphs
Click the name of your server from the Devices list in your Server Density account then go to the Metrics tab. Click the + Graph button on the right then choose the tcp metrics to display the graphs. The metrics will also be available to select when building dashboard graphs.
Monitored metrics
Metric | Values |
---|---|
network.tcp.response_time The response time of a given host and TCP port, tagged with url, e.g. 'url:192.168.1.100:22'. |
second / None Type: float |
Comments