#NEWLINE# def get_host_stats( self , hosts ) : #NEWLINE# #INDENT# ' Get statistics for Hosts, resp. Host entities ' #NEWLINE# stats = { #NEWLINE# #INDENT# 'hosts.total' : 0 , #NEWLINE# 'hosts.ok' : 0 , #NEWLINE# 'hosts.down' : 0 , #NEWLINE# 'hosts.unreachable' : 0 , #NEWLINE# 'hosts.flapping' : 0 , #NEWLINE# 'hosts.in_downtime' : 0 , #NEWLINE# 'hosts.checked' : 0 , #NEWLINE# 'hosts.scheduled' : 0 , #NEWLINE# 'hosts.active_checks' : 0 , #NEWLINE# 'hosts.passive_checks' : 0 , #NEWLINE# #UNINDENT# } #NEWLINE# for host in list ( hosts ) : #NEWLINE# #INDENT# if ( type ( host ) is not dict ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# sane = self . _sanitize_entity ( host ) #NEWLINE# stats [ 'hosts.total' ] += 1 #NEWLINE# stats [ 'hosts.flapping' ] += self . _trans_binary ( sane [ 'flapping' ] ) #NEWLINE# stats [ 'hosts.in_downtime' ] += self . _trans_dtime ( sane [ 'in_downtime' ] ) #NEWLINE# stats [ 'hosts.checked' ] += self . _trans_binary ( sane [ 'checked' ] ) #NEWLINE# stats [ 'hosts.scheduled' ] += self . _trans_binary ( sane [ 'scheduled' ] ) #NEWLINE# stats [ 'hosts.active_checks' ] += sane [ 'active_checks' ] #NEWLINE# stats [ 'hosts.passive_checks' ] += sane [ 'passive_checks' ] #NEWLINE# state_key = self . _trans_host_state ( sane [ 'state' ] ) #NEWLINE# stats [ ( 'hosts.%s' % state_key ) ] += 1 #NEWLINE# #UNINDENT# return stats