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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Merge requests
!11
use wget default params; shell fixes
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
use wget default params; shell fixes
add-wget-timeout
into
master
Overview
0
Commits
1
Pipelines
0
Changes
4
Merged
use wget default params; shell fixes
Hahn Axel (hahn)
requested to merge
add-wget-timeout
into
master
Apr 1, 2022
Overview
0
Commits
1
Pipelines
0
Changes
4
see
https://projects.iml.unibe.ch/projects/sysadmin/work_packages/5229/activity
Edited
Apr 1, 2022
by
Hahn Axel (hahn)
0
0
Merge request reports
Viewing commit
aeaaacf3
Show latest version
4 files
+
53
−
34
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
aeaaacf3
use wget default params; shell fixes
· aeaaacf3
Hahn Axel (hahn)
authored
Apr 1, 2022
check_haproxy_health
+
11
−
6
View file @ aeaaacf3
Edit in single-file editor
Open in Web IDE
Show full file
@@ -10,14 +10,19 @@
# 2020-05-04 v1.1 <axel.hahn@iml.unibe.ch> show message if monitor-uri was not set
# 2020-12-03 v1.2 <axel.hahn@iml.unibe.ch> loop over multiple frontend status urls
# 2021-12-14 v1.3 <axel.hahn@iml.unibe.ch> use updated haproxy paser in sourced file
# 2022-04-01 v1.4 <axel.hahn@iml.unibe.ch> use wget default params; shell fixes
# ======================================================================
.
`
dirname
$0
`
/inc_pluginfunctions
.
`
dirname
$0
`
/inc_haproxy_cfg.sh
.
$(
dirname
$0
)
/inc_pluginfunctions
.
$(
dirname
$0
)
/inc_haproxy_cfg.sh
cfgfile
=
/etc/haproxy/haproxy.cfg
tmpfile
=
/tmp/check_haproxy_healthcheck_
$$
paramsWget
=
"-T 5 -t 1 --no-check-certificate"
# ^ ^
# | tries = 1
# timeout in seconds
# ----------------------------------------------------------------------
@@ -27,7 +32,7 @@ ph.require wget
cat
$cfgfile
>
/dev/null
if
[
$?
-ne
0
]
;
then
ph.abort
"UNKNOWN: unable to read ha proxy config
$cfgfile
...
`
ls
-l
$cfgfile
`
"
ph.abort
"UNKNOWN: unable to read ha proxy config
$cfgfile
...
$(
ls
-l
$cfgfile
)
"
fi
cat
$cfgfile
|
grep
"
\
mode
\
.*http"
>
/dev/null
@@ -47,16 +52,16 @@ fi
safeurl
=
$(
echo
$url
|
sed
"s#
\(
://
\)\(
.*@
\)
#
\1
#g"
)
# --- get status page
wget
--no-check-certificate
-O
$tmpfile
$url
2>/dev/null
wget
$paramsWget
-O
$tmpfile
$url
2>/dev/null
if
[
$?
-ne
0
]
;
then
rm
-f
$tmpfile
ph.abort
"UNKNOWN: url
$safeurl
did not respond.
`
wget
--no-check-certificate
-O
-
-S
$url
`
"
ph.abort
"UNKNOWN: url
$safeurl
did not respond.
$(
wget
wget
$paramsWget
-O
-
-S
$url
)
"
fi
grep
"200 OK"
$tmpfile
>
/dev/null
if
[
$?
-ne
0
]
;
then
ph.setStatus
"error"
ph.status
"url
$safeurl
did not contain 200 OK.
`
wget
--no-check-certificate
-O
-
-S
$url
`
"
ph.status
"url
$safeurl
did not contain 200 OK.
$(
wget
wget
$paramsWget
-O
-
-S
$url
)
"
else
ph.status
"HA Proxy
$safeurl
is up and running."
fi
Loading