Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aix-pm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
aix-pm
Commits
2a3fdf76
Commit
2a3fdf76
authored
6 years ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
expose events as method; name variables more consistently
parent
26eebbc7
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
modules/util/Util/Monitoring.pm
+20
-7
20 additions, 7 deletions
modules/util/Util/Monitoring.pm
with
20 additions
and
7 deletions
modules/util/Util/Monitoring.pm
+
20
−
7
View file @
2a3fdf76
...
...
@@ -189,6 +189,15 @@ sub setup_ref
$ref
;
}
sub
event
{
my
$mon
=
shift
;
my
$ev
=
shift
;
my
$events
=
$mon
->
{
_events
};
my
$event_id
=
$events
->
insert
(
$ev
);
}
=head1 FILE SYSTEM METHODS
=cut
...
...
@@ -205,7 +214,7 @@ sub mon_fs
# $filesystems->df('h');
# print "filesystems: ", Dumper ($filesystems);
my
$worst_status
=
-
1
;
my
$worst_status
_code
=
-
1
;
my
$worst_msg
=
'
unknown
';
my
$now
=
time
();
...
...
@@ -220,7 +229,7 @@ sub mon_fs
# TODO:
# * calculate a proper nagios status code
# * update $worst_status accordingly
# * update $worst_status
_code
accordingly
my
@cmp
=
();
...
...
@@ -240,13 +249,13 @@ sub mon_fs
push
(
@cmp
,
$res_i
);
}
my
(
$nagios_status
,
$nagios_msg
)
=
compare_levels
(
@cmp
);
(
$worst_status
,
$worst_msg
)
=
compare_levels
([
$worst_status
,
$worst_msg
],
[
$nagios_status
,
$nagios_msg
]);
my
(
$nagios_status
_code
,
$nagios_msg
)
=
compare_levels
(
@cmp
);
(
$worst_status
_code
,
$worst_msg
)
=
compare_levels
([
$worst_status
_code
,
$worst_msg
],
[
$nagios_status
_code
,
$nagios_msg
]);
my
$rc
=
$moni
->
update
({
'
resource
'
=>
$x_fs
->
{'
mp
'}
},
{
'
resource
'
=>
$x_fs
->
{'
mp
'},
'
e
'
=>
$now
,
'
ts
'
=>
DateTime
->
from_epoch
('
epoch
'
=>
$now
),
'
nagios_status
'
=>
$nagios_status
[
$nagios_status
],
'
nagios_status_code
'
=>
$nagios_status
,
'
nagios_status
'
=>
$nagios_status
[
$nagios_status
_code
],
'
nagios_status_code
'
=>
$nagios_status
_code
,
'
nagios_msg
'
=>
$nagios_msg
,
'
val
'
=>
$x_fs
->
{'
k
'}
->
{'
used
'},
'
par
'
=>
$x_fs
...
...
@@ -264,7 +273,7 @@ sub mon_fs
'
e
'
=>
$now
,
# 'ts' => $ts,
# 'ts' => $ts->iso8601(),
'
worst_status
'
=>
$nagios_status
[
$worst_status
],
'
worst_status
'
=>
$nagios_status
[
$worst_status
_code
],
'
worst_msg
'
=>
$worst_msg
};
...
...
@@ -351,6 +360,10 @@ sub setup_default_collection
=head1 GENERIC STATUS FUNCTIONS
=head2 get_fs_level
return filling level of a filesystem in percent
=cut
sub
get_fs_level
...
...
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