Assigning a Maintenance Policy
Use this API to associate/dissociate a maintenance Policy to a Component/Host/Test/Test For Host/Test For Component/Test For component type.
URL: http://<eG manager IP:port>/api/eg/orchestration/assignmaintenancepolicy
Method: POST
Content-Type: application/json
| Parameters | Key Values | Example |
|---|---|---|
|
Headers |
managerurl: Base URL of the eG Manager i.e., http://<IP address of the eG console:Port> user: eG username or domain/eG username pwd: Base64 encoded password |
{ "policyname":"QMP1", "associatefor":"Component", "componentsby": "Component Type", "componenttype":"Microsoft Windows", "associateelements":"windows191 "time frequency": "Daily" } Example for adding a maintenance policy to a descriptor of a component: { "policyname":"QMP2", "associatefor":"Descriptor For Component", "componenttype":"Microsoft Windows", "component":"windows191"; "test":"Disk Space", "associateelements":"C", "time frequency": "Day of the Week=First Saturday@10:00-12:00,Day of the Week=Every Sunday@10:00-12:00" } |
|
Body |
Default: { "policyname":"Policy name" "associatefor":"Host/Component/Test/ "componentsby":"Zone/Segment "zone":"Zone name" "segment":"Segment name" "service":"Service name" "componenttype":"Component type:port" "test":"Test name" "associateelements":"comma-separated list of elements" "disassociateelements":"comma- "timefrequency":"Daily=Time Range"/"First day of month=Time Range"/"Last day of month=TimeRange"/"Day of the Week=First/Last/Every <Day>@Time Range"/"Date of the month=<Days>@Time Range"/startDate(MM/DD/YYYY)-endDate(MM/DD/YYYY)=TimeRange" } |
Note:
The Time Range should be specified between 00:00 to 23:59 Hrs
| Type | Code | Content |
|---|---|---|
|
JSON |
200 |
{ "Succeed": "Maintenance policy has been associated/dissociated successfully." } |
| Type | Code | Content |
|---|---|---|
|
JSON |
401 UNAUTHORIZED |
{ "Error": "Element(s) you are trying to add does/do not exist." } |
Figure 1 : Assigning a Maintenance Policy using Postman REST Client
Assigning a Maintenance Policy using cURL
To assign a maintenance policy through the REST API using cURL, the command should be specified in the following format:
curl --location --request POST "http://<eG Manager IP:Port>/api/eg/orchestration/assignmaintenancepolicy" -H "managerurl:http://<eG Manager IP:Port>" -H "user:<eG username or domain/eG username>" -H "pwd:Base64 encoded password" -H "Content-Type: application/json" --data-raw "{'policyname':'Policy name', 'associatefor':'Host/Component/Test/Test For Host/Test For Component/Test For component type/Test For component type/Descriptor/Descriptor For Component
/Zone
separated list of elements','timefrequency':'Daily=Time Range/First day of month=Time Range/Last day of month=TimeRange/Day of the Week=First/Last/Every <Day>@Time Range/Date of the month=<Days>@Time Range/startDate(MM/DD/YYYY)-endDate(MM/DD/YYYY)=Time Range'}"
Figure 2 shows an example of assigning a maintenance policy using cURL.