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.conf
file: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
collectd
client. The necessary configuration steps depend on the selected server (see examples forcollectd
and 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
wallarm
service by running the following command:
-
In the
/etc/collectd/collectd.conf.d/
directory, create a file with the.conf
extension (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
collectd
client. The necessary configuration steps depend on the selected server (see examples forcollectd
and 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
collectd
service 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-nagios
utility 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-nagios
utility. -
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 thesudoers
file with theNOPASSWD
directive, and use thesudo
utility.Working with the Docker container
When executing the
collectd-nagios
utility in a Docker container with the filter node, elevation of privileges is not required. -
Connect and configure the
UnixSock
plugin to transmit thecollectd
metrics via a Unix domain socket. To do this, create the file/etc/collectd/collectd.conf.d/unixsock.conf
with the following content: -
Restart the
collectd
service 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 ps
command (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
curl_json-wallarm_nginx/gauge-abnormal
metric (at the timecollectd-nagios
was called) on the Linux hostnode.example.local
with the filter node, run the following command: -
To get the value of the
curl_json-wallarm_nginx/gauge-abnormal
metric (at the timecollectd-nagios
was called) for the filter node running in the Docker container with thewallarm-node
name and the95d278317794
identifier, 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