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
71a10629
Commit
71a10629
authored
13 years ago
by
Mark Harrison
Browse files
Options
Downloads
Plain Diff
Merge branch 'smfdisabled' of
http://github.com/haarg/resmon
parents
86a18c17
100d92f5
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/SmfDisabled.pm
+97
-0
97 additions, 0 deletions
lib/Core/SmfDisabled.pm
with
97 additions
and
0 deletions
lib/Core/SmfDisabled.pm
0 → 100644
+
97
−
0
View file @
71a10629
package
Core::
SmfDisabled
;
use
strict
;
use
warnings
;
use
base
'
Resmon::Module
';
use
Resmon::
ExtComm
qw(run_command cache_command)
;
=pod
=head1 NAME
Core::SmfDisabled - Monitor services in disabled mode
=head1 SYNOPSIS
Core::SmfDisabled {
sshd_disabled: pattern => ssh
apache_disabled: pattern => httpd
}
Core::SmfDisabled {
sshd_disabled: svcs_path => /bin/svcs, pattern => ssh
}
=head1 DESCRIPTION
This module monitors Solaris SMF services and reports on any that are in
disabled mode.
=head1 CONFIGURATION
=over
=item check_name
The check name is descriptive only in this check. It is not used for anything.
=item svcs_path
Provide an alternate path to the svcs command. Optional.
=item pattern
A perl regular expression of the services to report on. Optional. Defaults to all services.
=back
=head1 METRICS
=over
=item count
A count of how many services are in disabled mode. This should normally be
zero.
=item <service name>
For each service that matches the pattern, the a result will be
added with the service name as a metric. The value will be 1 for
disabled, and 0 otherwise.
=back
=cut
sub
handler
{
my
$self
=
shift
;
my
$config
=
$self
->
{
config
};
# All configuration is in here
my
$svcs_path
=
$config
->
{
svcs_path
}
||
'
svcs
';
my
$pattern
=
$config
->
{
pattern
}
||
'
.*
';
$pattern
=
qr/$pattern/
;
my
$output
=
{
count
=>
0
,
};
my
$svcs_output
=
run_command
("
$svcs_path
-a
");
my
@lines
=
grep
{
$_
ne
''
}
split
/\n/
,
$svcs_output
;
for
my
$line
(
@lines
)
{
my
(
$state
,
$start
,
$name
)
=
split
/\s+/
,
$line
,
3
;
if
(
$name
=~
$pattern
)
{
if
(
$state
eq
'
disabled
')
{
$output
->
{
count
}
++
;
$output
->
{
$name
}
=
1
;
}
else
{
$output
->
{
$name
}
=
0
;
}
}
}
return
$output
;
}
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