#NEWLINE# def summary( svc_name = '' ) : #NEWLINE# #INDENT# "\n    Display a summary from monit\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' monit.summary\n        salt '*' monit.summary <service name>\n    " #NEWLINE# ret = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# cmd = 'monit summary' #NEWLINE# res = __salt__ [ 'cmd.run' ] ( cmd ) . splitlines ( ) #NEWLINE# for line in res : #NEWLINE# #INDENT# if ( 'daemon is not running' in line ) : #NEWLINE# #INDENT# return dict ( monit = 'daemon is not running' , result = False ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( not line ) or ( svc_name not in line ) or ( 'The Monit daemon' in line ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# parts = line . split ( "'" ) #NEWLINE# if ( len ( parts ) == 3 ) : #NEWLINE# #INDENT# ( resource , name , status_ ) = ( parts [ 0 ] . strip ( ) , parts [ 1 ] , parts [ 2 ] . strip ( ) ) #NEWLINE# if ( ( svc_name != '' ) and ( svc_name != name ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( resource not in ret ) : #NEWLINE# #INDENT# ret [ resource ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# ret [ resource ] [ name ] = status_ #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return res