Net::Prometheus::Pushgateway - client module for pushing metrics to prometheus exporter (pushgateway, prometheus aggregation gateway)
use Net::Prometheus::Pushgateway; # Create Net::Prometheus::Pushgateway object for pushgateway exporter my $metric = Net::Prometheus::Pushgateway->new( '-host' => '127.0.0.1', '-port' => 9091, '-path' => '/metrics/job/<job_name>/instance/<instance_name>', ); # OR # Create Net::Prometheus::Pushgateway object for prometheus aggregation gateway my $metric = Net::Prometheus::Pushgateway->new( '-host' => '127.0.0.1', '-port' => 9091, '-path' => '/api/ui/metrics', ); # Send increment metric $metric->increment(-metric_name => 'perl_metric_increment', -label => {'perl_label' => 5}); # Send summary metric $metric->summary(-metric_name => 'perl_metric_summary', -label => {'perl_label' => 5}, -value => 15); # Send histogram metric $metric->histogram(-metric_name => 'perl_metric_histogram', -label => {'perl_label' => 5}, -value => 15, -buckets => [qw/1 2 3 4 5/]);
Create Net::Prometheus::Pushgateway object
Options: -host => Prometheus exporter host -port => Prometheus exporter port number -path => Path to prometheus exporter host (/api/ui/metrics - prometheus aggregation gateway, /metrics/job/<job_name>/instance/<instance_name> - prometeus -timeout => LWP::UserAgent timeout (default: 5)
Push custom metrics
Options: -metric_name => Name of pushed metrics -label => HashRef to metric labels -value => Metric value -type => Metric type (default: untyped. Valid metric types in %Net::Prometheus::Pushgateway::METRIC_VALID_TYPE)S
Push increment metrics
Options: -metric_name => Name of pushed metrics -label => HashRef to metric labels
Push summary metrics
Options: -metric_name => Name of pushed metrics -value => Metric value -label => HashRef to metric labels (default: {})
Push histogram metric
Options: -metric_name => Name of pushed metrics -value => Metric value -label => HashRef to metric labels (default: {}) -buckets => ArayRef to buckets values
LWP::UserAgent
Pavel Andryushin <vrag867@gmail.com>
This software is copyright (c) 2020 by Pavel Andryushin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::Prometheus::Pushgateway, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Prometheus::Pushgateway
CPAN shell
perl -MCPAN -e shell install Net::Prometheus::Pushgateway
For more information on module installation, please visit the detailed CPAN module installation guide.