Skip to content

Commit 153fc30

Browse files
committed
add docs for elasticsearch query via grafana in CI
1 parent 68819fe commit 153fc30

File tree

2 files changed

+17
-26
lines changed

2 files changed

+17
-26
lines changed

ansible/ci/check_grafana.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
timeout: 315 # slurm stats cron job runs every 5 mins
1212

1313
- name: Query grafana for expected hpctests jobs
14-
grafana_datasource_proxy:
14+
grafana_elasticsearch_query:
1515
grafana_url: http://{{ grafana_api_address }}:{{ grafana_port }}
1616
grafana_username: grafana
1717
grafana_password: "{{ vault_grafana_admin_password }}"

ansible/ci/library/grafana_datasource_proxy.py renamed to ansible/ci/library/grafana_elasticsearch_query.py

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,41 @@
44
from __future__ import (absolute_import, division, print_function)
55
__metaclass__ = type
66

7-
import requests
8-
import json
9-
107
DOCUMENTATION = r'''
118
---
12-
module: user_namepace_facts
9+
module: grafana_elasticsearch_query
1310
14-
short_description: Returns subgid and subuid maps
11+
short_description: Get elasticsearch hits via grafana
1512
1613
version_added: "1.0.0"
1714
18-
description: Returns subgid and subuid maps.
15+
description: Returns hits from selected datasource and indices.
1916
2017
author:
21-
- Will Szumski (@jovial)
18+
- Steve Brasier
2219
'''
2320

2421
EXAMPLES = r'''
25-
- name: Return ansible_facts
26-
user_namepace_facts:
22+
- name: Get elasticsearch hits
23+
grafana_elasticsearch_query:
24+
grafana_url: http://{{ grafana_api_address }}:{{ grafana_port }}
25+
grafana_username: grafana
26+
grafana_password: "{{ vault_grafana_admin_password }}"
27+
datasource: slurmstats
28+
index_pattern: 'filebeat-*'
2729
'''
2830

2931
RETURN = r'''
3032
# These are examples of possible return values, and in general should use other names for return values.
31-
ansible_facts:
32-
description: Facts to add to ansible_facts.
33+
docs:
34+
description: List of dicts with the original json in each document.
3335
returned: always
34-
type: dict
35-
contains:
36-
subuid:
37-
description: Parsed output of /etc/subuid
38-
type: str
39-
returned: always, empty dict if /etc/subuid doesn't exist
40-
sample: { "foo": {"size": 123, "start": 100000 }}
41-
subgid:
42-
description: Parsed output of /etc/subgid
43-
type: str
44-
returned: always, empty dict if /etc/subgid doesn't exist
45-
sample: { "foo": {"size": 123, "start": 100000 }}
36+
type: list
4637
'''
4738

4839
from ansible.module_utils.basic import AnsibleModule
49-
import csv
50-
import os
40+
import requests
41+
import json
5142

5243
def run_module():
5344
module_args = dict(

0 commit comments

Comments
 (0)