Synchronizing Netbox with Centreon

  • 20 April 2023
  • 5 replies
  • 358 views

Badge +2

Hello Team,

 

We use Netbox mainly as an inventory application to store all our equipment details.

I would like to know if there is a way to synchronize the newly added equipment automatically to Centreon using API.

 

My scenario;

I add a device on Netbox with the name, IP, host category, etc.

Use Netbox API to Sweep the device list and grep the latest device added on Netbox.

Using the result above, we push the data to Centreon which then the later will add the device as HOST and then autodiscovery feature will add all the SERVICES automatically.

 

Is that possible please?

If yes, do you have such plugin available in Plugin Pack?

 

Thanks.

Regards,

M.B

 


5 replies

Userlevel 5
Badge +14

hello

“is that possible”: short anwser, yes but…

long answer

Adding host with api will be the job of your program/batch/script that will “sweep” the netbox api 

you then need to use centreon api to “add host” with a name, ip AND a host template (you must determine which one you may want to use, that’s the most tricky part)

once the host template is assigned to the host, the autodiscover will be available

 

longer answer

the “plugin pack” are packages for monitoring *stuff*, they include host templates and they may include autodiscovery but only for services, as you want to use

 

when adding a host, the name and ip are mandatory, the host template will be necessary to use the autodiscovery of the correct plugin pack (i.e. you add cisco switch or hpe proliant, or a firewall, it’s not the same pluginpack, and each has a different host template)

you can also add more information when you create the host, like host group, multiple host template, configuration about notification etc… (I usually use a host template just to set up the all the notifucation, period, contact group etc… but that depends on how complex your setup is and your need)

 

the tricky part is to decide how to affect the correct template out of your source api, maybe using a tag, the name, the category, something saying “this is a cisco switch, this is a firewall paloalto, …

centreon will not detect the hardware for you and assign a template (there is a “host discovery” function, but only for specific workload like VMs and accespoint, not what you want here)

 

A host template comes with a set of “standard services” you don’t need to discover for common check (cpu, ram, hardware status)

some services may use autodiscovery, mainly network interface, (there are other, disks, vpn, san volume, etc… it depends on the need of the community)

and some templates have ‘global checks’  (disk-global, nic-global) that I don’t like, to many information in a single check, but easier to setup as it doesn’t need autodisover (may be useful for os / VM that pops up regularly, but you don’t want a golbal check on a 48 ports switch)

 

you need to understand your host templates (from the plugin packs), customize your own “-custom” to suit your needs (add remove service template)

and you need to test your autodiscovery, not all plugin pack have it : go to configuration/service/Rules and check what autodiscover plugin are listed, mostly network stuff (switch, fw, etc…)

 

but whatever you do, you will need to use the centreon API to create the host, there will be no auto-magic before this step, and that’s what api are here for : interconnect you own custom need between 2 independant sofware solution

 

 

Badge +2

Hello Christophe,

 

Thanks a lot for the explanation.

It will be tough to create such a script and correlate the data received with host template, etc. 😥

 

I thought Centreon guys already have the Netbox integration 😅

It would be nice if they could work on it 🤣

Userlevel 5
Badge +14

I have to say I never heard of Netbox before your post :)  (looks interesting)

I looked at the demo, you have devices, which have a role and a manufacturer, with this 2 information you could try and match a host template

the list is not that big, you get the big manufacturer names and a few types, there is not much more you would need to match “cisco” “Access Switch” to the centreon template “Net-Cisco-Standard-SNMP-custom”

but yeah someone has to do the matching and maintain it

 

Badge +2

 

Netbox is very good for inventory purposes.

Thanks for your help Christophe.😉

Userlevel 5
Badge +11

Hi @m.beeharry, did you find the solution to your problem?

 

If you did, please give us a hand and mark the answer that saved your life as "Best Answer." This way, you'll help other watchers who might have the same issue, and they won't have to scream and pull their hair out trying to find a solution.

 

Big ups to @christophe.niel-ACT for being a superhero in our community! 😊

Reply