Skip to main content

Hello,

I wish to extract from Mariadb all hosts with their hostgroup.

Is someone can help me ?

hello, you have multiple options, but none of them will get you the output you want.

what output do you want ?

a 2 column file with “host” and “hostgroup”, with as many occurrence as there is? (a hostgroup can contains multiple host, and a host can be in multiple hostgroup, that’s an any-any reliationship, 

 

all of that is possible if you know mysql and the table, from the “centreon” DB, you want the 3 tables 

host

hostgroup

hostgroup_relation

 

they are pretty self explanatory, you have host and hostgroup with their ID in their respective tables

you need to use the 2 fields from the “hostgroup_relation” table to link them : 

 

 

if you don’t want to use mysql, you can do queries on the centreon command line (clapi) and the api rest v1 

and finally the api rest v2 has a nice option to get you a an answer that will list you all the hostgroups and their nested hosts by calling that endpoint Centreon Web RestAPI and passing “show_host=true” as a parameter

 

all the methods need you do develop “something” and adapt it to your need


Reply