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
9f77025f
Commit
9f77025f
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
check_memory: shellfixes
parent
2af97e2a
No related branches found
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_memory
+19
-18
19 additions, 18 deletions
check_memory
with
19 additions
and
18 deletions
check_memory
+
19
−
18
View file @
9f77025f
...
...
@@ -24,13 +24,14 @@
# 2021-03-24 v1.5 <axel.hahn@iml.unibe.ch> increase Swap critical limit 5 --> 50
# 2022-03-09 v1.6 <axel.hahn@iml.unibe.ch> show most ram intensive processes
# 2022-03-10 v1.7 <axel.hahn@iml.unibe.ch> add cli param -p; update help
# 2023-02-13 v1.8 <axel.hahn@unibe.ch> shell fixes
# ======================================================================
.
$(
dirname
$0
)
/inc_pluginfunctions
.
"
$(
dirname
$0
)
/inc_pluginfunctions
"
self_APPNAME
=
$(
basename
$0
|
tr
[
:lower:]
[
:upper:]
)
self_APPVERSION
=
1.
7
self_APPVERSION
=
1.
8
# ----------------------------------------------------------------------
# FUNCTIONS
...
...
@@ -97,30 +98,30 @@ ph.require bc
# ----------------------------------------------------------------------
# set default / override from command line params
typeset
-i
iWarnLimit
=
$(
ph.getValueWithParam 75 w
"
$@
"
)
typeset
-i
iCriticalLimit
=
$(
ph.getValueWithParam 90 c
"
$@
"
)
typeset
-i
iCriticalSwap
=
$(
ph.getValueWithParam 50 s
"
$@
"
)
typeset
-i
iMinRamUsageToShowProcesses
=
$(
ph.getValueWithParam 50 p
"
$@
"
)
typeset
-i
iWarnLimit
;
iWarnLimit
=
$(
ph.getValueWithParam 75 w
"
$@
"
)
typeset
-i
iCriticalLimit
;
iCriticalLimit
=
$(
ph.getValueWithParam 90 c
"
$@
"
)
typeset
-i
iCriticalSwap
;
iCriticalSwap
=
$(
ph.getValueWithParam 50 s
"
$@
"
)
typeset
-i
iMinRamUsageToShowProcesses
;
iMinRamUsageToShowProcesses
=
$(
ph.getValueWithParam 50 p
"
$@
"
)
# ----------------------------------------------------------------------
# read values
# --- RAM
typeset
-i
ramTotal
=
$(
getMemvalue MemTotal
)
typeset
-i
ramAvail
=
$(
getMemvalue MemAvailable
)
typeset
-i
ramUsed
=
$ramTotal
-
$ramAvail
typeset
-i
ramTotal
;
ramTotal
=
$(
getMemvalue MemTotal
)
typeset
-i
ramAvail
;
ramAvail
=
$(
getMemvalue MemAvailable
)
typeset
-i
ramUsed
;
ramUsed
=
$ramTotal
-
$ramAvail
typeset
-i
ramFree
=
$(
getMemvalue MemFree
)
typeset
-i
ramBuffers
=
$(
getMemvalue Buffers
)
typeset
-i
ramCached
=
$(
getMemvalue Cached
)
typeset
-i
ramSReclaim
=
$(
getMemvalue SReclaimable
)
typeset
-i
ramFree
;
ramFree
=
$(
getMemvalue MemFree
)
typeset
-i
ramBuffers
;
ramBuffers
=
$(
getMemvalue Buffers
)
typeset
-i
ramCached
;
ramCached
=
$(
getMemvalue Cached
)
typeset
-i
ramSReclaim
;
ramSReclaim
=
$(
getMemvalue SReclaimable
)
typeset
-i
ramUsage
=
$(
echo
"(
$ramUsed
) *100 /
$ramTotal
"
| bc
)
typeset
-i
ramUsage
;
ramUsage
=
$(
echo
"(
$ramUsed
) *100 /
$ramTotal
"
| bc
)
# --- Swap
typeset
-i
swapTotal
=
$(
getMemvalue SwapTotal
)
typeset
-i
swapFree
=
$(
getMemvalue SwapFree
)
typeset
-i
swapCached
=
$(
getMemvalue SwapCached
)
typeset
-i
swapTotal
;
swapTotal
=
$(
getMemvalue SwapTotal
)
typeset
-i
swapFree
;
swapFree
=
$(
getMemvalue SwapFree
)
typeset
-i
swapCached
;
swapCached
=
$(
getMemvalue SwapCached
)
typeset
-i
swapUsage
=
0
if
[
$swapTotal
-gt
0
]
;
then
...
...
@@ -147,7 +148,7 @@ fi
# --- show details
echo
cat
/proc/meminfo | egrep
"^(Mem|Cache|Buffers|Swap|Slab|SReclaimable)"
grep
-E
"^(Mem|Cache|Buffers|Swap|Slab|SReclaimable)"
"/proc/meminfo"
# v1.6: show most consuming processes if usage is > nn %
...
...
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