From 6707cd46c07cdc751b97435c34aab5b9ab499f2e Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Fri, 22 Dec 2023 16:39:16 +0100
Subject: [PATCH] add docs for check_proc_ressources

---
 docs/20_Checks/_index.md                |  2 +-
 docs/20_Checks/check_proc_ressources.md | 84 +++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 1 deletion(-)
 create mode 100644 docs/20_Checks/check_proc_ressources.md

diff --git a/docs/20_Checks/_index.md b/docs/20_Checks/_index.md
index fb67665..5cb5fc2 100644
--- a/docs/20_Checks/_index.md
+++ b/docs/20_Checks/_index.md
@@ -38,7 +38,7 @@ There is one include script used by all checks:
 * [check_packages2install](check_packages2install.md)
 * [check_php-fpm-status](check_php-fpm-status.md)
 * [check_proc_mem](check_proc_mem.md)
-* check_proc_ressources
+* [check_proc_ressources](check_proc_ressources.md)
 * check_proc_zombie
 * [check_psqlserver](check_psqlserver.md)
 * [check_rearbackup](check_rearbackup.md)
diff --git a/docs/20_Checks/check_proc_ressources.md b/docs/20_Checks/check_proc_ressources.md
new file mode 100644
index 0000000..e0722fb
--- /dev/null
+++ b/docs/20_Checks/check_proc_ressources.md
@@ -0,0 +1,84 @@
+# Check process resources regarding cpu and memory
+
+## Introduction
+
+Show processes that consume the most memory or cpu.
+You get a list with usage, process id and process
+
+## Requirements
+
+Nothing special.
+
+## Syntax
+
+```txt
+______________________________________________________________________
+
+CHECK_PROC_RESSOURCES
+v1.3
+
+(c) Institute for Medical Education - University of Bern
+Licence: GNU GPL 3
+
+https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_proc_ressources.html
+______________________________________________________________________
+
+SYNTAX:
+
+  check_proc_ressources -m METHOD [-w WARNLIMIT] [-c CRITICALLIMIT]
+  
+EXAMPLE:
+
+  -h, --help
+      show help
+
+  -c, --critical VALUE
+      critical value; defaults: 
+        * cpu 90
+        * mem 90
+
+  -m, --mode VALUE
+      identify what to check; one of cpu|mem
+      Remark: for cpu the given limits are multiplicated with count of cpu.
+
+  -w. --warning VALUE
+      warning limit value; defaults: 
+        * cpu 70
+        * mem 70
+
+EXAMPLE:
+
+  check_proc_ressources -m mem -w 50 -c 70
+      Show processes consuming more than 50% of memory; mark as critical
+      when using 70% and more.
+
+```
+
+## Examples
+
+### CPU check
+
+`./check_proc_ressources -m cpu -w 50 -c 70` returns
+
+```txt
+OK: all processes below warning limit 200 % Cpu .. (and critical limit 280 %)
+
+Cpus detected: 4
+```
+
+### Memory check
+
+`./check_proc_ressources -m mem -w 10 -c 70` returns
+
+```txt
+WARNING: 1 processes use 10 % .. 70 % Memory
+
+Level       Usage        process id  process
+-----------------------------------------------------
+Warning    10.9 % Memory       3807  pamac-manager
+
+MemTotal:       16135088 kB
+MemFree:         1420576 kB
+MemAvailable:    3913212 kB
+Cached:          4560964 kB
+```
-- 
GitLab