Skip to content

Commit

Permalink
fix!: handle changed opnsense api since 22.7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Jörg Dreffein committed Jun 26, 2024
1 parent cded7c2 commit 3ed4858
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions check_opnsense.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# check_opnsense.py - A check plugin for monitoring OPNsense firewalls.
# Copyright (C) 2018 Nicolai Buchwitz <[email protected]>
#
# Version: 0.1.0
# Version: 0.1.1
#
# ------------------------------------------------------------------------------
# This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -161,13 +161,12 @@ def checkUpdates(self):
url = self.getURL('core/firmware/status')
data = self.request(url)

if data['status'] == 'ok' and data['status_upgrade_action'] == 'all':
count = data['updates']
if data['status'] == 'update':

self.checkResult = NagiosState.WARNING
self.checkMessage = "{} pending updates".format(count)
self.checkMessage = data['status_msg']

if data['upgrade_needs_reboot']:
if data['needs_reboot']:
self.checkResult = NagiosState.CRITICAL
self.checkMessage = "{}. Subsequent reboot required.".format(self.checkMessage)
else:
Expand All @@ -179,4 +178,3 @@ def __init__(self):

opnsense = CheckOPNsense()
opnsense.check()

0 comments on commit 3ed4858

Please sign in to comment.