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
7344d545
There was an error fetching the commit references. Please try again later.
Commit
7344d545
authored
10 years ago
by
Yehuda Aryeh Katz
Committed by
Sergey Joseph Ivanov
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Initial stab at apt monitoring
parent
dd5bbfa5
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/Debian/Apt.pm
+79
-0
79 additions, 0 deletions
lib/Core/Debian/Apt.pm
with
79 additions
and
0 deletions
lib/Core/Debian/Apt.pm
0 → 100644
+
79
−
0
View file @
7344d545
package
Core::Debian::
Apt
;
use
strict
;
use
warnings
;
use
base
'
Resmon::Module
';
use
Resmon::
ExtComm
qw(run_command cache_command)
;
=pod
=head1 NAME
Core::Ubuntu::Apt - monitor apt status
=head1 SYNOPSIS
Core::Debian::Apt {
critical_number: 500
}
=head1 DESCRIPTION
This module checks for apt packages waiting for updates.
It assumes that apt-get update is being run by another process as it likely
does not have permission to run it.
=head1 CONFIGURATION
=over
=item critical_number
Number of waiting non-security packages to return warning or critical value.
=head1 METRICS
=over
=item total
The number of packages waiting
=item security
The number of security packages waiting
=back
=cut
sub
handler
{
my
$self
=
shift
;
my
$config
=
$self
->
{
config
};
# All configuration is in here
my
$critical_number
=
$self
->
{
critical_number
}
||
'
500
';
my
$apt_command
=
'
/usr/lib/nagios/plugins/check_apt
';
my
$use_dist
=
0
;
my
$output
=
cache_command
(
$apt_command
);
chomp
$output
;
$output
=~
/^APT (?<severity>:OK|WARNING|CRITICAL): (?<total>[0-9.]+) packages available for (?<dist>dist-)?upgrade \((?<security>[0-9.]+) critical updates\).$/
;
my
$status
=
"
OK
";
if
(
$+
{
total
}
>
$critical_number
)
{
$status
=
"
WARNING
";
}
if
(
$+
{
security
}
>
0
)
{
$status
=
"
BAD
";
}
return
$status
,
{
"
total
"
=>
[
$+
{
total
}
,
"
I
"],
"
security
"
=>
[
$+
{
security
},
"
I
"],
};
};
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