Reports
ucmdb_rest.report.Reports(server)
Initialize the service with a reference to the main level UCMDB server
Source code in ucmdb_rest\report.py
changeReportsAll(toTime, fromTime, view, type='ALL', attributes=['description', 'name'])
Retrieves change reports for all elements within a specified time range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
toTime
|
int
|
The end time of the report (Epoch time in milliseconds). |
required |
fromTime
|
int
|
The start time of the report (Epoch time in milliseconds). |
required |
view
|
str
|
The name of the UCMDB View to scope the report. |
required |
type
|
str
|
Do we want to exclude, include attributes or show all of them. Default is ALL |
'ALL'
|
attributes
|
list of str
|
A list of CI attributes to monitor for changes. Default is ['description', 'name']. |
['description', 'name']
|
Returns:
| Type | Description |
|---|---|
Response
|
A Response object. If the API returns a 400 (Bad Request), this method returns a mocked 200 response with an empty JSON body to ensure automation scripts can continue gracefully. |
Example Response Body:
{ "ciChanges": { "44c93b...": { "changes": { "name": [{"oldValue": "srv01", "newValue": "srv01-prod"}] } } } }
Source code in ucmdb_rest\report.py
changeReportsBlacklist(toTime, fromTime, view, attributes=['description'])
Retrieves a blacklist report for CIs in a view.
This function makes a POST request to the UCMDB server to retrieve the information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
toTime
|
int
|
Time the report should end. Format is epoch time in milliseconds. |
required |
fromTime
|
int
|
Time the report should start. Format is epoch time in milliseconds. |
required |
view
|
str
|
Name of the view to retrieve the report from. |
required |
attributes
|
list
|
A list of attributes to display on the report |
['description']
|
Returns:
| Type | Description |
|---|---|
Response
|
A dictionary object containing the details of which attribute changed, the date it was changed, and the old and new values. Example: { "changes": { "4278e81d3dd6640a835e419d2865905d": { "ciId": "4278e81d3dd6640a835e419d2865905d", "displayLabel": "create222", "className": "node", "properties": [ { "name": "Display Label", "value": "USER LABEL" }, { "name": "Create Time", "value": "Fri Jan 20 14:13:40 EET 2017" }, { "name": "Description", "value": "description" } ], "changes": { "name": [ { "attribute": "name", "oldValue": "create2", "newValue": "create22", "changer": "User:{UISysadmin###UCMDB}, LoggedInUser:{admin###UCMDB}", "changeDate": 1484741091500 } ] } } } } |
Source code in ucmdb_rest\report.py
changeReportsWhitelist(toTime, fromTime, view, attributes=['name', 'description'])
Retrieves a whitelist report for CIs in a view.
This function makes a POST request to the UCMDB server to retrieve the information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
toTime
|
int
|
Time the report should end, in the format: 1454364000000. |
required |
fromTime
|
int
|
Time the report should start, in the format: 1485986400000. |
required |
view
|
str
|
Name of the view to retrieve the report from. |
required |
attributes
|
list
|
A list of attributes to display on the report |
['name', 'description']
|
Returns:
| Type | Description |
|---|---|
Response
|
A dictionary object containing the details of which attribute changed, the date it was changed, and the old and new values. Example: { "changes": { "4278e81d3dd6640a835e419d2865905d": { "ciId": "4278e81d3dd6640a835e419d2865905d", "displayLabel": "create222", "className": "node", "properties": [ { "name": "Display Label", "value": "USER LABEL" }, { "name": "Create Time", "value": "Fri Jan 20 14:13:40 EET 2017" }, { "name": "Description", "value": "description" } ], "changes": { "name": [ { "attribute": "name", "oldValue": "create2", "newValue": "create22", "changer": "User:{UISysadmin###UCMDB}, LoggedInUser:{admin###UCMDB}", "changeDate": 1484741091500 } ] } } } } |
Source code in ucmdb_rest\report.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |