Skip to content

Commit

Permalink
Merge pull request #76 from swampdogmash/patch-7
Browse files Browse the repository at this point in the history
Update yum.py
  • Loading branch information
HenriWahl authored May 29, 2024
2 parents 3b4a1bb + 04a8ebf commit d9a0a2e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/python3/cmk/base/plugins/agent_based/yum.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,23 @@ def check_yum(params: Dict[str, int], section: Section):
yield Metric(name="normal_updates", value=section.packages)
# If there are no updates available, but we haven't been able to check security updates, still return
# a metric value of zero
elif section.packages == 0:
elif section.packages == 0:
yield Result(state=State.OK, summary=f"{section.packages} updates available")
yield Metric(name="normal_updates", value=section.packages)


# Check the status of the returned number of updates that are security updates including
# error condition and if there are no updates or the security updates check is not possible
# First check if ANY updates were flagged as security updates and report the metric
if section.security_packages >= 0:
if section.security_packages >= 0:
yield Result(state=State(params.get("security", 0)), summary=f"{section.security_packages} security updates available")
yield Metric(name="security_updates", value=section.security_packages)
# If there are no updates available, report this
elif section.security_packages == 0:
elif section.security_packages == 0:
yield Result(state=State.OK, summary=f"{section.security_packages} security updates available")
yield Metric(name="security_updates", value=section.security_packages)
#If the agent reported that security update was not available, return this with a report of 0 updates
elif section.security_packages == -2:
elif section.security_packages == -2:
yield Result(state=State.OK, summary='Security update check not available')
yield Metric(name="security_updates", value=0)
# If the security update check failed with an error, report this AND a value of zero
Expand Down

0 comments on commit d9a0a2e

Please sign in to comment.