Skip to content

guillaumewatteeux/centreon-sdk-python

Repository files navigation

Centreon SDK Python

https://badge.fury.io/py/centreonapi.png https://travis-ci.com/guillaumewatteeux/centreon-sdk-python.svg?branch=master

Make a Python LIB for Centreon API

Forked from https://github.com/centreon/centreon-sdk-python

Usages

  • Connect to Centreon platform
from centreonapi.centreon import Webservice
centreon = centreon("https://centreon.mydomain.tld, "admin", "centreon")
  • List all hosts on Centreon platform
centreon.hosts.list()
>>>
{
  'Centeon-central': Centeon-central,
  'server1': myserver1
}
  • Add new host
centreon.hosts.add(
  name='server1',
  alias='DBServ',
  ip=127.0.0.1,
  template="DB-Host-Template",
  hg="DB Servers"
  )
  • Get host
_, myhost = centreon.hosts.get('server1')
myhost.name
>>>
server1
  • Macros

Get macros

_, macros = myhost.getmacro()
macros
>>>
{
  '$_HOSTMODULESTATSFILE$': $_HOSTMODULESTATSFILE$,
  '$_HOSTMYSQLPASSWORD$': $_HOSTMYSQLPASSWORD$,
  '$_HOSTMYSQLPORT$': $_HOSTMYSQLPORT$,
}

mymacro = macros.get('$_HOSTMYSQLPORT$')
mymacro.value
>>>
3306

Set Macros

myhost.setmacro('SECRETMACRO', 'pass', 1, 'secret macro pass')
  • HostTemplate on host
myhost.gettemplate()
>>>
{
  'App-Monitoring-Centreon-Central-custom': App-Monitoring-Centreon-Central-custom,
  'App-Monitoring-Centreon-Database-custom': App-Monitoring-Centreon-Database-custom,
  'App-Monitoring-Centreon-Poller-custom': App-Monitoring-Centreon-Poller-custom
}

Features

  • TODO

About

SDK Python for Centreon WebService

Resources

License

Stars

Watchers

Forks

Packages

No packages published