PMDASTATSD(1)
PMDASTATSD π β¨
ok so this is the manual for pmdastatsd β like, from the General Commands Manual section (section 1, bestie). It's the StatsD protocol performance metric domain agent (PMDA). Yeah. We're doing this. Grab a snack π
πΈ NAME πΈ
pmdastatsd β the StatsD protocol performance metric domain agent (PMDA). that's the whole name section, she's short and she knows it π
β¨ SYNOPSIS β¨
$PCP_PMDAS_DIR/statsd/pmdastatsd [-D debug] [-Z maximum udp packet size]
[-P port] [-v] [-g] [-o debug output filename] [-s] [-r parser type] [-a
port] [-z maximum of unprocessed packets]
no cap that's a LOT of flags but we'll get through them together π«Ά
π DESCRIPTION π
okay so picture this: StatsD is a simple, text-based UDP protocol for receiving monitoring data of applications, and it lives in a client-server architecture. very demure, very mindful.
pmdastatsd is a Performance Metrics Domain Agent that scoops up StatsD data, aggregates it, and makes it available to literally any Performance Co-Pilot client. which is ideal for easily tracking stats in your application. iconic behaviour honestly.
the statsd PMDA supports these metric types: Counter, Gauge, and Duration β and Duration comes with instances for minimum, maximum, median, average, 90th percentile, 95th percentile, 99th percentile, count and standard deviation. she's thorough π
she also offers:
- multiple parsing options: Ragel or handwritten/custom parser π
- multiple aggregating options for the duration metric type: basic histogram or HDR histogram π
- support for a custom form of labels
- logging
- exports of multiple metrics about herself (self-obsessed, we love that for her π)
- and she may be configured either with an ini file or command line options
π CONFIGURATION π
here's the tea on the pmdastatsd command line options, bestie:
-Z,--max-udp=<value>β the maximum allowed packet size. anything larger than this gets thrown away ποΈ. Default:1472-P,--port=<value>β which port the agent will listen to for incoming traffic. Default:8125-v,--verboseβ verbosity level. prints info about agent execution into the logfile. valid values are0-2.0= the default value. shows config information, read socket state, and the first 100 dropped messages.1= shows PMNS and related information.2= the most detailed verbosity level, and also shows dropped messages above 100.- and yeah, all levels include those below them. nesting doll vibes πͺ
-o,--debug-output-filename=<value>β you can send aUSR1signal that 'asks' the agent to output basic information about all aggregated metrics into a$PCP_LOG_DIR/pmcd/statsd_{name}file. Default:0-s,--versionβ a flag controlling whether or not to log the current agent version on start. Default:0-p,--parser-type=<value>β a flag specifying which parser to use for incoming packets; Basic =0, Ragel =1. the Ragel parser includes better logging when verbose =2. Default:0-a,--duration-aggregation-type=<value>β a flag specifying which aggregation scheme to use for duration metrics; basic histogram =0, HDR histogram =1. Default:1-z,-max-unprocessed-packets=<value>β the maximum size of the packet queue that the agent will save in memory. there are 2 queues: one for packets that are waiting to be parsed, and one for parsed packets before they are aggregated. Default:2048
the agent also goes looking for a pmdastatsd.ini file in the $PCP_PMDAS_DIR/statsd directory. and over there you can specify the same options, just with slightly different names, like so:
max_udp_packet_size=<value>
port=<value>
verbose=<value>
debug=<value>
debug_output_filename=<value>
version=<value>
parser_type=<value>
duration_aggregation_type=<value>
max_unprocessed_packets=<value>
if an option shows up in both pmdastatsd.ini and the command line, then the command line wins, periodt. and most of the time you're gonna want to configure the agent with an ini file anyway, because the agent should never be executed directly π« (yes really, put it down).
location of the log file, since you asked: by default, a log file named statsd.log gets written in the current directory of pmcd(1) when pmdastatsd is started β that's $PCP_LOG_DIR/pmcd. and if the log file cannot be created or is not writable, the output goes to standard error instead. flexible queen π
π¦ INSTALLATION π¦
if you wanna install pmdastatsd, do this as root:
# cd $PCP_PMDAS_DIR/statsd
# ./Install
and to uninstall, as root:
# cd $PCP_PMDAS_DIR/statsd
# ./Remove
pmdastatsd is launched by pmcd(1) and should never be executed directly. the Install and Remove scripts are the ones that notify pmcd(1) when the agent is installed or removed. they're the messengers, let them do their job π«Ά
β¨ USAGE β¨
okay so once you've started her up, pmdastatsd just sits there listening on the port you told her about, waiting for content shaped like this:
<metricname>:<value>|<type>
and bestie, you can pack multiple of those into one single datagram, split by a newline character, so this right here:
<metricname>:<value>|<type>\n<metricname>:<value>|<type>
is completely valid too. and the rules for each of those lil variables? here's the vibe check:
<metricname> = [a-z][a-zA-Z0-9_.]*
<value> = described further in each metric type subsection
<type> = One of the following: c , g or ms
if you've got verbose logging turned on, the agent will literally log every single message it parses, plus all the related failures. no secrets, she's an open book π
and every recorded metric, if it got parsed and aggregated successfully, gets made available under the statsd.* namespace. slay.
πΈ 1 Counter metric πΈ
stores metrics as simple counters β she just adds whatever comes in to whatever's already there. simple as.
<metricname>:<value>|c
where value is a positive number.
Example:
after aggregating these messages:
metric:20|c
metric:10|c
metric:3.3|c
the value available to PCP will be:
# pminfo --fetch statsd.metric
inst [0 or '/'] value 33.3
π¦ 2 Gauge metric π¦
stores metrics as modifiable values, and you've got options β you can either set, increment or decrement them. main character energy tbh.
<metricname>:<value>|g
where value can be in a form of:
'-{value}'β when a negative value is supplied, the agent will subtract the value stored with the value passed'+{value}'β when a positive value with a leading plus sign is supplied, the agent will add the passed value to the value stored'{value}'β when a value without any leading sign is supplied, the agent will set the metric to the passed value
the initial value for a metric of gauge type is 0.
Example:
after aggregating these messages:
metric:20|g
metric:+10|g
metric:-3.3|g
the value available to PCP will be:
# pminfo --fetch statsd.metric
inst [0 or '/'] value 26.7
π 3 Duration metric π
aggregates values either via HDR histogram or just straight up stores all the values and then calculates instances from every value it received.
<metricname>:<value>|ms
where value is a positive number.
Example:
with a larger message count, the values may vary based on the selected duration aggregation scheme. (iykyk)
after aggregating these messages:
metric:10|ms
metric:20|ms
the values available to PCP will be:
# pminfo --fetch statsd.metric
inst[0 or '/min'] value 10
inst[1 or '/max'] value 20
inst[2 or '/median'] value 10
inst[3 or '/average'] value 15
inst[4 or '/percentile90'] value 20
inst[5 or '/percentile95'] value 20
inst[6 or '/percentile99'] value 20
inst[7 or '/count'] value 2
inst[8 or '/std_deviation'] value 5
Note:
once you send a givenmetricnamewith a specified type, the agent will no longer aggregate any messages with the samemetricnamebut a different type β she'll just throw them away. periodt. π
π 4 Labels π
StatsD datagrams may also contain key:value pairs separated by commas, like so:
metric,tagX=X,tagW=W:5|c
OR
metric:5|ms|#tagX:X,tagW:W
where tagX is a key, X is a value, tagW is a key, and W is a value.
both the key and value of such a pair are [a-ZA-Z0-9_.]{1,}.
both formats are interchangeable and you may combine them together. when a key is not unique, the right most value takes precedence. so this is valid:
metric,tagX=1:5|c|#tagX:2
the pair with key tagX will have value of 2. the way that just works β¨
you may use these labels to map specific values to some PCP instances. PCP labels are also assigned to these PCP instances. pairs are ordered by key in the resulting instance name and label descriptor.
Single label:
metric,tagX=X:5|c
such a payload would map to PCP as follows (non-related labels were omitted):
# pminfo --fetch --labels statsd.metric
inst [0 or '/tagX=X'] value 5
inst [0 or '/tagX=X'] labels {'tagX':'X'}
as shown earlier you may also send a payload with multiple labels. when multiple labels are supplied they are split in the instance name by '::'. Example:
metric,tagX=X,tagW=W:5|c
this resolves to:
# pminfo --fetch --labels statsd.metric
inst [0 or '/tagX=X::tagW=W'] value 5
inst [0 or '/tagX=X::tagW=W'] labels {'tagX':'X','tagW':'W'}
Note:
be mindful of the fact that duration metric type already maps to instances even without any labels. sending a labeled value to such a metric creates another 9 (as there are that many hardcoded) instances. yes really. π
Example:
metric:200|ms
metric:100|ms
metric,target=cpu2:10|ms
metric,target=cpu2:100|ms
metric,target=cpu2:1000|ms
creates 18 instances. duration data type and label name compose the instance name in the following manner:
# pminfo --fetch --labels statsd.metric
...
inst [10 or '/max::target=cpu0'] value 1000
inst [10 or '/max::target=cpu0'] labels {'target':'cpu0'}
...
π 5 Hardcoded stats π
the agent also exports metrics about herself β she's got main character energy and she's keeping receipts:
statsd.pmda.receivedβ number of datagrams that the agent has receivedstatsd.pmda.parsedβ number of datagrams that were successfully parsedstatsd.pmda.droppedβ number of datagrams that were droppedstatsd.pmda.aggregatedβ number of datagrams that were aggregatedstatsd.pmda.metrics_trackedβ this metric has 3 instances.counterβ number of tracked counter metrics.gaugeβ number of tracked gauge metrics.durationβ number of tracked duration metrics.totalβ number of tracked metrics total.statsd.pmda.time_spent_parsingβ total time in microseconds spent parsing metrics. includes time spent parsing a datagram and failing midway.statsd.pmda.time_spent_aggregatingβ total time in microseconds spent aggregating metrics. includes time spent aggregating a metric and failing midway.statsd.pmda.settings.max_udp_packet_sizeβ maximum UDP packet sizestatsd.pmda.settings.max_unprocessed_packetsβ maximum size of unprocessed packets Qstatsd.pmda.settings.verboseβ verbosity flagstatsd.pmda.settings.debug_output_filenameβ debug output filenamestatsd.pmda.settings.portβ port that is listened tostatsd.pmda.settings.parser_typeβ used parser typestatsd.pmda.settings.duration_aggregation_typeβ used duration aggregation type
these names are blacklisted for user usage. no messages with these names will be processed. and while it's not yet reserved, the whole statsd.pmda.* namespace is not recommended to use for user metrics. don't do it bestie, just don't.
π FILES π
$PCP_PMCDCONF_PATHβ command line options used to launchpmdastatsd$PCP_PMDAS_DIR/statsd/Installβ installation script for thepmdastatsdagent$PCP_PMDAS_DIR/statsd/Removeβ undo installation script for thepmdastatsdagent$PCP_LOG_DIR/pmcd/statsd.logβ default log file for error messages and other information frompmdastatsd
π PCP ENVIRONMENT π
environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. on each installation, the file /etc/pcp.conf contains the local values for these variables. the $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5).
π₯ DEBUGGING OPTIONS π₯
the -D or --debug option enables the output of additional diagnostics on stderr to help triage problems, although ngl the information is sometimes cryptic and primarily intended to provide guidance for developers rather than for end-users. debug is a comma separated list of debugging options; use pmdbg(1) with the -l option to obtain a list of the available debugging options and their meaning.
π«Ά SEE ALSO π«Ά
PCPIntro(1), pmcd(1), pcp.conf(5) and pcp.env(5).
and that's the whole page, bestie!! πβ¨ this one comes to you from the Performance Co-Pilot crew, under the PCP banner, and yes β it's the PMDASTATSD(1) manual page, dated right there in the footer. go forth and statsd responsibly ππ¦π
π¦ where this page comes from
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- Copyright (c) 2019 Miroslav FoltΓ½n. All Rights Reserved
- Copyright (c) 2019 Red Hat
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms