fix some counters + enhance indent

This commit is contained in:
garnier-quentin 2020-09-01 10:20:40 +02:00
parent db7612be33
commit 6e83c1d639
9 changed files with 73 additions and 145 deletions

View File

@ -34,29 +34,26 @@ sub set_counters {
$self->{maps_counters}->{global} = [ $self->{maps_counters}->{global} = [
{ label => 'h323-packet-loss', nlabel => 'viewstation.h323.packet.loss.percentage', set => { { label => 'h323-packet-loss', nlabel => 'viewstation.h323.packet.loss.percentage', set => {
key_values => [ { name => 'polycomVSPercentPacketLoss' }, { name => 'display' } ], key_values => [ { name => 'polycomVSPercentPacketLoss' } ],
output_template => 'H323 Packet Loss %.2f %%', output_template => 'H323 Packet Loss %.2f %%',
perfdatas => [ perfdatas => [
{ value => 'polycomVSPercentPacketLoss', template => '%.2f', { template => '%.2f', min => 0, max => 100, unit => '%' }
min => 0, max => 100, unit => '%' }
] ]
} }
}, },
{ label => 'h323-jitter', nlabel => 'viewstation.h323.jitter.milliseconds', set => { { label => 'h323-jitter', nlabel => 'viewstation.h323.jitter.milliseconds', set => {
key_values => [ { name => 'polycomVSJitter' }, { name => 'display' } ], key_values => [ { name => 'polycomVSJitter' } ],
output_template => 'H323 (audio/video) Jitter %.2f ms', output_template => 'H323 (audio/video) Jitter %.2f ms',
perfdatas => [ perfdatas => [
{ value => 'polycomVSJitter', template => '%.2f', { template => '%.2f', min => 0, unit => 'ms' }
min => 0, unit => 'ms' }
] ]
} }
}, },
{ label => 'h323-latency', nlabel => 'viewstation.h323.latency.count', set => { { label => 'h323-latency', nlabel => 'viewstation.h323.latency.count', set => {
key_values => [ { name => 'polycomVSLatency' }, { name => 'display' } ], key_values => [ { name => 'polycomVSLatency' }],
output_template => 'H323 (audio/video) Latency %.2f', output_template => 'H323 (audio/video) Latency %.2f',
perfdatas => [ perfdatas => [
{ value => 'polycomVSLatency', template => '%.2f', { template => '%.2f', min => 0 }
min => 0, unit => '' }
] ]
} }
} }

View File

@ -30,14 +30,14 @@ sub new {
bless $self, $class; bless $self, $class;
$self->{version} = '1.0'; $self->{version} = '1.0';
%{$self->{modes}} = ( $self->{modes} = {
'cpu-detailed' => 'snmp_standard::mode::cpudetailed', 'cpu-detailed' => 'snmp_standard::mode::cpudetailed',
'interfaces' => 'snmp_standard::mode::interfaces', 'interfaces' => 'snmp_standard::mode::interfaces',
'load' => 'snmp_standard::mode::loadaverage', 'load' => 'snmp_standard::mode::loadaverage',
'memory' => 'snmp_standard::mode::memory', 'memory' => 'snmp_standard::mode::memory',
'uptime' => 'snmp_standard::mode::uptime', 'uptime' => 'snmp_standard::mode::uptime',
'viewstation-stats' => 'hardware::devices::polycom::hdx::snmp::mode::viewstationstats' 'viewstation-stats' => 'hardware::devices::polycom::hdx::snmp::mode::viewstationstats'
); };
return $self; return $self;
} }

View File

@ -34,14 +34,14 @@ sub set_counters {
]; ];
$self->{maps_counters}->{global} = [ $self->{maps_counters}->{global} = [
{ label => 'cluster-status', threshold => 0, set => { { label => 'cluster-status', type => 2, critical_default => '%{cluster_status} =~ /outOfService/i', set => {
key_values => [ { name => 'cluster_status' } ], key_values => [ { name => 'cluster_status' } ],
output_template => 'Current status %s', output_template => 'Current status %s',
closure_custom_perfdata => sub { return 0; }, closure_custom_perfdata => sub { return 0; },
closure_custom_threshold_check => \&catalog_status_threshold closure_custom_threshold_check => \&catalog_status_threshold
} }
}, },
{ label => 'cluster-change-cause', threshold => 0, set => { { label => 'cluster-change-cause', type => 2, set => {
key_values => [ { name => 'cluster_change_cause' } ], key_values => [ { name => 'cluster_change_cause' } ],
output_template => 'Last change cause: %s', output_template => 'Last change cause: %s',
closure_custom_perfdata => sub { return 0; }, closure_custom_perfdata => sub { return 0; },
@ -57,25 +57,12 @@ sub prefix_global_output {
return 'RPRM HA Super Cluster: '; return 'RPRM HA Super Cluster: ';
} }
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => [ 'warning_cluster_status', 'critical_cluster_status', 'warning_cluster_change_cause', 'critical_cluster_change_cause' ]);
return $self;
}
sub new { sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
'warning-cluster-status:s' => { name => 'warning_cluster_status', default => '' },
'critical-cluster-status:s' => { name => 'critical_cluster_status', default => '%{cluster_status} =~ /outOfService/i' },
'warning-cluster-change-cause:s' => { name => 'warning_cluster_change_cause', default => '' },
'critical-cluster-change-cause:s' => { name => 'critical_cluster_change_cause', default => '' }
}); });
return $self; return $self;

View File

@ -37,19 +37,19 @@ sub set_counters {
{ label => 'total-license-usage', nlabel => 'rprm.license.total.usage.count', set => { { label => 'total-license-usage', nlabel => 'rprm.license.total.usage.count', set => {
key_values => [ { name => 'total_license_usage' }, { name => 'total_license_capability' }, { name => 'total_license_usage_prct' }, { name => 'license_mode' } ], key_values => [ { name => 'total_license_usage' }, { name => 'total_license_capability' }, { name => 'total_license_usage_prct' }, { name => 'license_mode' } ],
closure_custom_output => $self->can('custom_license_output'), closure_custom_output => $self->can('custom_license_output'),
perfdatas => [ { value => 'total_license_usage', template => '%d', max => 'total_license_capability' } ] perfdatas => [ { template => '%d', max => 'total_license_capability' } ]
} }
}, },
{ label => 'audio-license-usage', nlabel => 'rprm.license.audio.usage.count', set => { { label => 'audio-license-usage', nlabel => 'rprm.license.audio.usage.count', set => {
key_values => [ { name => 'audio_license_usage' }, { name => 'audio_license_capability' }, { name => 'audio_license_usage_prct' } ], key_values => [ { name => 'audio_license_usage' }, { name => 'audio_license_capability' }, { name => 'audio_license_usage_prct' } ],
output_template => 'Audio licenses used: %s', output_template => 'Audio licenses used: %s',
perfdatas => [ { value => 'audio_license_usage', template => '%d', max => 'audio_license_capability' } ] perfdatas => [ { template => '%d', max => 'audio_license_capability' } ]
} }
}, },
{ label => 'video-license-usage', nlabel => 'rprm.license.video.usage.count', set => { { label => 'video-license-usage', nlabel => 'rprm.license.video.usage.count', set => {
key_values => [ { name => 'video_license_usage' }, { name => 'video_license_capability' }, { name => 'video_license_usage_prct' } ], key_values => [ { name => 'video_license_usage' }, { name => 'video_license_capability' }, { name => 'video_license_usage_prct' } ],
output_template => 'Video licenses used: %s', output_template => 'Video licenses used: %s',
perfdatas => [ { value => 'video_license_usage', template => '%d', max => 'video_license_capability' } ] perfdatas => [ { template => '%d', max => 'video_license_capability' } ]
} }
} }
]; ];
@ -67,11 +67,6 @@ sub custom_license_output {
); );
} }
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
}
sub new { sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);

View File

@ -34,7 +34,7 @@ sub set_counters {
]; ];
$self->{maps_counters}->{global} = [ $self->{maps_counters}->{global} = [
{ label => 'provisioning-status', threshold => 0, set => { { label => 'provisioning-status', type => 2, critical_default => '%{provisioning_status} =~ /failed/i', set => {
key_values => [ { name => 'provisioning_status' } ], key_values => [ { name => 'provisioning_status' } ],
closure_custom_output => $self->can('custom_provisioning_status_output'), closure_custom_output => $self->can('custom_provisioning_status_output'),
closure_custom_perfdata => sub { return 0; }, closure_custom_perfdata => sub { return 0; },
@ -45,8 +45,7 @@ sub set_counters {
key_values => [ { name => 'provisioning_failed' } ], key_values => [ { name => 'provisioning_failed' } ],
output_template => 'Failed last 60m: %s', output_template => 'Failed last 60m: %s',
perfdatas => [ perfdatas => [
{ value => 'provisioning_failed', template => '%s', { template => '%s', min => 0, unit => '' }
min => 0, unit => '' }
] ]
} }
}, },
@ -54,8 +53,7 @@ sub set_counters {
key_values => [ { name => 'provisioning_success' } ], key_values => [ { name => 'provisioning_success' } ],
output_template => 'Successed last 60m: %s', output_template => 'Successed last 60m: %s',
perfdatas => [ perfdatas => [
{ value => 'provisioning_success', template => '%s', { template => '%s', min => 0, unit => '' }
min => 0, unit => '' }
] ]
} }
} }
@ -74,23 +72,12 @@ sub prefix_global_output {
return 'RPRM Provisioning jobs stats: '; return 'RPRM Provisioning jobs stats: ';
} }
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => [ 'warning_provisioning_status', 'critical_provisioning_status' ]);
return $self;
}
sub new { sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
'warning-provisioning-status:s' => { name => 'warning_provisioning_status', default => '' },
'critical-provisioning-status:s' => { name => 'critical_provisioning_status', default => '%{provisioning_status} =~ /failed/i' },
}); });
return $self; return $self;

View File

@ -38,13 +38,13 @@ sub set_counters {
{ label => 'rprm-total-sitelinks', nlabel => 'rprm.sitelinks.total.count', set => { { label => 'rprm-total-sitelinks', nlabel => 'rprm.sitelinks.total.count', set => {
key_values => [ { name => 'sitelinks_count' } ], key_values => [ { name => 'sitelinks_count' } ],
output_template => 'Total sitelinks : %s', output_template => 'Total sitelinks : %s',
perfdatas => [ { value => 'sitelinks_count', template => '%s', min => 0 } ] perfdatas => [ { template => '%s', min => 0 } ]
} }
} }
]; ];
$self->{maps_counters}->{sitelink} = [ $self->{maps_counters}->{sitelink} = [
{ label => 'sitelink-status', threshold => 0, set => { { label => 'sitelink-status', type => 2, critical_default => '%{sitelink_status} =~ /failed/i', set => {
key_values => [ { name => 'sitelink_status' }, { name => 'display' } ], key_values => [ { name => 'sitelink_status' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_sitelink_status_output'), closure_custom_output => $self->can('custom_sitelink_status_output'),
closure_custom_perfdata => sub { return 0; }, closure_custom_perfdata => sub { return 0; },
@ -55,8 +55,7 @@ sub set_counters {
key_values => [ { name => 'sitelink_active_calls' }, { name => 'display' } ], key_values => [ { name => 'sitelink_active_calls' }, { name => 'display' } ],
output_template => 'current active calls: %s', output_template => 'current active calls: %s',
perfdatas => [ perfdatas => [
{ value => 'sitelink_active_calls', label_extra_instance => 1, { template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%s', min => 0 }
] ]
} }
}, },
@ -64,8 +63,7 @@ sub set_counters {
key_values => [ { name => 'sitelink_bandwidth_used_prct' }, { name => 'display' } ], key_values => [ { name => 'sitelink_bandwidth_used_prct' }, { name => 'display' } ],
output_template => 'current bandwidth usage: %.2f %%', output_template => 'current bandwidth usage: %.2f %%',
perfdatas => [ perfdatas => [
{ value => 'sitelink_bandwidth_used_prct', label_extra_instance => 1, unit => '%', { unit => '%', template => '%.2f', min => 0, max => 100, label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0, max => 100 }
] ]
} }
}, },
@ -73,8 +71,7 @@ sub set_counters {
key_values => [ { name => 'sitelink_bandwidth_total' }, { name => 'display' } ], key_values => [ { name => 'sitelink_bandwidth_total' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_bandwidth_total_output'), closure_custom_output => $self->can('custom_bandwidth_total_output'),
perfdatas => [ perfdatas => [
{ value => 'sitelink_bandwidth_total', label_extra_instance => 1, unit => 'B/s', { template => '%.2f', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0 }
] ]
} }
}, },
@ -82,8 +79,7 @@ sub set_counters {
key_values => [ { name => 'sitelink_callbitrate' }, { name => 'display' } ], key_values => [ { name => 'sitelink_callbitrate' }, { name => 'display' } ],
output_template => 'Average call bit rate: %.2f', output_template => 'Average call bit rate: %.2f',
perfdatas => [ perfdatas => [
{ value => 'sitelink_callbitrate', label_extra_instance => 1, { template => '%.2f', min => 0, label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0 }
] ]
} }
}, },
@ -91,8 +87,7 @@ sub set_counters {
key_values => [ { name => 'sitelink_packetloss_prct' }, { name => 'display' } ], key_values => [ { name => 'sitelink_packetloss_prct' }, { name => 'display' } ],
output_template => 'Average packetloss: %.2f %%', output_template => 'Average packetloss: %.2f %%',
perfdatas => [ perfdatas => [
{ value => 'sitelink_packetloss_prct', label_extra_instance => 1, unit => '%', { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0, max => 100 }
] ]
} }
}, },
@ -100,8 +95,7 @@ sub set_counters {
key_values => [ { name => 'sitelink_jitter' }, { name => 'display' } ], key_values => [ { name => 'sitelink_jitter' }, { name => 'display' } ],
output_template => 'Average jitter time: %.2f ms', output_template => 'Average jitter time: %.2f ms',
perfdatas => [ perfdatas => [
{ value => 'sitelink_jitter', label_extra_instance => 1, unit => 'ms', { template => '%.2f', min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0 }
] ]
} }
}, },
@ -109,32 +103,20 @@ sub set_counters {
key_values => [ { name => 'sitelink_delay' }, { name => 'display'} ], key_values => [ { name => 'sitelink_delay' }, { name => 'display'} ],
output_template => 'Average delay time: %.2f ms', output_template => 'Average delay time: %.2f ms',
perfdatas => [ perfdatas => [
{ value => 'sitelink_delay', label_extra_instance => 1, unit => 'ms', { template => '%.2f', min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0 }
] ]
} }
} }
]; ];
} }
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => [ 'warning_sitelink_status', 'critical_sitelink_status' ]);
return $self;
}
sub new { sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
'filter-sitelink:s' => { name => 'filter_sitelink' }, 'filter-sitelink:s' => { name => 'filter_sitelink' }
'warning-sitelink-status:s' => { name => 'warning_sitelink_status', default => '' },
'critical-sitelink-status:s' => { name => 'critical_sitelink_status', default => '%{sitelink_status} =~ /failed/i' }
}); });
return $self; return $self;

View File

@ -37,7 +37,7 @@ sub set_counters {
{ label => 'rprm-total-sites', nlabel => 'rprm.sites.total.count', set => { { label => 'rprm-total-sites', nlabel => 'rprm.sites.total.count', set => {
key_values => [ { name => 'sites_count' } ], key_values => [ { name => 'sites_count' } ],
output_template => 'Total sites: %s', output_template => 'Total sites: %s',
perfdatas => [ { value => 'sites_count', template => '%d', min => 0 } ] perfdatas => [ { template => '%d', min => 0 } ]
} }
} }
]; ];
@ -47,8 +47,7 @@ sub set_counters {
key_values => [ { name => 'site_active_calls' }, { name => 'display' } ], key_values => [ { name => 'site_active_calls' }, { name => 'display' } ],
output_template => 'current active calls: %s', output_template => 'current active calls: %s',
perfdatas => [ perfdatas => [
{ value => 'site_active_calls', label_extra_instance => 1, { template => '%s', min => 0, label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%s', min => 0 }
] ]
} }
}, },
@ -56,8 +55,7 @@ sub set_counters {
key_values => [ { name => 'site_bandwidth_used_prct' }, { name => 'display' } ], key_values => [ { name => 'site_bandwidth_used_prct' }, { name => 'display' } ],
output_template => 'current bandwidth usage: %.2f %%', output_template => 'current bandwidth usage: %.2f %%',
perfdatas => [ perfdatas => [
{ value => 'site_bandwidth_used_prct', label_extra_instance => 1, unit => '%', { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0, max => 100 }
] ]
} }
}, },
@ -65,8 +63,7 @@ sub set_counters {
key_values => [ { name => 'site_bandwidth_total' }, { name => 'display' } ], key_values => [ { name => 'site_bandwidth_total' }, { name => 'display' } ],
closure_custom_output => $self->can('custom_bandwidth_total_output'), closure_custom_output => $self->can('custom_bandwidth_total_output'),
perfdatas => [ perfdatas => [
{ value => 'site_bandwidth_total', label_extra_instance => 1, unit => 'B/s', { template => '%.2f', min => 0, unit => 'B/s', label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0 }
] ]
} }
}, },
@ -74,8 +71,7 @@ sub set_counters {
key_values => [ { name => 'site_callbitrate' }, { name => 'display' } ], key_values => [ { name => 'site_callbitrate' }, { name => 'display' } ],
output_template => 'Average call bit rate: %.2f', output_template => 'Average call bit rate: %.2f',
perfdatas => [ perfdatas => [
{ value => 'site_callbitrate', label_extra_instance => 1, { template => '%.2f', min => 0, label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0 }
] ]
} }
}, },
@ -83,8 +79,7 @@ sub set_counters {
key_values => [ { name => 'site_packetloss_prct' }, { name => 'display' } ], key_values => [ { name => 'site_packetloss_prct' }, { name => 'display' } ],
output_template => 'Average packetloss: %.2f %%', output_template => 'Average packetloss: %.2f %%',
perfdatas => [ perfdatas => [
{ value => 'site_packetloss_prct', label_extra_instance => 1, unit => '%', { template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0, max => 100 }
] ]
} }
}, },
@ -92,8 +87,7 @@ sub set_counters {
key_values => [ { name => 'site_jitter' }, { name => 'display' } ], key_values => [ { name => 'site_jitter' }, { name => 'display' } ],
output_template => 'Average jitter time: %.2f ms', output_template => 'Average jitter time: %.2f ms',
perfdatas => [ perfdatas => [
{ value => 'site_jitter', label_extra_instance => 1, unit => 'ms', { template => '%.2f', min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0 }
] ]
} }
}, },
@ -101,8 +95,7 @@ sub set_counters {
key_values => [ { name => 'site_delay' }, { name => 'display' } ], key_values => [ { name => 'site_delay' }, { name => 'display' } ],
output_template => 'Average delay time: %.2f ms', output_template => 'Average delay time: %.2f ms',
perfdatas => [ perfdatas => [
{ value => 'site_delay', label_extra_instance => 1, unit => 'ms', { template => '%.2f', min => 0, unit => 'ms', label_extra_instance => 1, instance_use => 'display' }
instance_use => 'display', template => '%.2f', min => 0 }
] ]
} }
} }
@ -115,7 +108,7 @@ sub new {
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
'filter-site:s' => { name => 'filter_site' }, 'filter-site:s' => { name => 'filter_site' }
}); });
return $self; return $self;
@ -146,7 +139,7 @@ sub manage_selection {
serviceTopologySiteAverageCallBitRate => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.7' }, serviceTopologySiteAverageCallBitRate => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.7' },
serviceTopologySitePacketLoss => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.8' }, serviceTopologySitePacketLoss => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.8' },
serviceTopologySiteAverageJitter => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.9' }, serviceTopologySiteAverageJitter => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.9' },
serviceTopologySiteAverageDelay => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.10' }, serviceTopologySiteAverageDelay => { oid => '.1.3.6.1.4.1.13885.102.1.2.14.4.1.10' }
}; };
my $oid_serviceTopologySiteEntry = '.1.3.6.1.4.1.13885.102.1.2.14.4.1'; my $oid_serviceTopologySiteEntry = '.1.3.6.1.4.1.13885.102.1.2.14.4.1';

View File

@ -34,7 +34,7 @@ sub set_counters {
]; ];
$self->{maps_counters}->{global} = [ $self->{maps_counters}->{global} = [
{ label => 'updates-status', threshold => 0, set => { { label => 'updates-status', type => 2, critical_default => '%{updates_status} =~ /failed/i',set => {
key_values => [ { name => 'updates_status' } ], key_values => [ { name => 'updates_status' } ],
closure_custom_output => $self->can('custom_updates_status_output'), closure_custom_output => $self->can('custom_updates_status_output'),
closure_custom_perfdata => sub { return 0; }, closure_custom_perfdata => sub { return 0; },
@ -45,8 +45,7 @@ sub set_counters {
key_values => [ { name => 'updates_failed' } ], key_values => [ { name => 'updates_failed' } ],
output_template => 'Failed last 60m: %s', output_template => 'Failed last 60m: %s',
perfdatas => [ perfdatas => [
{ value => 'updates_failed', template => '%s', { template => '%s', min => 0 }
min => 0, unit => '' }
] ]
} }
}, },
@ -54,8 +53,7 @@ sub set_counters {
key_values => [ { name => 'updates_success' } ], key_values => [ { name => 'updates_success' } ],
output_template => 'Successed last 60m: %s', output_template => 'Successed last 60m: %s',
perfdatas => [ perfdatas => [
{ value => 'updates_success', template => '%s', { template => '%s', min => 0 }
min => 0, unit => '' }
] ]
} }
} }
@ -74,23 +72,12 @@ sub prefix_global_output {
return 'RPRM Updates jobs stats: '; return 'RPRM Updates jobs stats: ';
} }
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->change_macros(macros => [ 'warning_updates_status', 'critical_updates_status' ]);
return $self;
}
sub new { sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
'warning-updates-status:s' => { name => 'warning_updates_status', default => '' },
'critical-updates-status:s' => { name => 'critical_updates_status', default => '%{updates_status} =~ /failed/i' },
}); });
return $self; return $self;

View File

@ -30,14 +30,14 @@ sub new {
bless $self, $class; bless $self, $class;
$self->{version} = '1.0'; $self->{version} = '1.0';
%{$self->{modes}} = ( $self->{modes} = {
'cluster-status' => 'hardware::devices::polycom::rprm::snmp::mode::clusterstatus', 'cluster-status' => 'hardware::devices::polycom::rprm::snmp::mode::clusterstatus',
'license' => 'hardware::devices::polycom::rprm::snmp::mode::license', 'license' => 'hardware::devices::polycom::rprm::snmp::mode::license',
'provisioning' => 'hardware::devices::polycom::rprm::snmp::mode::provisioning', 'provisioning' => 'hardware::devices::polycom::rprm::snmp::mode::provisioning',
'sitelinks' => 'hardware::devices::polycom::rprm::snmp::mode::sitelinks', 'sitelinks' => 'hardware::devices::polycom::rprm::snmp::mode::sitelinks',
'sites' => 'hardware::devices::polycom::rprm::snmp::mode::sites', 'sites' => 'hardware::devices::polycom::rprm::snmp::mode::sites',
'updates' => 'hardware::devices::polycom::rprm::snmp::mode::updates' 'updates' => 'hardware::devices::polycom::rprm::snmp::mode::updates'
); };
return $self; return $self;
} }