Fix NRPE check_osd
Move the result of the systemd service state to `/var/lib/nagios` Change-Id: I83287590e279054973fdb28b374a49704626ed01 Closes-Bug: 1826594
This commit is contained in:
parent
6c7fdc3f50
commit
3b2e79a563
|
@ -6,9 +6,9 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
CRON_CHECK_TMPFILE = 'ceph-osd-checks'
|
||||
NAGIOS_HOME = '/var/lib/nagios'
|
||||
|
||||
STATE_OK = 0
|
||||
STATE_WARNING = 1
|
||||
|
@ -25,7 +25,7 @@ def run_main():
|
|||
|
||||
:returns: nagios state 0,2 or 3
|
||||
"""
|
||||
_tmp_file = os.path.join(tempfile.gettempdir(), CRON_CHECK_TMPFILE)
|
||||
_tmp_file = os.path.join(NAGIOS_HOME, CRON_CHECK_TMPFILE)
|
||||
|
||||
if not os.path.isfile(_tmp_file):
|
||||
print("File '{}' doesn't exist".format(_tmp_file))
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
# fasteners only exists in Bionic, so this will fail on xenial and trusty
|
||||
try:
|
||||
|
@ -17,6 +16,7 @@ except ImportError:
|
|||
SYSTEMD_SYSTEM = '/run/systemd/system'
|
||||
LOCKFILE = '/var/lock/check-osds.lock'
|
||||
CRON_CHECK_TMPFILE = 'ceph-osd-checks'
|
||||
NAGIOS_HOME = '/var/lib/nagios'
|
||||
|
||||
|
||||
def init_is_systemd():
|
||||
|
@ -67,7 +67,7 @@ def do_status():
|
|||
.format(e.output.decode('utf-8')))
|
||||
lines.append(output)
|
||||
|
||||
_tmp_file = os.path.join(tempfile.gettempdir(), CRON_CHECK_TMPFILE)
|
||||
_tmp_file = os.path.join(NAGIOS_HOME, CRON_CHECK_TMPFILE)
|
||||
with open(_tmp_file, 'wt') as f:
|
||||
f.writelines(lines)
|
||||
|
||||
|
|
Loading…
Reference in New Issue