icinga2: use post_config_hook
@@ -27,6 +27,7 @@ Configuration parameters:
import requests
STATUS_NAMES = {0: 'OK', 1: 'WARNING', 2: 'CRITICAL', 3: 'UNKNOWN'}
+STRING_NOT_CONFIGURED = 'not configured'
class Py3status:
@@ -43,6 +44,10 @@ class Py3status:
url_parameters = "?service_state={service_state}&format=json"
user = ''
+ def post_config_hook(self):
+ if not self.base_url:
+ raise Exception(STRING_NOT_CONFIGURED)
+
def get_status(self):
response = {
'cached_until': self.py3.time_in(self.cache_timeout),
