Welcome to ZBX’s documentation!¶
Contents:
ZBX¶



This library let you to describe Zabbix configuration in pure Python. This configuration can then be dumped in xml and imported into zabbix.
- Free software: BSD license
- Documentation: http://zbx.rtfd.org.
Features¶
zbx.api¶
from zb.api import *
configure(user=YOUR_USER, password=YOUR_PASSWORD, url=YOUR_URL)
reponse = request('history.get', {
'output': 'extend',
'history': 0,
'itemids': '23296',
'sortfield': 'clock',
'sortorder': 'DESC',
'limit': 10
})
zbx.config¶
from zb.api import *
from zb.config.items.aggregate import AvgItem
configuration = Config()
template = configuration.templates.new('My template')
classic_item = template.items.new('my item', key='my.item', applications=['my application'])
average_item = template.items.add(AvgItem('my item',
groups=['first group', 'second group'],
key='my.item',
applications=['my application']))
Installation¶
At the command line:
$ easy_install zbx
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv zbx
$ pip install zbx
Accessing the API¶
zbx.api¶
Access to zabbix api as described here: https://www.zabbix.com/documentation/2.2/manual/api
- zbx.api.authenticate = <bound method Api.authenticate of <zbx.api.Api object at 0x2152c10>>¶
authenticate with the global api instance
- zbx.api.request = <bound method Api.request of <zbx.api.Api object at 0x2152c10>>¶
request with the global api instance
Generate the configuration¶
zbx.config¶
- class zbx.config.Application(name, **fields)¶
Application model
- class zbx.config.DiscoveryRule(name, **fields)¶
DiscoveryRule model
- class zbx.config.Graph(name, **fields)¶
Graph model
- class zbx.config.GraphItem(item=None, **fields)¶
GraphItem model
- class zbx.config.Group(name, **fields)¶
Group model
- class zbx.config.Host(name, **fields)¶
Host model
- class zbx.config.Interface(ident, **fields)¶
Interface model
- class zbx.config.Item(name, **fields)¶
Item model
- class zbx.config.Screen(name, **fields)¶
Screen model
- class zbx.config.ScreenItem(graph=None, **fields)¶
ScreenItem model
- class zbx.config.Template(name, **fields)¶
Template model
- class zbx.config.ValueMap¶
ValueMap model
zbx.config.item.aggregate¶
see https://www.zabbix.com/documentation/2.0/manual/config/items/itemtypes/aggregate # NOQA
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/johnnoone/zbx/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement it.
Write Documentation¶
ZBX could always use more documentation, whether as part of the official ZBX docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/johnnoone/zbx/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up zbx for local development.
Fork the zbx repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/zbx.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv zbx $ cd zbx/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ flake8 zbx tests $ python setup.py test $ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.6, 2.7, and 3.3, and for PyPy. Check https://travis-ci.org/johnnoone/zbx/pull_requests and make sure that the tests pass for all supported Python versions.
Credits¶
Development Lead¶
- Xavier Barbosa <clint.northwood@gmail.com>
Contributors¶
None yet. Why not be the first?