]> git.proxmox.com Git - pve-manager.git/blame - PVE/ExtMetric.pm
move common metric server management part to own module
[pve-manager.git] / PVE / ExtMetric.pm
CommitLineData
f1f4bfef
TL
1package PVE::ExtMetric;
2
3use strict;
4use warnings;
5
6use PVE::Status::Plugin;
7use PVE::Status::Graphite;
8use PVE::Status::InfluxDB;
9
10PVE::Status::Graphite->register();
11PVE::Status::InfluxDB->register();
12PVE::Status::Plugin->init();
13
14sub foreach_plug($&) {
15 my ($status_cfg, $code) = @_;
16
17 for my $plugin_config (values %{$status_cfg->{ids}}) {
18 next if $plugin_config->{disable};
19 my $plugin = PVE::Status::Plugin->lookup($plugin_config->{type});
20 $code->($plugin, $plugin_config);
21 }
22}
23
24sub update_all($$@) {
25 my ($cfg, $subsystem, @params) = @_;
26
27 my $method = "update_${subsystem}_status";
28
29 foreach_plug($cfg, sub {
30 my ($plugin, $plugin_config) = @_;
31 $plugin->$method($plugin_config, @params);
32 });
33}
34
351;