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
0301294b
Commit
0301294b
authored
6 years ago
by
Sergey Ivanov
Browse files
Options
Downloads
Patches
Plain Diff
CertMonger there for IPA servers
parent
3e11f044
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Site/CertMonger.pm
+87
-0
87 additions, 0 deletions
lib/Site/CertMonger.pm
with
87 additions
and
0 deletions
lib/Site/CertMonger.pm
0 → 100644
+
87
−
0
View file @
0301294b
package
Site::
CertMonger
;
use
strict
;
use
warnings
;
use
base
'
Resmon::Module
';
use
Resmon::
ExtComm
qw(run_command)
;
=pod
=head1 NAME
Site::CertMonger - Check if there is certificates in states other than status: MONITORING and stuck: no
=head1 SYNOPSIS
Site:CertMonger {
rofs: noop
}
=head1 DESCRIPTION
This module greps output of 'ipa-getcert list' command
=head1 CONFIGURATION
=over
=item check_name
The check name is descriptive only in this check. It is not used for anything.
=back
=head1 METRICS
=over
=item check_name
The name of the current check. You wouldn't normally return this, but it is
here to show how to access the check name, and for testing purposes.
=item certs
Shows the certificates in states which are different from Monitoring or are stuck.
=back
=cut
sub
handler
{
my
$self
=
shift
;
my
$config
=
$self
->
{
config
};
# All configuration is in here
my
$check_name
=
$self
->
{
check_name
};
# The check name is in here
my
$certs
=
'';
open
(
my
$listfh
,
"
-|
",
"
/usr/bin/ipa-getcert list
")
or
die
"
can't read output of /usr/bin/ipa-getcert list:$!
";
my
(
$requestid
,
$stuck
,
$status
)
=
('','','');
while
(
<
$listfh
>
)
{
chomp
;
if
(
/^Request ID '(\d*)':/
){
if
(
$requestid
&&
(
$status
||
$stuck
))
{
$certs
.=
"
$requestid
;
$status
;
$stuck
\n
";
(
$requestid
,
$status
,
$stuck
)
=
('','','');
}
$requestid
=
$_
;
}
elsif
(
/^\s*status: (?!MONITORING)/
){
$status
=
$_
;
}
elsif
(
/^\s*stuck: (?!no)/
){
$stuck
=
$_
;
}
}
if
(
$requestid
&&
(
$status
||
$stuck
))
{
$certs
.=
"
$requestid
;
$status
;
$stuck
";
(
$requestid
,
$status
,
$stuck
)
=
('','','');
}
return
{
"
check_name
"
=>
[
$self
->
{
check_name
},
"
s
"],
"
certs
"
=>
[
$certs
,
"
s
"],
};
};
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