1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Add options information and linkage for dashboard views

This commit is contained in:
Matthew Jones 2014-07-15 16:20:11 -04:00
parent 389c9861d8
commit 9f7763ee9f
4 changed files with 80 additions and 2 deletions

View File

@ -0,0 +1,40 @@
Make a GET request to this resource to retrieve aggregate statistics about inventory suitable for graphing.
Including fetching the number of total hosts tracked by Tower over an amount of time and the current success or
failed status of hosts which have run jobs within an Inventory.
## Parmeters and Filtering
The `period` of the data can be adjusted with:
?period=month
Where `month` can be replaced with `week`, or `day`. `month` is the default.
## Results
Data about the number of hosts will be returned in the following format:
"hosts": [
[
1402808400.0,
86743
], ...]
Each element contains an epoch timestamp represented in seconds and a numerical value indicating
the number of hosts that exist at a given moment
Data about failed and successfull hosts by inventory will be given as:
{
"sources": [
{
"successful": 21,
"source": "ec2",
"name": "aws (Test Inventory)",
"failed": 0
}
],
"id": 2,
"name": "Test Inventory"
},

View File

@ -0,0 +1,35 @@
Make a GET request to this resource to retrieve aggregate statistics about job runs suitable for graphing.
## Parmeters and Filtering
The `period` of the data can be adjusted with:
?period=month
Where `month` can be replaced with `week`, or `day`. `month` is the default.
The type of job can be filtered with:
?job_type=all
Where `all` can be replaced with `inv_sync`, `playbook_run` or `scm_update`. `all` is the default.
## Results
Data will be returned in the following format:
"jobs": {
"successful": [
[
1402808400.0,
9
], ... ],
"failed": [
[
1402808400.0,
3
], ... ]
}
Each element contains an epoch timestamp represented in seconds and a numerical value indicating
the number of events during that time period

View File

@ -0,0 +1 @@
Make a GET request to this resource to retrieve aggregate statistics for Tower

View File

@ -152,6 +152,8 @@ class DashboardView(APIView):
def get(self, request, format=None):
''' Show Dashboard Details '''
data = SortedDict()
data['related'] = {'jobs_graph': reverse('api:dashboard_jobs_graph_view'),
'inventory_graph': reverse('api:dashboard_inventory_graph_view')}
user_inventory = get_user_queryset(request.user, Inventory)
inventory_with_failed_hosts = user_inventory.filter(hosts_with_active_failures__gt=0)
user_inventory_external = user_inventory.filter(has_inventory_sources=True)
@ -251,7 +253,7 @@ class DashboardView(APIView):
class DashboardJobsGraphView(APIView):
view_name = "Dashboard Jobs Graphs"
new_in_20 = True
new_in_200 = True
def get(self, request, format=None):
period = request.QUERY_PARAMS.get('period', 'month')
@ -300,7 +302,7 @@ class DashboardJobsGraphView(APIView):
class DashboardInventoryGraphView(APIView):
view_name = "Dashboard Inventory Graphs"
new_in_20 = True
new_in_200 = True
def get(self, request, format=None):
period = request.QUERY_PARAMS.get('period', 'month')