Project

General

Profile

Json-report-format » History » Revision 8

Revision 7 (Marek Hulán, 01/26/2014 11:22 AM) → Revision 8/11 (Marek Hulán, 01/26/2014 11:27 AM)

h1. Json-report-format 

 h2. how to send reports  

 * Foreman reports need to be sent to /api/reports 
 * Followind headers needs to be present :  
 <pre> 
   "Accept: application/json,version=2" 
   "Content-Type: application/json" 
 </pre> 

 h2. report JSON format 

 <pre><code class="ruby"> 
 {    
   "report" : { 
        
         "host"            : "fqdn.example.com", 
        
         "reported_at"     : "2013-10-18 06:58:09 UTC",                         # Time.now.utc.to_s ruby style 
        
         "status"          : { "applied"             : n,                         # Number of resource that changed with n integer 
                             
                              "restarted"          : n,                         # Number of services restarted with n integer 
                             
                              "failed"             : n,                         # Number of failed resource with n integer 
                             
                              "failed_restarts"    : n,                         # Number of failed service restart with n integer 
                             
                              "skipped"            : n,                         # Number of skipped resource with n integer 
                             
                              "pending"            : n                          # with n integer 
                           
                            }, 
        
         "metrics"         : { "resources"        : { 'total' : n }               # Total number of resources 
                             
                              "time"                        : { "resource_type1"    : n,           # Time spent on that type of resource 
                                                 
                                                    "resource_type2" : n,           # Time spent on that type of resource 
                                                 
                                                    "total"            : n }    }     # Total time spent for the run 
                           
                            }, 
        
         "logs"            : [  
                              
                              { "log" => { "sources"    : { "source"        : "resource name" },          # Name of resource which output the message 
                                          
                                           "messages" : { "message" : "resource message" }, # Message of resource 
                                          
                                           "level"      : "notice"                              # In ['notice','warning','error'] TODO: recheck this 
                             
                              } 
                           
                            ] 
    
       } 
 } 
 </code></pre> 

 h2. Meaning of states 

 h3. Puppet 

 |applied             | How many resources were attempted to be fixed | 
 |restarted           | How many resources were restarted because their dependencies changed| 
 |failed              | How many resources were not successfully fixed| 
 |failed_restarts     | How many resources could not be restarted| 
 |skipped             | How many resources were skipped, because of either tagging or scheduling restrictions| 
 |pending             | Is for noop mode, e.g it would have made a change if it would actually run| 

 h3. Chef 

 |applied             | How many resources were executed| 
 |restarted           | How many resources were executed and their action was restart| 
 |failed              | How many resources were not successfully fixed| 
 |failed_restarts     | How many resources were not successfully fixed and their action was restart| 
 |skipped             | How many resources were skipped (e.g. condition evaluated as false, action remained nothing)| 
 |pending             | not used (why runs not supported)|