tincho83
(Martin Martos)
1
Hi,
I’m trying to get a report using ansible to execute lq queries and get a report of services monitored in check_mk.
Ansible task:
-
name: ‘Generar Reporte’
become: yes
become_user: ‘{{site_name}}’
shell: “lq ‘GET services\nColumns: host_name description state’”
args:
executable: /bin/bash
register: reporte
Result:
Does anyone has a code sniped I could use to query lq over ansible and want to share it??
Thanks in advance.
not ansible-like, but a snippet that might help:
printf "GET services\nColumns: host_name description state\n" | sudo -u $site_name /omd/sites/${site_name}/bin/unixcat /omd/sites/${site_name}/tmp/run/live
for more see https://checkmk.de/cms_livestatus.html
Olli
tincho83
(Martin Martos)
3
It worked!! Thanks a lot for your help!!
Here is my code:
Task in playbook:
-
name: ‘Generar Reporte’
become: yes
become_user: ‘{{site_name}}’
shell:
cmd: |
printf “GET services\nColumns: host_name description state\n” | sudo -u {{site_name}} /omd/sites/{{site_name}}/bin/unixcat /omd/sites/{{site_name}}/tmp/run/live
args:
executable: /bin/bash
register: reporte
-
debug:
var: reporte.stdout_lines
Inventory with site var:
[check_mk_prod]
your_hostname site_name=your_site_name
tincho83
(Martin Martos)
4
1 Like
system
(system)
Closed
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.