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
a9f7f74a
Commit
a9f7f74a
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
eol: fix help; shell syntax updates
parent
dab2cee1
Branches
Branches containing commit
No related tags found
1 merge request
!33
Update EOL help and docs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_eol
+21
-19
21 additions, 19 deletions
check_eol
with
21 additions
and
19 deletions
check_eol
+
21
−
19
View file @
a9f7f74a
...
@@ -47,12 +47,13 @@
...
@@ -47,12 +47,13 @@
# 2021-03-26 v1.2 <axel.hahn@iml.unibe.ch> test major version if minor version was not detected
# 2021-03-26 v1.2 <axel.hahn@iml.unibe.ch> test major version if minor version was not detected
# 2021-11-02 v1.3 <axel.hahn@iml.unibe.ch> detect centos stream
# 2021-11-02 v1.3 <axel.hahn@iml.unibe.ch> detect centos stream
# 2022-02-28 v1.4 <axel.hahn@iml.unibe.ch> remove negative performance data
# 2022-02-28 v1.4 <axel.hahn@iml.unibe.ch> remove negative performance data
# 2022-08-29 v1.5 <axel.hahn@iml.unibe.ch> fix help; shell syntax updates
# ======================================================================
# ======================================================================
.
`
dirname
$0
`
/inc_pluginfunctions
.
"
$(
dirname
$0
)
/inc_pluginfunctions
"
eolcfg
=
"
${
0
}
-data/*.cfg"
eolcfg
=
"
${
0
}
-data/*.cfg"
_version
=
"1.
3
"
_version
=
"1.
5
"
# --- limits
# --- limits
typeset
-i
iDaysWarn
=
365
typeset
-i
iDaysWarn
=
365
...
@@ -89,7 +90,7 @@ function autodetect(){
...
@@ -89,7 +90,7 @@ function autodetect(){
# --- stop 2: find version number
# --- stop 2: find version number
detectorPlugin
=
"
$0
-versiondetect/detect-
$myKey
"
detectorPlugin
=
"
$0
-versiondetect/detect-
$myKey
"
if
[
-x
"
$detectorPlugin
"
]
;
then
if
[
-x
"
$detectorPlugin
"
]
;
then
myVersion
=
`
.
"
$detectorPlugin
"
`
myVersion
=
$(
.
"
$detectorPlugin
"
)
fi
fi
if
[
-z
"
$myVersion
"
]
;
then
if
[
-z
"
$myVersion
"
]
;
then
ph.abort
"UNKNOWN: [
$myKey
] was not detected properly. It is unknown or output for version cannot be parsed."
ph.abort
"UNKNOWN: [
$myKey
] was not detected properly. It is unknown or output for version cannot be parsed."
...
@@ -108,8 +109,8 @@ function getDaysLeft(){
...
@@ -108,8 +109,8 @@ function getDaysLeft(){
local
mydate
=
$1
local
mydate
=
$1
echo
$mydate
|
grep
"[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]"
>
/dev/null
echo
$mydate
|
grep
"[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]"
>
/dev/null
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
typeset
-i
local
tsend
=
`
date
--date
=
"
$mydate
"
+%s
`
typeset
-i
local
tsend
=
$(
date
--date
=
"
$mydate
"
+%s
)
typeset
-i
local
daysLeft
=(
$tsend
-
`
date
+%s
`
)
/60/60/24
typeset
-i
local
daysLeft
=(
$tsend
-
$(
date
+%s
)
)
/60/60/24
echo
$daysLeft
echo
$daysLeft
fi
fi
}
}
...
@@ -125,7 +126,7 @@ function findEolDate(){
...
@@ -125,7 +126,7 @@ function findEolDate(){
local
bContinue
=
0
local
bContinue
=
0
while
[
$bContinue
=
0
]
;
do
while
[
$bContinue
=
0
]
;
do
myVerKey
=
$(
echo
$myVerKey
| rev |
cut
-f
2-
-d
"."
| rev
)
myVerKey
=
$(
echo
$myVerKey
| rev |
cut
-f
2-
-d
"."
| rev
)
line
=
`
grep
"^
$myKey
:
$myVerKey
:"
$eolcfg
|
sort
-n
|
tail
-1
`
line
=
$(
grep
"^
$myKey
:
$myVerKey
:"
$eolcfg
|
sort
-n
|
tail
-1
)
test
-z
"
$line
"
||
bContinue
=
1
test
-z
"
$line
"
||
bContinue
=
1
echo
$myVerKey
|
grep
"
\.
"
>
/dev/null
||
bContinue
=
1
echo
$myVerKey
|
grep
"
\.
"
>
/dev/null
||
bContinue
=
1
...
@@ -143,6 +144,7 @@ function findEolDate(){
...
@@ -143,6 +144,7 @@ function findEolDate(){
# --- no param? show help
# --- no param? show help
if
[
$#
-lt
2
]
;
then
if
[
$#
-lt
2
]
;
then
_self
=
$(
basename
$0
)
cat
<<
EOH
cat
<<
EOH
______________________________________________________________________
______________________________________________________________________
...
@@ -154,15 +156,15 @@ ______________________________________________________________________
...
@@ -154,15 +156,15 @@ ______________________________________________________________________
Check and of support of an OS or a product.
Check and of support of an OS or a product.
The dates are defined in the files check_eol-*.cfg
The dates are defined in the files check_eol-*.cfg
For detailed information see
`basename
$0
`
.md
For detailed information see
docs/20_Checks/check_eol
.md
USAGE
USAGE
$
`basename
$0
`
[-c CRITICAL] [-w WARING] PRODUCT VERSION
$
$_self
[-c CRITICAL] [-w WARING] PRODUCT VERSION
PARAMETERS
PARAMETERS
PRODUCT set a product; known product keys are listed below
PRODUCT set a product; known product keys are listed below
`
grep "^[a-zA-Z]"
$eolcfg
| cut -f 2 -d ":" | sort -u
n
| sed "s#^# #g"
`
$(
grep
"^[a-zA-Z]"
$eolcfg
|
cut
-f
2
-d
":"
|
sort
-u
|
sed
"s#^# #g"
)
VERSION set a version.
VERSION set a version.
Autodetection:
Autodetection:
...
@@ -175,10 +177,10 @@ OPTIONS
...
@@ -175,10 +177,10 @@ OPTIONS
-w set warning limit; default
$iDaysWarn
-w set warning limit; default
$iDaysWarn
EXAMPLES
EXAMPLES
`basename
$0
`
php
7.4
$_self
php
8.1
`basename
$0
`
-w 100 -c 30 php
7.4
$_self
-w 100 -c 30 php
8.1
`basename
$0
`
os detect
$_self
os detect
`basename
$0
`
php detect
$_self
php detect
EOH
EOH
...
@@ -228,18 +230,18 @@ if [ -z "$eol" ]; then
...
@@ -228,18 +230,18 @@ if [ -z "$eol" ]; then
echo
echo
grep
"^
$myKey
:"
$eolcfg
|
grep
-v
":
$myKey
:[0-9]"
|
cut
-f
3-
-d
":"
grep
"^
$myKey
:"
$eolcfg
|
grep
-v
":
$myKey
:[0-9]"
|
cut
-f
3-
-d
":"
echo
echo
echo
"Maybe an admin can add the version in
`
grep
-l
"^
$myKey
:"
$eolcfg
`
"
echo
"Maybe an admin can add the version in
$(
grep
-l
"^
$myKey
:"
$eolcfg
)
"
echo
"Existing/ known versions are:"
echo
"Existing/ known versions are:"
grep
"^
$myKey
:[0-9]"
$eolcfg
|
cut
-f
3
-d
":"
|
sort
-un
grep
"^
$myKey
:[0-9]"
$eolcfg
|
cut
-f
3
-d
":"
|
sort
-un
else
else
echo
"The product key [
$myKey
] was not detected in any version."
echo
"The product key [
$myKey
] was not detected in any version."
fi
fi
else
else
myEolVer
=
`
echo
$eol
|
cut
-f
3
-d
":"
`
myEolVer
=
$(
echo
$eol
|
cut
-f
3
-d
":"
)
myEolEnd
=
`
echo
$eol
|
cut
-f
4
-d
":"
`
myEolEnd
=
$(
echo
$eol
|
cut
-f
4
-d
":"
)
myComment
=
`
echo
$eol
|
cut
-f
5
-d
":"
`
myComment
=
$(
echo
$eol
|
cut
-f
5
-d
":"
)
myDaysLeft
=
`
getDaysLeft
$myEolEnd
`
myDaysLeft
=
$(
getDaysLeft
$myEolEnd
)
# --- verify days left with limits
# --- verify days left with limits
ph.setStatus
"ok"
ph.setStatus
"ok"
if
[
$myDaysLeft
-lt
$iDaysWarn
]
;
then
if
[
$myDaysLeft
-lt
$iDaysWarn
]
;
then
...
@@ -251,7 +253,7 @@ else
...
@@ -251,7 +253,7 @@ else
if
[
$myDaysLeft
-ge
0
]
;
then
if
[
$myDaysLeft
-ge
0
]
;
then
ph.status
"[
$myKey
$myEolVer
] ends on
$myEolEnd
...
$myDaysLeft
days left
$myComment
"
ph.status
"[
$myKey
$myEolVer
] ends on
$myEolEnd
...
$myDaysLeft
days left
$myComment
"
else
else
echo
"[
$myKey
$myEolVer
] ended on
$myEolEnd
...
`
echo
$myDaysLeft
|
sed
's#\-##'
`
days EXPIRED ALREADY !!!
$myComment
"
echo
"[
$myKey
$myEolVer
] ended on
$myEolEnd
...
$(
echo
$myDaysLeft
|
sed
's#\-##'
)
days EXPIRED ALREADY !!!
$myComment
"
fi
fi
echo
echo
grep
"^
$myKey
:"
$eolcfg
|
grep
-v
":
$myKey
:[0-9]"
|
cut
-f
3-
-d
":"
grep
"^
$myKey
:"
$eolcfg
|
grep
-v
":
$myKey
:[0-9]"
|
cut
-f
3-
-d
":"
...
...
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