def retcode_pillar(pillar_name):
 groups = __salt__['pillar.get'](pillar_name)
 check = {}
 data = {}
 for group in groups:
  commands = groups[group]
  for command in commands:
   if isinstance(command, dict):
    plugin = next(six.iterkeys(command))
    args = command[plugin]
   else:
    plugin = command
    args = ''
   check.update(retcode(plugin, args, group))
   current_value = 0
   new_value = int(check[group]['status'])
   if (group in data):
    current_value = int(data[group]['status'])
   if ((new_value > current_value) or (group not in data)):
    if (group not in data):
     data[group] = {}
    data[group]['status'] = new_value
 return data

def retcode_pillar ( pillar_name ) : groups = __salt__ [ 'pillar.get' ] ( pillar_name ) check = { } data = { } for group in groups : commands = groups [ group ] for command in commands : if isinstance ( command , dict ) : plugin = next ( six . iterkeys ( command ) ) args = command [ plugin ] else : plugin = command args = '' check . update ( retcode ( plugin , args , group ) ) current_value = 0 new_value = int ( check [ group ] [ 'status' ] ) if ( group in data ) : current_value = int ( data [ group ] [ 'status' ] ) if ( ( new_value > current_value ) or ( group not in data ) ) : if ( group not in data ) : data [ group ] = { } data [ group ] [ 'status' ] = new_value return data
run one or more nagios plugins from pillar data and get the result of cmd .