How to Fetch Metrics¶
These instructions describe the ways to collect metrics from a filtering node.
Exporting Metrics Directly From collectd¶
You can export the metrics collected by collectd directly to the tools that support working with collectd data streams.
Prerequisites
All further steps must be performed as a superuser (e.g., root).
Exporting Metrics via the collectd Network Plugin¶
Configure and connect the network plugin to collectd:
-
Add the following configuration to the
/opt/wallarm/etc/collectd/wallarm-collectd.conffile:LoadPlugin network <Plugin "network"> Server "Server IPv4/v6 address or FQDN" "Server port" </Plugin>As stated in this configuration, the plugin will be loaded upon starting
collectd, operate in the client mode, and send the filter node’s metrics data to the specified server. -
Configure a server that will receive data from the
collectdclient. The necessary configuration steps depend on the selected server (see examples forcollectdand InfluxDB).Working with the Network Plugin
The network plugin works over UDP (see the plugin documentation). Make sure that the server allows communication over UDP for metrics collection to be operational.
-
Restart the
wallarmservice by running the following command:
-
In the
/etc/collectd/collectd.conf.d/directory, create a file with the.confextension (e.g.,export-via-network.conf) and the following content:LoadPlugin network <Plugin "network"> Server "Server IPv4/v6 address or FQDN" "Server port" </Plugin>As stated in this file, the plugin will be loaded upon starting
collectd, operate in the client mode, and send the filter node’s metrics data to the specified server. -
Configure a server that will receive data from the
collectdclient. The necessary configuration steps depend on the selected server (see examples forcollectdand InfluxDB).Working with the Network Plugin
The network plugin works over UDP (see the plugin documentation). Make sure that the server allows communication over UDP for metrics collection to be operational.
-
Restart the
collectdservice by executing the appropriate command:
Example
Read an example of exporting metrics to InfluxDB via the Network plugin with subsequent visualization of the metrics in Grafana.
Exporting Metrics via the collectd Write Plugins¶
To configure export of metrics via the collectd write plugins, refer to the documentation of the corresponding plugin.
Example
To get basic information about using write plugins, read an example of exporting metrics to Graphite with subsequent visualization of the metrics in Grafana.
Exporting Metrics Using the collectd-nagios Utility¶
To export metrics using this method:
-
Install the
collectd-nagiosutility on a host with a filter node by running the appropriate command (for a filter node installed on Linux):Docker image
The filter node Docker image ships with a preinstalled
collectd-nagiosutility. -
Make sure that you can run this utility with elevated privileges either on behalf of a superuser (for example,
root) or as a regular user. In the latter case, add the user to thesudoersfile with theNOPASSWDdirective, and use thesudoutility.Working with the Docker container
When executing the
collectd-nagiosutility in a Docker container with the filter node, elevation of privileges is not required. -
Connect and configure the
UnixSockplugin to transmit thecollectdmetrics via a Unix domain socket. To do this, create the file/etc/collectd/collectd.conf.d/unixsock.confwith the following content: -
Restart the
collectdservice by executing the appropriate command: -
Get the value of the necessary metric by running the appropriate command:
Getting the Docker container's ID
You can find the value of the container identifier by running the
docker pscommand (see the “CONTAINER ID” column).
Setting Thresholds for the collectd-nagios Utility
If necessary, you can specify a range of values for which the collectd-nagios utility will return the WARNING or CRITICAL status by using the corresponding -w and -c options (detailed information is available in the utility documentation).
Examples of using the utility:
-
To get the value of the
wallarm_nginx/gauge-abnormalmetric (at the timecollectd-nagioswas called) on the Linux hostnode.example.localwith the filter node, run the following command: -
To get the value of the
wallarm_nginx/gauge-abnormalmetric (at the timecollectd-nagioswas called) for the filter node running in the Docker container with thewallarm-nodename and the95d278317794identifier, run the following command:
More examples
To get basic information about using the collectd-nagios utility, read examples of exporting metrics
Sending Notifications from collectd¶
Notifications are configured in the following file:
A general description of how notifications work is available here.
More detailed information about how to set up notifications is available here.
Possible methods of sending notifications:
-
NSCA and NSCA-ng
-
SNMP TRAP
-
email messages
-
custom scripts