Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > 0f6d8f0a0414ceb7d968e706ca2bbf36 > files > 2080

shinken-1.4-1.fc18.noarch.rpm

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