centreon-plugins
centreon-plugins copied to clipboard
(plugin) apps::backup::rubrik::restapi - enhance compliance mode, use public api instead internal one
Use of api/v1/report/compliance_summary_sla instead of api/internal/report/{id}/chart
Rubrik APIv1 doc: " api/v1/report/complaince_summary_sla Returns the compliance summary information for all protected objects based on whether the last expected snapshot was successful. This requirement is based on the SLA Domain assigned to the objects. With snapshot-range : An SLA Domain-based range of snapshots. Compliance is calculated for snapshots in the range. "
api/v1/report/compliance_summary_sla can give us 4 ranges of snapshots: Last snapshot Last 2 snapshots Last 3 snapshots All snapshots
Add percent value
The endpoint /api/v1/report/compliance_summary_sla
is available since version 5.2. It's a problem for older version.
Moreover, we should use the endpoint /api/v1/report/compliance_summary
(It's the same metric no ? We don't break it):
Returns the compliance summary information for all protected objects based on a time-based requirement of at least one snapshot in each 24 hour report period. This view ignores the policies assigned to protected objects through SLA Domains.
What do you think about it ? I don't know if we can get the CDM version to choose between internal and api v1.
I didn't check for older api version -_-.
It's not the same metrics: Here's the result for my Rubrik cluster: For compliance_summary
https://XXX/api/v1/report/compliance_summary
{
"totalProtected": 956,
"numberOfInComplianceSnapshots": 435,
"numberOfOutOfComplianceSnapshots": 514,
"numberOfAwaitingFirstFullSnapshot": 7,
"percentOfInComplianceSnapshots": 45.8,
"percentOfOutOfComplianceSnapshots": 54.2,
"updatedTime": "2022-07-22T08:38:47.273Z"
}
For compliance_summary_sla
https://XXX/api/v1/report/compliance_summary_sla?snapshot_range=AllSnapshots
{
"totalProtected": 956,
"numberOfInComplianceSnapshots": 951,
"numberOfOutOfComplianceSnapshots": 5,
"percentOfInComplianceSnapshots": 99.4,
"percentOfOutOfComplianceSnapshots": 0.6,
"updatedTime": "2022-07-22T08:38:47.273Z",
"updatedStatus": "Updated",
"snapshotRange": "AllSnapshots"
}
It's very different.
The metric given by api/internal/report/{id}/chart are similar to /api/v1/report/compliance_summary_sla?snapshot_range=AllSnapshots
We can get CDM version through https://XXX/api/v1/cluster/me
Could you provide me (by email) an access to the API to test it and develop it ?
it should be quite the same. its weird.
I will close the PR because the plugin uses the internal api. I could create a mapping for api v1 but i'll need an access to do that. If you (or someone else) can provide me that, i will do the development