Skip to content

Commit dacb163

Browse files
committed
use 'zabbix' as default cache user for zabbix
1 parent 2fa7a98 commit dacb163

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

lib/vsc/utils/nagios.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ class SimpleNagios(NagiosResult):
435435
RESERVED_WORDS = set(['message', 'ok', 'warning', 'critical', 'unknown',
436436
'_exit', '_cache', '_cache_user', '_final', '_final_state', '_report', '_threshold'])
437437
REPORTERCLASS = NagiosReporter
438+
DEFAULT_CACHE_USER = 'nrpe'
438439

439440
def __init__(self, **kwargs):
440441
"""Initialise message and perfdata"""

lib/vsc/utils/script_tools.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _script_name(full_name):
8080
os.path.join(NAGIOS_CACHE_DIR,
8181
NAGIOS_CACHE_FILENAME_TEMPLATE % (_script_name(sys.argv[0]),))),
8282
'nagios-check-interval-threshold': ('threshold of nagios checks timing out', 'int', 'store', 0),
83-
'nagios-user': ('user nagios runs as', 'string', 'store', 'nrpe'),
83+
'nagios-user': ('user nagios runs as', 'string', 'store', None),
8484
'nagios-world-readable-check': ('make the nagios check data file world readable', None, 'store_true', False),
8585
}
8686

@@ -128,6 +128,9 @@ def __init__(self, options, run_prologue=True, excepthook=None, **kwargs):
128128
options_ = _merge_options(options)
129129
super(ExtendedSimpleOption, self).__init__(options_, **kwargs)
130130

131+
if not self.options.nagios_user:
132+
self.options.nagios_user = self.MONITORCLASS.DEFAULT_CACHE_USER
133+
131134
self.nagios_reporter = None
132135
self.lockfile = None
133136

lib/vsc/utils/zabbix.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def print_report_and_exit(self, timestamp, nagios_exit_code, nagios_exit_string,
5252
class SimpleZabbix(SimpleNagios):
5353
"""Class to allow easy interaction with Zabbix related code"""
5454
REPORTERCLASS = ZabbixReporter
55+
DEFAULT_CACHE_USER = 'zabbix'
5556

5657
def __str__(self):
5758
"""__str__ determines how the data is written to the cache"""

0 commit comments

Comments
 (0)