print "TRIG: I am a trigger in the element", self.get_full_name() nb_users = int(perf(self, 'users')) print "TRIG: Got NB users", nb_users print "Macros?", self.host.customs warn = int(self.host.customs.get('_USERS_WARN')) crit = int(self.host.customs.get('_USERS_CRIT')) state = 0 output = 'Check OK' if nb_users > warn: output = 'Warning: users are too high %s' % nb_users state = 1 if nb_users > crit: output = 'Critical: users are too high %s' % nb_users state = 2 # Must have better functions here! self.state_id = state self.state = {0: 'OK', 1: 'WARNING', 2: 'CRITICAL'}[state] self.output = output