sla.update

Description

object sla.update(object/array slaids)

This method allows to update existing SLA entries.

This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) SLA properties to be updated.

The slaid property must be defined for each SLA, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.

Additionally to the standard SLA properties, the method accepts the following parameters.

ParameterTypeDescription
service_tagsarraySLA service tags to replace the current SLA service tags.

At least one service tag must be specified.
schedulearraySLA schedule to replace the current one.

Specifying parameter as empty will be interpreted as a 24x7 schedule.
excluded_downtimesarraySLA excluded downtimes to replace the current ones.

Return values

(object) Returns an object containing the IDs of the updated SLAs under the slaids property.

Examples

Updating service tags

Make SLA with ID “5” to be calculated at monthly intervals for NoSQL related services, without changing its schedule or excluded downtimes; set SLO to 95%.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "sla.update",
  4. "params": [
  5. {
  6. "slaid": "5",
  7. "name": "NoSQL Database engines",
  8. "slo": "95",
  9. "period": 2,
  10. "service_tags": [
  11. {
  12. "tag": "Database",
  13. "operator": "0",
  14. "value": "Redis"
  15. },
  16. {
  17. "tag": "Database",
  18. "operator": "0",
  19. "value": "MongoDB"
  20. }
  21. ]
  22. }
  23. ],
  24. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  25. "id": 1
  26. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "slaids": [
  5. "5"
  6. ]
  7. },
  8. "id": 1
  9. }

Changing the schedule of an SLA

Switch the SLA with ID “5” to a 24x7 schedule.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "service.update",
  4. "params": {
  5. "slaid": "5",
  6. "schedule": []
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "slaids": [
  5. "5"
  6. ]
  7. },
  8. "id": 1
  9. }

Changing the excluded downtimes for an SLA

Add a planned 4 hour long RAM upgrade downtime on the 6th of April, 2022, while keeping (needs to be defined anew) a previously existing software upgrade planned on the 4th of July for the SLA with ID “5”.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "service.update",
  4. "params": {
  5. "slaid": "5",
  6. "excluded_downtimes": [
  7. {
  8. "name": "Software version upgrade rollout",
  9. "period_from": "1648760400",
  10. "period_to": "1648764900"
  11. },
  12. {
  13. "name": "RAM upgrade",
  14. "period_from": "1649192400",
  15. "period_to": "1649206800"
  16. }
  17. ]
  18. },
  19. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  20. "id": 1
  21. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "slaids": [
  5. "5"
  6. ]
  7. },
  8. "id": 1
  9. }

Source

CSla::update() in ui/include/classes/api/services/CSla.php.