-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nft_counters plugin #1316
base: master
Are you sure you want to change the base?
Add nft_counters plugin #1316
Conversation
Plugin monitors nftables counters and can be configured to show a subset of counters. Limiting output by type of counter (bytes or packets) is also possible. Plugin requires python3-nftables, which makes use of libnftables and is part of Netfilter's nftables, but may need to be installed separately. Plugin will bail out if the nftables module cannot be loaded. Plugin is built upon PyMunin, adapted for Python3. The version listed in PIP is still using Python 2 syntax. Release of a Python 3 compatible version is pending.
* Ensure plugin exits with non-zero status * Fix formatting of informative output
This separates graph creation and value retrieval. In case values need to be computed or retrieved externally, value retrieval will only happen when needed (e.g. calling the plugin without any arguments), saving time, I/O and cpu cycles.
It's quite bogus, since any exceptions will be thrown during initialization.
Only there are we able to determine if counters are present. nft_cmd() only checks if there is any output at all.
Ensure graph is not showing negative values when counters are reset.
Re-raising exceptions will allow PyMunin to decide how to handle them depending on debug setting. When in 'autoconf' simply return from __init__ to allow correct answer to be printed.
There is now a Python 3 compatible test release of PyMunin on TestPyPI, if someone wants to give this plugin a testdrive. Install with: pip install --user --index-url https://test.pypi.org/simple/ PyMunin Or, if you want to make it available system wide: pip install --prefix /usr/local --index-url https://test.pypi.org/simple/ PyMunin I'm still hoping for an official release in the coming weeks. |
Dependency is now available on PyPI. In order to use the plugin install the dependency, first, using: pip install PyMunin3 To ensure there are some counters in nftables, store the following script in
Then run it with To reset the counters run |
With PyMunin3 >= 3.0.1 plugin supports dirtyconfig. |
Ping |
Plugin monitors nftables counters and can be configured to show
a subset of counters. Limiting output by type of counter (bytes
or packets) is also possible.
Plugin requires python3-nftables, which makes use of libnftables
and is part of Netfilter's nftables, but may need to be installed
separately. Plugin will bail out if the nftables module cannot be
loaded.
Plugin is built upon PyMunin, adapted for Python3. The version
listed in PIP is still using Python 2 syntax. Release of a Python 3
compatible version is pending.
I'm reaching out to the owner/maintainer of PyMunin for getting
the Python 3 changes implemented and having PyMunin updated in pip.
So far, there has been no response. If it remains quiet, I intent
to fork and publish the new version as PyMunin3. Advice on this
topic is welcome.
For now, to test the plugin, use the PR branch
in my fork of PyMunin. To install it to the user install directory
use
pip install --user -e .
from the repository root directory.For system wide installation use
sudo pip install --prefix /usr/local/ .
.