def service_status(hostname=None, service=None, **kwargs):
 if (not hostname):
  raise CommandExecutionError('Missing hostname parameter')
 if (not service):
  raise CommandExecutionError('Missing service parameter')
 target = 'service'
 numeric = kwargs.get('numeric')
 data = _status_query(target, hostname, service=service, enumerate=numeric)
 ret = {'result': data['result']}
 if ret['result']:
  ret['status'] = data.get('json_data', {}).get('data', {}).get(target, {}).get('status', (((not numeric) and 'Unknown') or 2))
 else:
  ret['error'] = data['error']
 return ret

def service_status ( hostname = None , service = None , ** kwargs ) : if ( not hostname ) : raise CommandExecutionError ( 'Missing hostname parameter' ) if ( not service ) : raise CommandExecutionError ( 'Missing service parameter' ) target = 'service' numeric = kwargs . get ( 'numeric' ) data = _status_query ( target , hostname , service = service , enumerate = numeric ) ret = { 'result' : data [ 'result' ] } if ret [ 'result' ] : ret [ 'status' ] = data . get ( 'json_data' , { } ) . get ( 'data' , { } ) . get ( target , { } ) . get ( 'status' , ( ( ( not numeric ) and 'Unknown' ) or 2 ) ) else : ret [ 'error' ] = data [ 'error' ] return ret
check status of a particular service on a host on it in nagios .