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
0823c263
Commit
0823c263
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
packages2install - fix: count of security packages
parent
c5179404
Branches
Branches containing commit
No related tags found
1 merge request
!140
packages2install - fix: count of security packages
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
check_packages2install
+4
-4
4 additions, 4 deletions
check_packages2install
check_packages2install-pkgmanager/yum.sh
+7
-4
7 additions, 4 deletions
check_packages2install-pkgmanager/yum.sh
docs/20_Checks/check_packages2install.md
+1
-1
1 addition, 1 deletion
docs/20_Checks/check_packages2install.md
with
12 additions
and
9 deletions
check_packages2install
+
4
−
4
View file @
0823c263
...
...
@@ -24,7 +24,7 @@
# 2022-06-07 v1.10 <axel.hahn@iml.unibe.ch> fix iPkg2Update on empty package list
# rename package manager functions
# 2022-10-21 v1.11 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space
# 2023-08-24 v1.12 <axel.hahn@unibe.ch> update help
# 2023-08-24 v1.12 <axel.hahn@unibe.ch> update help
; rename to getSecurityCount
# ======================================================================
...
...
@@ -238,7 +238,7 @@ else
# generated function names - package manager is prefix
function2install
=
"
${
pkgmanager
}
.getPackageList"
_functionExists
"
${
pkgmanager
}
.getStatusLine"
&&
functionStatus
=
"
${
pkgmanager
}
.getStatusLine"
_functionExists
"
${
pkgmanager
}
.getCriticalList"
&&
function
Critical
=
"
${
pkgmanager
}
.get
CriticalLis
t"
_functionExists
"
${
pkgmanager
}
.getCriticalList"
&&
function
Securitycount
=
"
${
pkgmanager
}
.get
SecurityCoun
t"
# count of packages ... to install ... critical (centos only)
typeset
-i
iPkg2Update
=
0
...
...
@@ -252,8 +252,8 @@ else
test
-n
"
$functionStatus
"
&&
statusLabel
=
"[
$pkgmanager
]
$(
$functionStatus
)
"
# custom: get count of critical packages
if
[
-n
"
$function
Critical
"
]
;
then
iPkgCritical
=
$(
$function
Critical
"
$statusLabel
"
)
if
[
-n
"
$function
Securitycount
"
]
;
then
iPkgCritical
=
$(
$function
Securitycount
"
$statusLabel
"
)
ph.perfadd
"updates-security"
"
${
iPkgCritical
}
"
1 1
fi
...
...
This diff is collapsed.
Click to expand it.
check_packages2install-pkgmanager/yum.sh
+
7
−
4
View file @
0823c263
...
...
@@ -13,7 +13,7 @@
# rename functions
# 2022-08-31 v1.2 ah status line depends on os major version
# 2023-07-17 v1.3 ah fix hiding obsolete packages
# 2023-08-24 v1.4 ah update getStatusLine()
for centos9
# 2023-08-24 v1.4 ah
centos9:
update getStatusLine()
+
# ===============================================================
...
...
@@ -62,6 +62,7 @@ function yum.getStatusLine(){
local
_total
;
_total
=
$(
echo
"
${
packages2install
}
"
|
wc
-l
)
local
_sec
;
_sec
=
$(
sudo
/usr/bin/yum
-y
--security
check-update |
grep
-v
"^Last"
|
grep
-c
"."
)
# create a status line like in former yum versions
if
[
-z
"
$_sec
"
]
;
then
echo
"No packages needed for security;
${
_total
}
packages available"
else
...
...
@@ -79,13 +80,15 @@ function yum.getStatusLine(){
# ---------------------------------------------------------------
# extract count of critical packages
# param string text to extract critical counter from
function
yum.get
CriticalLis
t
(){
function
yum.get
SecurityCoun
t
(){
local
summary
=
"
$1
"
# example outputs:
# I No packages needed for security; 223 packages available
# II 2 package(s) needed for security, out of 237 available
# III No security updates needed, but 61 updates available << centos 8 stream
echo
"
$summary
"
|
cut
-f
1
-d
' '
|
sed
"s#[^0-9]##g"
# III No security updates needed, but 61 updates available << centos 8 stream
# IV [yum] No packages needed for security; 223 packages available << centos 9
# V [yum] 2 package(s) needed for security, out of 237 available << centos 9
echo
"
$summary
"
|
cut
-f
2
-d
' '
|
sed
"s#[^0-9]##g"
}
# ---------------------------------------------------------------
This diff is collapsed.
Click to expand it.
docs/20_Checks/check_packages2install.md
+
1
−
1
View file @
0823c263
...
...
@@ -80,7 +80,7 @@ Each file MUST contain minumum the functions
These functions are optional:
*
[packager].getStatusLine - get custom status line (1st line in output)
*
[packager].get
CriticalLis
t - extract count of critical packages
*
[packager].get
SecurityCoun
t - extract count of critical packages
from status line
### Define groups
...
...
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