Hey,
we are working on a new config report format. There was a great discussion on the mapping of status/metric from Puppet and Ansible, I think this deserves its own thread. This page is a wiki and I will be updating it to fine-tune according to the proposals.
Summary
These fields are stored in reports table as integer column and represent the following:
-
changed
- number or changes (events) occured in the report -
unchanged
- number of resources/actions that are aligned with configuration and no action was taken -
failed
- number of failures in the report
To retrieve eventful reports, the query is: changed > 0 OR failed > 0
, the other field should not be taken into consideration. We can optionally set HasChange
keyword but probably not worth it since we can easily query the data right away from the summary columns. The other field is rather informative as multiple statuses are mapped to this field. There is a proposal perhaps to remove this column completely.
Unfortunately Ruby on Rails have changed
as a reserved word therefore the names in the DB and API must be:
change
nochange
failure
The plan is to map these to one or more statuses (or metrics) of various implementations. Here is the mapping proposal, of course the mapping is additive (when multiple states map to a single summary the sum is added).
Note: In the original proposal, there was a summary field āotherā but it does not proven to be useful as keywords can serve pretty well to recognize the special cases.
Puppet
Summary
I am marking root of the report as yaml
so it is clear where to find the data: smart_proxy_reports/puppet6-foreman-deb.yaml at develop Ā· theforeman/smart_proxy_reports Ā· GitHub
-
yaml.metrics.events.failure
ā failed -
yaml.metrics.events.success
ā changed -
yaml.metrics.resources.total - events.failure - events.success
ā unchanged
Pupet report also have yaml.metrics.resources
but these are only stored in the JSON body field and can be optionally rendered to UI/CLI when report is opened. Comment in the UX thread if you want to discuss where/when/how to present these metrics on a page. Note for performance reasons, this cannot be presented on reports index page as the app would need to open and parse all records field body which is a JSON (blob/text).
Keywords
-
yaml.status=changed
ā PuppetStatusChanged -
yaml.status=unchanged
ā PuppetStatusUnchanged -
yaml.status=failed
ā PuppetStatusFailed -
yaml.noop=true
ā PuppetNoop -
yaml.metrics.resources.corrective_change > 0
ā PuppetCorrectiveChange -
yaml.metrics.resources.skipped > 0
ā PuppetSkipped -
yaml.metrics.resources.restarted > 0
ā PuppetRestarted -
yaml.metrics.resources.failed_to_restart > 0
ā PuppetFailedToRestart -
yaml.metrics.resources.scheduled > 0
ā PuppetScheduled -
yaml.metrics.resources.out_of_sync > 0
ā PuppetOutOfSync
Keywords allow searching for particular reports by individual resources, but it is not practical to break down all resources into keywords this would create too many records. The proposal is:
-
yaml.resource_statuses.RESOURCE[yyz].failed = true
ā PuppetFailed:RESOURCE[xyz]
Let us know if you need to search for other resources states, but letās keep this as minimum as possible to keep reports fast.
Ansible
Summary
To differentiate the fields, json
prefix is the root of a report. Example report: Send report summary unchanged by lzap Ā· Pull Request #1325 Ā· theforeman/foreman-ansible-modules Ā· GitHub
Because the final summary is not very well defined by Ansible (nothing in the documentation, code is unclear, our testing did show various results) and because we want consistent mapping, letās ignore summary and aggregate data from the list of results:
json.results[].result.changed |
json.results[].failed |
Action |
---|---|---|
true | true | failed++ |
false | true | failed++ |
true | false | changed++ |
false | false | unchanged++ |
Previously there was a json.status
field but it did not report all possible Ansible states so new field named json.summary
will be sent: Send report summary unchanged by lzap Ā· Pull Request #1325 Ā· theforeman/foreman-ansible-modules Ā· GitHub
Keywords
Keywords, on the other hand, are mapped to summary fields. This allows searching capability.
-
json.summary.changed > 0
ā AnsibleChanged -
json.summary.failures > 0
ā AnsibleFailures -
json.summary.unreachable > 0
ā AnsibleUnreachable -
json.summary.rescued > 0
ā AnsibleRescued -
json.summary.ignored > 0
ā AnsibleIgnored -
json.summary.skipped > 0
ā AnsibleSkipped
Status
Overall easy to understand status calculated from summary fields:
- Changes - YELLOW: when changed > 0 and failed = 0
- Failures - RED: when failed > 0
- No changes - GREEN: unchanged > 0 and failed = 0
- Empty - GREY: when everything is 0
The colors do not necessary represent colors that needs to be used in the UI, these are proposals about how things are important with RED obviously mearning āattentionā, YELLOW meaning āsomething interesting happenedā and GREEN with āeverying in orderā.
CHANGELOG
- renamed applied to changed (not sure why I started with applied but both in Puppet and Ansible the statuses are both named āchangedā)
- renamed āpendingā to āunchangedā
- keeping other summary field for now but we might consider dropping it alltogether
- defined what is eventful report
- corrected ansible metrics: Send report summary unchanged by lzap Ā· Pull Request #1325 Ā· theforeman/foreman-ansible-modules Ā· GitHub
- updated overall status to be more simple (just four states)
- dropped other summary field
- puppet mapping is now based on events
- puppet kewords redefined
- ansible ignores rescued/ignored/skipped
- added ansible keyword mapping
- added AnsibleUnreachable
- added Ansible mapping from change/failure instead of summary fields
- added note about Rails name problem (changed)
- total events is only available in metrics.resources so changing to:
yaml.metrics.resources.total - events.failure - events.success
ā unchanged