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
586998ca
Commit
586998ca
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
update opencpu
parent
38e39445
No related branches found
No related tags found
1 merge request
!138
6468 docs and harmonize
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_opencpu
+54
-6
54 additions, 6 deletions
check_opencpu
with
54 additions
and
6 deletions
check_opencpu
+
54
−
6
View file @
586998ca
...
...
@@ -20,16 +20,18 @@
# 2019-05-22 v1.1 show built date
# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2022-04-01 v1.3 <axel.hahn@iml.unibe.ch> use wget default params; shell fixes
# 2023-08-23 v1.4 <axel.hahn@unibe.ch> add help; add param -p; fix critical status
# ======================================================================
.
$(
dirname
$0
)
/inc_pluginfunctions
self_APPVERSION
=
1.4
tmpOk
=
/tmp/check_opencpu-ok
tmpErr
=
/tmp/check_opencpu-error
ocpuUrl
=
http://localhost/ocpu
packages
=
"eosceGLM eosceLinReg eosceReliability eosceReporter msrdAnalytics"
packages
Default
=
"eosceGLM eosceLinReg eosceReliability eosceReporter msrdAnalytics"
paramsWget
=
"-T 5 -t 1 --no-check-certificate"
# ^ ^
...
...
@@ -40,7 +42,43 @@ paramsWget="-T 5 -t 1 --no-check-certificate"
# FUNCTIONS
# ----------------------------------------------------------------------
# show help text
function
showHelp
(){
local
_self
;
_self
=
$(
basename
$0
)
cat
<<
EOF
$(
ph.showImlHelpHeader
)
Test if opencpu is available.
It returns OK if
- opencpu is running on
$ocpuUrl
- all packages are installed:
$packagesDefault
SYNTAX:
$_self
[-h] [-p PKG]
OPTIONS:
-h or --help show this help and exit.
PARAMETERS:
-p PKG(s) define package to test; for multiple packages quote
it and delimit them with space.
EXAMPLES:
$_self
-p "myPackage1 myPackage2 anotherPackage"
Check given opencpu packages
$_self
-p ""
Check Opencpu only (without packages)
EOF
}
# check if a givem packe is installed
# param string name of the package
function
checkOpenCpuPackage
(){
package
=
$1
pkgUrl
=
$ocpuUrl
/library/
$package
/info
...
...
@@ -59,23 +97,33 @@ function checkOpenCpuPackage(){
# MAIN
# ----------------------------------------------------------------------
# --- check param -h
case
"
$1
"
in
"--help"
|
"-h"
)
showHelp
exit
0
;;
*
)
esac
packages
=
$(
ph.getValueWithParam
"
$packagesDefault
"
"p"
"
$@
"
|
sort
)
rm
-f
$tmpOk
2>/dev/null
echo
-n
"OpenCpu: "
# ----- check if WGET exists
wget
--version
>
/dev/null 2>&1
if
[
$?
-ne
0
]
;
then
ph.abort
"UNKNOWN (wget was not found)"
fi
ph.require wget
# ----- check if openCpu is running
wget
$paramsWget
-O
/dev/null
$ocpuUrl
2>/dev/null
if
[
$?
-ne
0
]
;
then
echo
"ERROR: unable to connect to openCpu with
$ocpuUrl
"
echo
echo
"I repeat the http request to show some more debug infos:"
wget
$paramsWget
-O
/dev/null
-S
$ocpuUrl
ph.setStatus
"
error
"
ph.setStatus
"
critical
"
ph.exit
fi
...
...
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