|
42 | 42 | from vsc.utils.generaloption import SimpleOption |
43 | 43 | from vsc.utils.lock import lock_or_bork, release_or_bork, LOCKFILE_DIR, LOCKFILE_FILENAME_TEMPLATE |
44 | 44 | from vsc.utils.nagios import ( |
45 | | - SimpleNagios, NAGIOS_CACHE_DIR, NAGIOS_CACHE_FILENAME_TEMPLATE, exit_from_errorcode, |
| 45 | + SimpleZabbix, SimpleNagios, NAGIOS_CACHE_DIR, NAGIOS_CACHE_FILENAME_TEMPLATE, exit_from_errorcode, |
46 | 46 | NAGIOS_EXIT_OK, NAGIOS_EXIT_WARNING, NAGIOS_EXIT_CRITICAL, NAGIOS_EXIT_UNKNOWN, |
47 | 47 | ) |
48 | 48 | from vsc.utils.timestamp import ( |
@@ -140,18 +140,18 @@ def __init__(self, options, run_prologue=True, excepthook=None, **kwargs): |
140 | 140 |
|
141 | 141 | self.log = fancylogger.getLogger() |
142 | 142 |
|
143 | | - def prologue(self): |
| 143 | + def prologue(self, MonitorClass=SimpleNagios): |
144 | 144 | """Checks the options given for settings and takes appropriate action. |
145 | 145 |
|
146 | 146 | See _merge_options for the format. |
147 | | -
|
148 | | - - if nagios_report is set, creates a SimpleNagios instance and prints the report. |
| 147 | + - MonitorClass: the class to use for interaction with the monitoring software |
| 148 | + - if nagios_report is set, creates a MonitorClass instance and prints the report. |
149 | 149 | - if ha is set, checks if running on the correct host, set the appropriate nagios message and bail if not. |
150 | 150 | - if locking_filename is set, take a lock. If the lock fails, bork and set the nagios exit accordingly. |
151 | 151 | """ |
152 | 152 |
|
153 | 153 | # bail if nagios report is requested |
154 | | - self.nagios_reporter = SimpleNagios(_cache=self.options.nagios_check_filename, |
| 154 | + self.nagios_reporter = MonitorClass(_cache=self.options.nagios_check_filename, |
155 | 155 | _report_and_exit=self.options.nagios_report, |
156 | 156 | _threshold=self.options.nagios_check_interval_threshold, |
157 | 157 | _cache_user=self.options.nagios_user, |
|
0 commit comments