Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Commits
05ceafd3
Commit
05ceafd3
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
check_proc_mem shell fixes
parent
9f77025f
Branches
Branches containing commit
No related tags found
1 merge request
!55
Add check requirement
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_proc_mem
+8
-7
8 additions, 7 deletions
check_proc_mem
with
8 additions
and
7 deletions
check_proc_mem
+
8
−
7
View file @
05ceafd3
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# 2020-03-02 v1.0 initial version
# 2020-03-02 v1.0 initial version
# 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2023-02-13 v1.2 <axel.hahn@unibe.ch> some shell fixes
# ======================================================================
# ======================================================================
# --- tmp files for internal usage
# --- tmp files for internal usage
...
@@ -30,19 +31,19 @@ typeset -i iCountCritical=0
...
@@ -30,19 +31,19 @@ typeset -i iCountCritical=0
rm
-f
$tmpfile
$tmpfile2
$outCritical
$outWarning
2>/dev/null
rm
-f
$tmpfile
$tmpfile2
$outCritical
$outWarning
2>/dev/null
.
`
dirname
$0
`
/inc_pluginfunctions
.
$(
dirname
$0
)
/inc_pluginfunctions
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# MAIN
# MAIN
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# set default / override from command line params
# set default / override from command line params
typeset
-i
iWarnLimit
=
`
ph.getValueWithParam 100 w
"
$@
"
`
typeset
-i
iWarnLimit
=
$(
ph.getValueWithParam 100 w
"
$@
"
)
typeset
-i
iCriticalLimit
=
`
ph.getValueWithParam 500 c
"
$@
"
`
typeset
-i
iCriticalLimit
=
$(
ph.getValueWithParam 500 c
"
$@
"
)
# --- read processlist and create helper table
# --- read processlist and create helper table
ps
-yle
>
$tmpfile
ps
-yle
>
$tmpfile
for
processname
in
`
cat
$tmpfile
|
awk
{
'print $13'
}
|
sort
-u
|
f
grep
-v
"/"
`
for
processname
in
$(
cat
$tmpfile
|
awk
{
'print $13'
}
|
sort
-u
|
grep
-
F
v
"/"
)
do
do
#echo -n "$processname; ">>$tmpfile2
#echo -n "$processname; ">>$tmpfile2
ps
-ylC
$processname
|
awk
'
ps
-ylC
$processname
|
awk
'
...
@@ -54,10 +55,10 @@ done
...
@@ -54,10 +55,10 @@ done
# --- check limits
# --- check limits
while
read
line
while
read
line
do
do
typeset
-i
iSizeMB
=
`
echo
$line
|
awk
'{ print $2 }'
|
sed
"s#
\.
.*##"
`
typeset
-i
iSizeMB
=
$(
echo
$line
|
awk
'{ print $2 }'
|
sed
"s#
\.
.*##"
)
if
[
$iSizeMB
-ge
$iWarnLimit
]
;
then
if
[
$iSizeMB
-ge
$iWarnLimit
]
;
then
processname
=
`
echo
$line
|
awk
'{ print $1 }'
`
processname
=
$(
echo
$line
|
awk
'{ print $1 }'
)
processcount
=
`
echo
$line
|
awk
'{ print $3 }'
`
processcount
=
$(
echo
$line
|
awk
'{ print $3 }'
)
if
[
$iSizeMB
-ge
$iCriticalLimit
]
;
then
if
[
$iSizeMB
-ge
$iCriticalLimit
]
;
then
iCountCritical
=
$iCountCritical
+1
iCountCritical
=
$iCountCritical
+1
echo
"Critical:
$iSizeMB
MB -
$processname
(
$processcount
)"
>>
$outCritical
echo
"Critical:
$iSizeMB
MB -
$processname
(
$processcount
)"
>>
$outCritical
...
...
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