]>
Commit | Line | Data |
---|---|---|
f1f4bfef TL |
1 | package PVE::ExtMetric; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | use PVE::Status::Plugin; | |
7 | use PVE::Status::Graphite; | |
8 | use PVE::Status::InfluxDB; | |
9 | ||
10 | PVE::Status::Graphite->register(); | |
11 | PVE::Status::InfluxDB->register(); | |
12 | PVE::Status::Plugin->init(); | |
13 | ||
14 | sub 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 | ||
24 | sub 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 | ||
35 | 1; |