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
e45b8f42
Commit
e45b8f42
authored
4 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add readme
parent
6df364dc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inc_pluginfunctions.md
+85
-0
85 additions, 0 deletions
inc_pluginfunctions.md
readme.md
+14
-0
14 additions, 0 deletions
readme.md
with
99 additions
and
0 deletions
inc_pluginfunctions.md
0 → 100644
+
85
−
0
View file @
e45b8f42
# [IML Checks for Icinga / Nagios](redme.md)
## Shared functions
### Init
All scripts start with sourcing a shared bash file
. `dirname $0`/inc_pluginfunctions
In that script are several function starting with prefix
**ph.**
(=plugin helper)
### Available functions
This is a list in alphabetic order
**ph.abort**
[TEXT]
Shows error message and exit with status unknown.
**ph.exit**
Use at the end to send performance data and exit plugin with set statuscode
**ph.getFileAge**
[FILE]
get age of a given file in sec
**ph.getOS**
get operating system as lowercase - centos/ debian/ ubuntu ...
**ph.getOSMajor**
get OS Major version as integer, i.e. 7 on a CentOS7
**ph.getValueWithParam**
VALUE PARAMNAME "$@"
return default value or its override from command line.
Example:
typeset -i iWarnLimit=`ph.getValueWithParam 75 w "$@"`
This will set variable iWarnLimit based on CLI parameter -w [value] ... if it does not exist it gets the default 75.
**ph.setStatus**
[STATUS]
Set a status with keyword ok, warning, critical, unknown
You can override it as often you want during the script. Based on the last setting the ph.exit function will set the exitcode.
**ph.setStatusByLimit**
VALUE WARNLIMIT CRITLIMIT
set statuscode by verifying integer(!) value with crtical and warning limit
ph.setStatusByLimit $ramUsage $iWarnLimit $iCriticalLimit
**ph.status**
[TEXT]
Show status as Text.
**ph.execIfReady**
[FUNCTION] [ [WAITTIME] [MAXTRIES] ]
Execute a command and repeat max. MAXTRIES times if it fails.
**ph.perfadd**
[VALUE] [OPTIONS…]
Add performance data. Their output will be written with ph.exit. So you are free to add perfomance data anywhere within your check script.
**ph.perfdeltaspeed**
[VARNAME] [VALUE]
For increasing system counters: get changerate per second since last check.
# speed in byte per sec based on last stored value and its age
iSpeedRead=` ph.perfdeltaspeed "netio-${myinterface}-rx" $iRead`
**ph.perfshow**
dump performance data (if u are not using ph.exit)
**ph.require**
[PROG [PROG2]]
check if a binary PROG exists in search path (=are installed) - if not then execution stops with ph.abort
ph.reqire bc lsblk
This diff is collapsed.
Click to expand it.
readme.md
0 → 100644
+
14
−
0
View file @
e45b8f42
# IML Checks for Icinga / Nagios
## Introduction
IML - we are the Institute for Medical Education at university in Bern, Switzerland. This is a collection of our checks. They are used on Linux systems (Debian, CentOS, Ubuntu) and written in Bash using some shared functions.
## License
*
Licence: GNU GPL 3.0
*
Source: https://git-repo.iml.unibe.ch/iml-open-source/icinga-checks
## Scripts
[[inc_pluginfunctions.md]]
\ No newline at end of file
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