Skip to content
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

pacific: mgr/cephadm: Add snmp-gateway service support #44529

Merged

Conversation

sebastian-philipp
Copy link
Contributor

Backport of #43901, #44341

@pcuzner
Copy link
Contributor

pcuzner commented Jan 12, 2022

The original PR provided this with a -h;

orch apply snmp-gateway <snmp_version:V2c|V3> <destination> [<port:int>] [<engine_id>] [<auth_protocol:MD5|SHA>]      Add a Prometheus to SNMP gateway service (cephadm only)
 [<privacy_protocol:DES|AES>] [<placement>] [--unmanaged] [--dry-run] [--format {plain|json|json-pretty|yaml}] [--no- 
 overwrite] 

The parameters accepted are shown in the help.

And now you see this

orch apply snmp-gateway V2c|V3 <destination> [<port:int>] [<engine_id>] [MD5|SHA] [DES|AES] [<placement>] [--         Add a Prometheus to SNMP gateway service (cephadm only)
 unmanaged] [--dry-run] [--format {plain|json|json-pretty|yaml}] [--no-overwrite]

snmp_version, auth_protocol and privacy_protocol are missing!

This makes the CLI harder to use, since you no longer see the parameter names that can be used.

Also, if you set them positionally I see this;

[ceph: root@pacific-1 ~]# ceph orch apply snmp-gateway V3 --destination 192.168.122.1:162 --engine_id 8000C5A32011223344 SHA AES -i ./snmp_auth_priv.yml                                                                                   
Error EINVAL: engine_id must be a string containing 10-64 hex characters. Its length must be divisible by 2

...but adding in --privacy_protocol AES still works

What's the cause of this 'regression'?

@sebastian-philipp
Copy link
Contributor Author

The original PR provided this with a -h;

orch apply snmp-gateway <snmp_version:V2c|V3> <destination> [<port:int>] [<engine_id>] [<auth_protocol:MD5|SHA>]      Add a Prometheus to SNMP gateway service (cephadm only)
 [<privacy_protocol:DES|AES>] [<placement>] [--unmanaged] [--dry-run] [--format {plain|json|json-pretty|yaml}] [--no- 
 overwrite] 

The parameters accepted are shown in the help.

And now you see this

orch apply snmp-gateway V2c|V3 <destination> [<port:int>] [<engine_id>] [MD5|SHA] [DES|AES] [<placement>] [--         Add a Prometheus to SNMP gateway service (cephadm only)
 unmanaged] [--dry-run] [--format {plain|json|json-pretty|yaml}] [--no-overwrite]

snmp_version, auth_protocol and privacy_protocol are missing!

This makes the CLI harder to use, since you no longer see the parameter names that can be used.

Also, if you set them positionally I see this;

[ceph: root@pacific-1 ~]# ceph orch apply snmp-gateway V3 --destination 192.168.122.1:162 --engine_id 8000C5A32011223344 SHA AES -i ./snmp_auth_priv.yml                                                                                   
Error EINVAL: engine_id must be a string containing 10-64 hex characters. Its length must be divisible by 2

...but adding in --privacy_protocol AES still works

What's the cause of this 'regression'?

Maybe this is due how the help is generated by pacific instead of master????

@pcuzner
Copy link
Contributor

pcuzner commented Jan 12, 2022

@sebastian-philipp Hmmm - so it's a 'feature' of Pacific :) I don't have an approve 'button', but if this is the case it lgtm!

@sebastian-philipp
Copy link
Contributor Author

jenkins test make check

@sebastian-philipp
Copy link
Contributor Author

@sebastian-philipp
Copy link
Contributor Author

build failed with

  WARNING: Built wheel for xmlsec is invalid: xmlsec has an invalid wheel, could not read 'xmlsec-1.3.12.dist-info/WHEEL' file: BadZipFile('Truncated file header')
Failed to build xmlsec
ERROR: Could not build wheels for xmlsec, which is required to install pyproject.toml-based projects
  Building wheel for xmlsec (pyproject.toml): finished with status 'done'
  Created wheel for xmlsec: filename=xmlsec-1.3.12-cp38-cp38-linux_x86_64.whl size=199791 sha256=faef8db469c4fc018e1b1c600059bb929775b1292e6d0ae522dffece9e0110fb
  Stored in directory: /home/jenkins-build/build/workspace/ceph-pull-requests/install-deps-cache/pip/wheels/2c/99/a3/98bcb24586c778eb35e23e30af30fbf1c34a0a9ed85e18576a
Successfully built xmlsec
Installing collected packages: more-itertools, pytz, pycparser, jaraco.functools, wrapt, tomli, tempora, pyflakes, pycodestyle, pluggy, mccabe, lxml, lazy-object-proxy, iniconfig, coverage, cffi, attrs, xmlsec, wcwidth, urllib3, repoze.lru, pyyaml, pytest, portend, isort, isodate, idna, flake8, docutils, defusedxml, cryptography, cheroot, chardet, certifi, astroid, rstcheck, Routes, requests, python3-saml, pytest-instafail, pytest-cov, pyopenssl, pylint, PyJWT, pyfakefs, prettytable, flake8-colors, CherryPy, ceph, bcrypt, autopep8
make[3]: *** [src/pybind/mgr/dashboard/CMakeFiles/mgr-dashboard-py3-venv.dir/build.make:61: mgr-dashboard-py3-virtualenv/bin/activate] Error 1

@sebastian-philipp
Copy link
Contributor Author

jenkins test make check

@sebastian-philipp
Copy link
Contributor Author

jenkins test make check

@sebastian-philipp
Copy link
Contributor Author

cephadm/module.py:481:1: W191 indentation contains tabs
cephadm/module.py:481:1: E101 indentation contains mixed spaces and tabs
cephadm/module.py:481:4: E131 continuation line unaligned for hanging indent
cephadm/module.py:2670:1: W191 indentation contains tabs
cephadm/module.py:2670:1: E101 indentation contains mixed spaces and tabs
cephadm/module.py:2670:1: W293 blank line contains whitespace
orchestrator/_interface.py:652:1: W191 indentation contains tabs
orchestrator/_interface.py:652:1: E101 indentation contains mixed spaces and tabs
orchestrator/_interface.py:652:1: W293 blank line contains whitespace

pcuzner and others added 5 commits January 18, 2022 11:42
This patch enables the cephadm binary
to deploy an SNMP gateway based on -
https://hub.docker.com/r/maxwo/snmp-notifier

Fixes: https://tracker.ceph.com/issues/52920

Signed-off-by: Paul Cuzner <pcuzner@redhat.com>
(cherry picked from commit 5c997ad)

Conflicts:
	src/cephadm/cephadm
Updated docs to show snmp-gateway usage. docs provide
guidance on SNMP versions supported and show CLI and
yaml deployment examples.

Signed-off-by: Paul Cuzner <pcuzner@redhat.com>
(cherry picked from commit 91f35e1)
Adds tests to validate the deployed configuration given a known
input context, and check the parameters created based on input
various input scenarios

Signed-off-by: Paul Cuzner <pcuzner@redhat.com>
(cherry picked from commit 2ffa81b)

Conflicts:
	src/pybind/mgr/cephadm/tests/test_services.py
Add a new snmp-gateway service to provide a bridge between
Prometheus and an SNMP management platform. The gateway
service uses https://github.com/maxwo/snmp_notifier to provide
an SNMP v2c and SNMP V3 support.

The SNMP V3 support mandates at least authentication, and also
offers authentication and privacy (encryption).

Fixes: https://tracker.ceph.com/issues/52920

Signed-off-by: Paul Cuzner <pcuzner@redhat.com>
(cherry picked from commit c2f5e10)

Conflicts:
	src/pybind/mgr/cephadm/module.py
	src/pybind/mgr/orchestrator/_interface.py
	src/pybind/mgr/orchestrator/module.py
	src/python-common/ceph/deployment/service_spec.py
Little reason to duplicate things ourselves

Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
(cherry picked from commit 0039acc)

Conflicts:
	src/pybind/mgr/orchestrator/module.py
	src/python-common/ceph/deployment/service_spec.py
	src/python-common/ceph/tests/test_service_spec.py
Enable us to chage defaults in the future

Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
(cherry picked from commit 5e3cc4d)
this just broken for non-trivial urls. Don't be a bad example

Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
(cherry picked from commit 3f47c22)
Let's keep the tests in the same package where the class is defined.

Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
(cherry picked from commit c652ae7)
We have to validate to_json() now as well, as we have spcial enums.
Otherwiese we might end up with !!python... representations.

Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
(cherry picked from commit 303843b)
@sebastian-philipp
Copy link
Contributor Author

changelog:

  • rebased (fixed conflict in python-common/ceph/tests/test_service_spec.py)
  • fixed flake8 errors

@sebastian-philipp sebastian-philipp merged commit 7a689a3 into ceph:pacific Jan 18, 2022
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants