Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-passive-client
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
Open Source
icinga-passive-client
Commits
248ec8ac
Commit
248ec8ac
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
check pipes in output and performance data
parent
62269723
Branches
Branches containing commit
No related tags found
1 merge request
!12
check pipes in output and performance data
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+51
-0
51 additions, 0 deletions
README.md
icinga-cli.sh
+15
-2
15 additions, 2 deletions
icinga-cli.sh
with
66 additions
and
2 deletions
README.md
0 → 100644
+
51
−
0
View file @
248ec8ac
```
text
_______ __
|_ _|.----.|__|.-----.-----.---.-.
_| |_ | __|| || | _ | _ |
|_______||____||__||__|__|___ |___._|
|_____|
______ __ ______ _____ __ __
| __ \.---.-.-----.-----.|__|.--.--.-----. | | |_|__|.-----.-----.| |_
| __/| _ |__ --|__ --|| || | | -__| | ---| | || -__| || _|
|___| |___._|_____|_____||__| \___/|_____| |______|_______|__||_____|__|__||____|
```
A set of shell scripts (Bash) for an icinga client.
With a director script you can create Hosts and service checks with Icingaweb2 director API.
With an Icinga2 script you can run checks and post its results to the Icinga2 API.
Licencse: GNU GPL 3.0
IML
*
Institute For Medical Education; University of Bern
## Requirements
Icinga:
*
In Icingaweb2 the module "director" must be enabled and the API access to it
*
An existing Icinga 2 instance with enabled API access
On clients:
*
Linux with Bash
## Basic Installation
As root...
*
Create a non privileged user "icingaclient".
*
Create a directory
`mkdir -p /opt/imlmonitor/ && cd /opt/imlmonitor/`
*
Run a git clone:
`git clone https://git-repo.iml.unibe.ch/open-source/icinga-passive-client.git client`
*
Set owner:
`chown -R icingaclient. client`
## Setup client
*
go to the "client" directory
`cd /opt/imlmonitor/client`
and copy _etc directory to /etc:
`cp -r _etc /etc/icingaclient`
## Setup Icingaweb2 director access
TBD
## Setup Icinga2 access
TBD
This diff is collapsed.
Click to expand it.
icinga-cli.sh
+
15
−
2
View file @
248ec8ac
...
...
@@ -15,11 +15,12 @@
# 2022-02-16 v0.8 ah add --cfg param
# 2022-03-04 v0.9 ah abort on http 5xx error
# 2022-03-14 v0.10 ah less output and add _elog to run as a service
# 2022-07-08 v0.11 ah check pipes in output and performance data
# ======================================================================
_product
=
"ICINGA PASSIVE CLIENT"
_version
=
"0.1
0
"
_version
=
"0.1
1
"
_license
=
"GNU GPL 3.0"
_copyright
=
'(c) 2020 Institute for Medical Education * University of Bern'
...
...
@@ -294,6 +295,7 @@ function processCheck(){
local
_myconfig
=
$1
local
_force
=
$2
typeset
-i
local
iPipes
typeset
-i
local
iCheckStart
iCheckStart
=
$(
_getUnixTs
)
...
...
@@ -350,16 +352,27 @@ function processCheck(){
_elog
"
${
_logPrefix
}
$(
ls
-ld
${
dir_data
}
$_outfile
)
"
exit
1
fi
iPipes
=
$(
sed
's#[^|]##g'
"
$_outfile
"
|
grep
"."
|
wc
-L
)
_echo
"Pipe chars:
$iPipes
"
if
[[
$iPipes
-gt
1
]]
;
then
_elog
"ABORT - pipes were found in plugin output"
exit
1
fi
typeset
-i
local
iTsEnd
=
`
date
+%s
`
# outPerfdata=`grep '|' $_outfile | cut -f 2 -d '|'`
outPerfdata
=
`
grep
'|'
$_outfile
| rev |
cut
-f
1
-d
'|'
| rev
`
_echo
_echo
--------
check output:
_echo
$(
cat
$_outfile
)
_echo
$(
cat
"
$_outfile
"
)
_echo
# echo -------- extracted performance data:
# echo $outPerfdata
# echo
if
!
echo
"
$outPerfdata
"
|
grep
"=[0-9
\.
]*;[0-9
\.
]*;[0-9
\.
]*;[0-9
\.
]*;"
>
/dev/null
;
then
_elog
"ABORT - this does not look like performance data:
$outPerfdata
"
exit
1
fi
_log
"
${
_logPrefix
}
check command finished with returncode
$rc
"
_rc
=
$_rc
+
$rc
...
...
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