check-mk-web-api ![Build Status](https://camo.githubusercontent.com/8b3cc44140e9748cc76d2fa068dc99957ff539b8aec823291d909fd030b5a935/68747470733a2f2f7472617669732d63692e6f72672f6272656e6e65726d2f636865636b2d6d6b2d7765622d6170692e7376673f6272616e63683d6d6173746572)
git clone https://github.com/brennerm/check-mk-web-api
cd check-mk-web-api
sudo python setup.py install
pip install check_mk_web_api
import check_mk_web_api
api = check_mk_web_api.WebApi('http://checkmk.company.com/check_mk/webapi.py', username='automation', secret='123456')
>>> api.add_host('webserver00.com')
>>> api.edit_host('webserver00.com', ipaddress='192.168.0.100')
>>> api.delete_host('webserver00.com')
>>> api.get_host('webserver00.com')
{
'hostname': 'webserver00.com',
'attributes': {
'ipaddress': '192.168.0.100'
},
'path': ''
}
>>> api.get_all_hosts()
{
'webserver00.com': {
'hostname': 'webserver00.com',
'attributes': {
'ipaddress': '192.168.0.100'
},
'path': ''
},
'webserver01.com': {
'hostname': 'webserver01.com',
'attributes': {
'ipaddress': '192.168.0.101'
},
'path': ''
}
}
>>> api.discover_services('webserver00.com')
{'removed': '0', 'new_count': '16', 'added': '16', 'kept': '0'}
>>> api.activate_changes()