Question

Putting together a host template from scanned services

  • 26 February 2024
  • 7 replies
  • 52 views

Badge +2

I’m just getting familiar with Centreon.

I started by adding a couple of server-type hosts from our infrastructure, and put together some monitoring for them using the service scan function. That works great and gives me a very convenient resource overview. (All SNMP-based for now.)

Now, I’d like to do a similar thing with the client machines on the network - to be able to see disk space getting low, VMs burning CPU/memory while idling, stuff like that.

I’ve added one such client host as a starting point, and again used the scan function to add the 10 or so services I’m interested in.

Now, my question is, how do I create templates from those 10 scanned services, so I can put them together into a host template and ideally auto-discover my range of 35+ client machines and have the same service monitors applied?

I.e., is there a “template from existing service” function that copies over all the service’s configuration values?


7 replies

Userlevel 5
Badge +14

Hello

there is no function to do “template from service”, however you can “duplicate” an existing host and just change the name & ip

this will copy all the services and their settings as they were in the original host

 

using hosts and service templates may be possible, but you would need to make your own custom, inheriting from the base, and it would need 1 custom template for each occurence, (let’s say you have 2 nics, or 3 disks, you would need one template for each).

this is doable, but need a bit more work, but will allow you to simplify deployment of new hosts if you do it programatically.

if you do it manually, then duplicating is simpler 

 

Best regards

Christophe

Badge +2

Thank you, I see.

Which brings me to my next question - when, sometime in the future, I want to add or change a service that applies to all those hosts, how would I do that (efficiently)?

Userlevel 5
Badge +14

you can do “massive changes” like changing threshold or other options in multiple services or hosts, but you can’t massively add services to multiple hosts, unless you use host template linked to service template, and “reapply” the host template

 

And well, that’s the whole point of the host templates :

it will get more efficient for the future, but it does take a bit of time to set up correctly (it is not that long to be fair compared to maintaining things manually)

 

it depends on how many host you plan to have.

is it worth spending 1 or 2 hours to make a few templates and then just having to push a button to update 5 or 100 hosts in the future, or doing 5 or 100 individual operations each time you want to change something globally. That’s up to you.

 

 

if you are on the fence, you could also check the command line api (clapi) or the https api, if you are more at ease with coding/batching things, it may prove more efficient (looking how a host and its service are built then reusing that to make your new hosts, it may be more complicated to do at first)

Badge +2

Thank you for the answer and ideas!

Ah, using the clapi (at least, or possibly one of the other ones) it seems I can query existing services, and also create service templates - which would allow me to “implement” that “create template from existing auto-discovered service” thing. Possibly half-manually, which I wouldn’t mind, but to me it sure beats manually copying over all the information from a service into all the right fields of a service template creation form in the web UI.

I’ll have a look into this and leave another comment how it’s panning out.

Badge +2

… using clapi together with the Web UI to set up the templates wasn’t/isn’t half bad; after figuring out how services/service templates/their inheritance/their ‘custom macros’/… interact, that was fairly quick work.

Now I’m waiting for SNMP host discovery on the network - nothing much seems to happen so far.

At that point I find myself wishing for an MS Active Directory OU structure based host discovery provider - but, again, I guess hosts could be created via clapi from e.g. a list of hosts exported from AD.

Userlevel 5
Badge +14

look at this post if you want to use bash scripts and clapi

rename host | Community (centreon.com) 

 

I know I use a few scripts like this with some highly customized template for some exotic hardware where no autodiscover can help me, and yes, once you understand how to set macros and option with clapi it is pretty useful

 

Userlevel 5
Badge +11

Hi @jmbreuer, did you succeed in solving your problem? Then please don't forget to click on Best Answer! This will help other people with the same problem to find an easy solution. That's why we are a community! Thank you, thank you

Reply