Project

General

Profile

Json-report-format » History » Version 10

Martin Milata, 02/05/2014 06:55 PM
json colon/bracket

1 1 Romain Vrignaud
h1. Json-report-format
2
3 4 Marek Hulán
h2. how to send reports 
4 2 Romain Vrignaud
5
* Foreman reports need to be sent to /api/reports
6
* Followind headers needs to be present : 
7 1 Romain Vrignaud
<pre>
8 2 Romain Vrignaud
  "Accept: application/json,version=2"
9
  "Content-Type: application/json"
10
</pre>
11
12 4 Marek Hulán
h2. report JSON format
13 2 Romain Vrignaud
14 7 Marek Hulán
<pre><code class="ruby">
15 8 Marek Hulán
{  "report" : {
16
       "host"          : "fqdn.example.com",
17
       "reported_at"   : "2013-10-18 06:58:09 UTC",                       # Time.now.utc.to_s ruby style
18
       "status"        : { "applied"           : n,                       # Number of resource that changed with n integer
19
                            "restarted"        : n,                       # Number of services restarted with n integer
20
                            "failed"           : n,                       # Number of failed resource with n integer
21
                            "failed_restarts"  : n,                       # Number of failed service restart with n integer
22
                            "skipped"          : n,                       # Number of skipped resource with n integer
23
                            "pending"          : n                        # with n integer
24
                          },
25 10 Martin Milata
       "metrics"       : { "resources" : { "total" : n },                 # Total number of resources
26 9 Marek Hulán
                            "time"     : { "resource_type1" : n,          # Time spent on that type of resource
27
                                           "resource_type2" : n,          # Time spent on that type of resource
28
                                           "total"          : n  }        # Total time spent for the run
29 8 Marek Hulán
                          },
30
       "logs"          : [ 
31 9 Marek Hulán
                            { "log" : { "sources"  : { "source"  : "resource name" },    # Name of resource which output the message
32
                                        "messages" : { "message" : "resource message" }, # Message of resource
33 1 Romain Vrignaud
                                        "level"    : "notice"                            # In ['notice','warning','error'] TODO: recheck this
34 10 Martin Milata
                                      }
35 8 Marek Hulán
                            }
36
                          ]
37
   }
38 1 Romain Vrignaud
}
39 7 Marek Hulán
</code></pre>
40 4 Marek Hulán
41
h2. Meaning of states
42
43
h3. Puppet
44
45 5 Marek Hulán
|applied           | How many resources were attempted to be fixed |
46
|restarted         | How many resources were restarted because their dependencies changed|
47
|failed            | How many resources were not successfully fixed|
48
|failed_restarts   | How many resources could not be restarted|
49
|skipped           | How many resources were skipped, because of either tagging or scheduling restrictions|
50
|pending           | Is for noop mode, e.g it would have made a change if it would actually run|
51 4 Marek Hulán
52
h3. Chef
53
54 5 Marek Hulán
|applied           | How many resources were executed|
55
|restarted         | How many resources were executed and their action was restart|
56
|failed            | How many resources were not successfully fixed|
57
|failed_restarts   | How many resources were not successfully fixed and their action was restart|
58 6 Marek Hulán
|skipped           | How many resources were skipped (e.g. condition evaluated as false, action remained nothing)|
59 5 Marek Hulán
|pending           | not used (why runs not supported)|