Collectd::Unixsock(3)

πŸ’– NAME

Okay bestie, welcome to the Collectd::Unixsock(3) page πŸ’… β€” Collectd::Unixsock is the abstraction layer for accessing the functionality by collectd's unixsock plugin. periodt. ✨


✨ SYNOPSIS

  use Collectd::Unixsock;

  my $sock = Collectd::Unixsock->new ($path);

  my $value = $sock->getval (%identifier);
  $sock->putval (%identifier,
                 time => time (),
                 values => [123, 234, 345]);

  $sock->destroy ();

🌸 DESCRIPTION

collectd's unixsock plugin lets external programs access the values it has collected or received β€” and also submit their own values. This Perl-module is literally just a little abstraction layer over that interface, making it even easier for programmers to interact with the daemon. iykyk 🫢


πŸ¦‹ VALUE IDENTIFIERS

The values in the collectd are identified using a five-tuple (host, plugin, plugin-instance, type, type-instance) where only plugin instance and type instance may be undef. not me knowing this by heart 😭

Many functions expect an %identifier hash that has at least the members host, plugin, and type, possibly completed by plugin_instance and type_instance.

Usually you can pass this hash like this:

  $self->method (host => $host, plugin => $plugin, type => $type, %other_args);

πŸ‘‘ PUBLIC METHODS

$self = Collectd::Unixsock->new ([$path]);

Creates a new connection to the daemon. The optional $path argument gives the path to the UNIX socket of the "unixsock plugin" and defaults to /var/run/collectd-unixsock. Returns the newly created object on success and false on error. slay connection setup πŸ’…

$res = $self->getval (%identifier);

Requests a value-list from the daemon. On success a hash-ref is returned with the name of each data-source as the key and the according value as, well, the value. On error false is returned. simple, iconic, no notes ✨

$res = $self->getthreshold (%identifier);

Requests a threshold from the daemon. On success a hash-ref is returned with the threshold data. On error false is returned. threshold tea β˜•

$self->putval (%identifier, time => $time, values => [...]);

Submits a value-list to the daemon. If the time argument is omitted time() is used. The required argument values is a reference to an array of values that is to be submitted. The number of values must match the number of values expected for the given type (see "VALUE IDENTIFIERS"), though this is checked by the daemon, not the Perl module. Also, gauge data-sources (e. g. system-load) may be "undef". Returns true upon success and false otherwise. put it in, bestie 🫢

$res = $self->listval_filter ( %identifier )

Queries a list of values from the daemon while restricting the results to certain hosts, plugins etc. The argument may be anything that passes for an identifier (cf. "VALUE IDENTIFIERS"), although all fields are optional. The returned data is in the same format as from "listval". filtered search, main character energy πŸ”₯

$res = $self->listval ()

Queries a list of values from the daemon. The list is returned as an array of hash references, where each hash reference is a valid identifier. The "time" member of each hash holds the epoch value of the last update of that value. timestamped and valid, periodt ⭐

$res = $self->putnotif (severity => $severity, message => $message, ...);

Submits a notification to the daemon.

Valid options are:

  • severity β€” sets the severity of the notification. The value must be one of the following strings: "failure", "warning", or "okay". Case does not matter. This option is mandatory. mandatory, bestie β€” don't skip it 😭
  • message β€” sets the message of the notification. This option is mandatory. also mandatory, no cap πŸ’…
  • time β€” sets the time. If omitted, time() is used. timey-wimey default behavior πŸ•°οΈ
  • Value identifier β€” all the other fields of the value identifiers, host, plugin, plugin_instance, type, and type_instance, are optional. When given, the notification is associated with the performance data of that identifier. For more details, please see collectd-unixsock(5). association station πŸ¦‹

$self->flush (timeout => $timeout, plugins => [...], identifier => [...]);

Flush cached data.

Valid options are:

  • timeout β€” if this option is specified, only data older than $timeout seconds is flushed. bye-bye old data ✨
  • plugins β€” if this option is specified, only the selected plugins will be flushed. The argument is a reference to an array of strings. choose your plugins, choose your destiny πŸ’…
  • identifier β€” if this option is specified, only the given identifier(s) will be flushed. The argument is a reference to an array of identifiers. Identifiers, in this case, are hash references and have the members as outlined in "VALUE IDENTIFIERS". targeted flush, iconic πŸŽ€

$self->destroy ();

Closes the socket before the object is destroyed. This function is also automatically called when the object goes out of scope. cleanup queen πŸ‘‘


πŸ”₯ SEE ALSO


πŸŽ€ AUTHOR

Florian octo Forster <octo@collectd.org> πŸ’–


πŸ’– That's the whole page, bestie β€” it's from perl v5.42.0, dated 2024-12-18, in the User Contributed Perl Documentation, and the manual is Collectd::Unixsock(3). byeee πŸŽ€βœ¨

πŸ“¦ where this page comes from