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
cb2e727b
Commit
cb2e727b
authored
12 years ago
by
Chris Nehren
Browse files
Options
Downloads
Patches
Plain Diff
Add a basic powermta probe using `pmta --dom show status`.
parent
4160ac71
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/Powermta.pm
+78
-0
78 additions, 0 deletions
lib/Core/Powermta.pm
with
78 additions
and
0 deletions
lib/Core/Powermta.pm
0 → 100644
+
78
−
0
View file @
cb2e727b
package
Core::
Powermta
;
use
strict
;
use
warnings
;
use
base
'
Resmon::Module
';
use
Resmon::
ExtComm
qw(run_command)
;
=pod
=head1 NAME
Core::Powermta - Monitor powermta statistics using sysctl
=head1 SYNOPSIS
Core::Powermta {
local : 'show_status' => 'status.traffic.total.out.msg,status.queue.smtp.rcp'
}
=head1 DESCRIPTION
This module uses the pmta command line tool and its DOM output format to check
on the status of the powermta mailer running on the local machine.
=head1 CONFIGURATION
=over
=item 'show status'
This configuration key takes a list of comma-separated MIB values to
look up with the `pmta show status` command, and will report their
values.
=back
=head1 METRICS
The metrics returned by this module vary by check used:
=head2 `SHOW STATUS` METRICS
This method can reference any check supported by the `pmta show status`
command.
=cut
sub
handler
{
my
$self
=
shift
;
my
$config
=
$self
->
{
config
};
if
(
my
$show_status_keys
=
$config
->
{
show_status
})
{
my
$raw_lines
=
run_command
(
qw/pmta --dom show status/
);
my
@lines
=
split
/\n/
,
$raw_lines
;
if
(
!
@lines
)
{
die
"
Error running `pmta --dom show status`!
\n
";
}
my
$mib_map
=
parse_pmta_output
(
\
@lines
);
my
@show_status_keys
=
split
/,/
,
$show_status_keys
;
my
$wanted_pairs
=
{
map
{
$_
=>
$mib_map
->
{
$_
}
}
@show_status_keys
};
return
$wanted_pairs
;
}
};
sub
parse_pmta_output
{
my
(
$raw_lines
)
=
@_
;
chomp
@$raw_lines
;
my
$mib_map
;
for
my
$line
(
@$raw_lines
)
{
my
(
$key
,
$value
)
=
$line
=~
/([^=]+)\s*=\s*"?([^"]+)"?/
;
next
unless
defined
$value
;
$mib_map
->
{
$key
}
=
$value
;
}
return
$mib_map
;
}
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