Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
resmon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrors
resmon
Commits
91373b79
Commit
91373b79
authored
11 years ago
by
David Crosby
Browse files
Options
Downloads
Patches
Plain Diff
Module for CARP
parent
a9944b27
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Core/BSD/CARP.pm
+97
-0
97 additions, 0 deletions
lib/Core/BSD/CARP.pm
with
97 additions
and
0 deletions
lib/Core/BSD/CARP.pm
0 → 100644
+
97
−
0
View file @
91373b79
package
Core::BSD::
CARP
;
use
strict
;
use
warnings
;
use
base
'
Resmon::Module
';
use
Resmon::
ExtComm
qw(run_command cache_command)
;
=pod
=head1 NAME
Core::BSD::CARP - Checks the status of OpenBSD CARP interfaces
=head1 SYNOPSIS
Core::BSD::CARP {
* : noop
}
=head1 DESCRIPTION
This module reads values from ifconfig on OpenBSD to give the status of CARP
(Common Address Redundancy Protocol) interfaces.
=head1 CONFIGURATION
=over
=item check_name
This is a wildcard module and will return metrics for all CARP interfaces.
As such, the check name should be an asterisk (*).
=back
=head1 METRICS
=over
=item role
The role of the interface (whether it is MASTER or BACKUP)
=item advbase
How often the interface is advertised
=item advskew
How skewed the advertisement interval is
=back
=cut
sub
wildcard_handler
{
my
$self
=
shift
;
my
$interface
=
$self
->
{
check_name
};
# The check name is in here
my
$metrics
;
my
$iface
=
'';
my
$line
;
my
$output
=
run_command
("
ifconfig carp
");
my
@lines
=
split
("
\n
",
$output
);
foreach
$line
(
@lines
)
{
if
(
$line
=~
/^(carp\d+):/
)
{
$iface
=
$
1
;
}
if
(
$iface
ne
''
&&
$line
=~
/carp:/
)
{
$line
=~
/(BACKUP|MASTER)/
;
my
$role
=
$&
;
$line
=~
/carpdev (\w*)/
;
my
$carpdev
=
$
1
;
$line
=~
/vhid (\d*)/
;
my
$vhid
=
$
1
;
$line
=~
/advbase (\d*)/
;
my
$advbase
=
$
1
;
$line
=~
/advskew (\d*)/
;
my
$advskew
=
$
1
;
$metrics
->
{
$iface
}
=
{
"
role
"
=>
[
$role
,
"
s
"],
"
carpdev
"
=>
[
$carpdev
,
"
s
"],
"
vhid
"
=>
[
$vhid
,
"
I
"],
"
advbase
"
=>
[
$advbase
,
"
I
"],
"
advskew
"
=>
[
$advskew
,
"
I
"]
};
}
}
return
$metrics
;
};
1
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment