#-----------------------------------------------------------------------
def verify( definition, logger ):
- "Verifiziert einen übergebenen Definitionsblock als Nagios-Host."
+ "Verifying a given definition block as a Nagios host"
res = {}
identifier = None
for key in definition:
if key == '__object_definition__':
+ res['__object_definition__'] = definition['__object_definition__']
+ continue
+ if re.match( r'^_', key ):
+ key_upper = key.upper()
+ if key_upper in res:
+ logger.warn( "Double entry {0} for host definition in {1}({2}).".format( key_upper, definition[key][1], definition[key][2] ) )
+ else:
+ res[key_upper] = definition[key][0]
continue
if not key in valid_keys:
- logger.warn( "Ungültige Eigenschaft {0!r} für Hostdefinition in {1}({2}).".format(
+ logger.warn( "Invalid property {0!r} for host definition in {1}({2}).".format(
key, definition[key][1], definition[key][2] ) )
verifier = NagiosObjectVerifier( logger = logger )
except NagiosVerifyError as e:
logger.warn( "Property error for host definition in {0}({1}): {2}".format( definition[key][1], definition[key][2], e ) )
+ if 'register' not in res:
+ res['register'] = True
+
if 'host_name' in res:
identifier = res['host_name']
elif 'name' in res:
#-----------------------------------------------------------------------
def verify( definition, logger ):
- "Verifying e given definition block as a Nagios host group"
+ "Verifying a given definition block as a Nagios host group"
res = {}
identifier = None
for key in definition:
if key == '__object_definition__':
+ res['__object_definition__'] = definition['__object_definition__']
+ continue
+ if re.match( r'^_', key ):
+ key_upper = key.upper()
+ if key_upper in res:
+ logger.warn( "Double entry {0} for hostgroup definition in {1}({2}).".format( key_upper, definition[key][1], definition[key][2] ) )
+ else:
+ res[key_upper] = definition[key][0]
continue
if not key in valid_keys:
logger.warn( "Invalid property {0!r} for hostgroup definition in {1}({2}).".format(
except NagiosVerifyError as e:
logger.warn( "Property error for host definition in {0}({1}): {2}".format( definition[key][1], definition[key][2], e ) )
+ if 'register' not in res:
+ res['register'] = True
+
if 'hostgroup_name' in res:
identifier = res['hostgroup_name']
elif 'name' in res:
for key in definition:
if key == '__object_definition__':
+ res['__object_definition__'] = definition['__object_definition__']
+ continue
+ if re.match( r'^_', key ):
+ key_upper = key.upper()
+ if key_upper in res:
+ logger.warn( "Double entry {0} for host definition in {1}({2}).".format( key_upper, definition[key][1], definition[key][2] ) )
+ else:
+ res[key_upper] = definition[key][0]
continue
if not key in valid_keys:
logger.warn( "Invalid Property {0!r} for service definition in {1}({2}).".format(
except NagiosVerifyError as e:
logger.warn( "Property error for service definition in {0}({1}): {2}".format( definition[key][1], definition[key][2], e ) )
+ if 'register' not in res:
+ res['register'] = True
+
if 'service_description' in res:
identifier = res['service_description']
elif 'name' in res: