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

Problem with SSLLabs Plugin in Checkmk 2.2.0 #20

Open
toxicvengeance opened this issue Jun 16, 2023 · 15 comments
Open

Problem with SSLLabs Plugin in Checkmk 2.2.0 #20

toxicvengeance opened this issue Jun 16, 2023 · 15 comments

Comments

@toxicvengeance
Copy link

Hi,

there seems to be an issue with the ssllabs api check Plugin(downloaded from https://exchange.checkmk.com/p/ssllabs) in Checkmk 2.2.0. When I activate the plugin the following error message appears

Some GUI extensions could not be loaded. This may be caused by some incompatible extension packages.

Loading "wato/ssllabs_check_pameters" failed: name 'RegExp' is not defined

I then tried adding the check to a specific host and got the following error

[agent] Success, [special_ssllabs] TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'CRIT, [piggyback] Success (but no data found for this host), execution time 1.3 sec

Do you have an idea what could be wrong ?

Cheers

@moschlar
Copy link

As a workaround:

In web/plugins/wato/ssllabs_check_pameters.py add:

from cmk.gui.i18n import _
from cmk.gui.valuespec import (
    Dictionary,
    Tuple,
    Age,
    RegExpUnicode,
    RegExp,
    TextAscii,
)
from cmk.gui.wato import (
    subgroup_applications,
)
from cmk.gui.plugins.wato.utils import (
    register_check_parameters,
)

before the actual code.

And in special/agent_ssllabs change the definition of cache_dir:

cache_dir = os.environ.get("OMD_ROOT") + "/tmp/check_mk" + "/agents/agent_ssllabs"

If @schoekek would bring the plugin version in this repo up-to-date (#17), I would provide my changes as a PR. 😉

@christmart
Copy link

You also need some more code in ssllabs_datasource_programs.py:

from cmk.gui.i18n import _
from cmk.gui.valuespec import (
    Dictionary,
    Integer,
    TextAscii,
    Transform,
)
from cmk.gui.watolib.rulespecs import (
    register_rule,
)

before the actual code.

@schoekek
Copy link
Owner

i plan to upload a new mkp version to exchange..

@christmart
Copy link

There is a new version 3.1.1 on exchange which has the fixes for ssllabs_check_pameters.py and agent_ssllabs but it misses the fixes to ssllabs_datasource_programs.py

@schoekek
Copy link
Owner

3.1.1 runs error-free on my installation.

@christmart
Copy link

It only runs error-free if you have mkp packages installed which get called before your plugin and already define these imports.
Try to load ssllabs mkp with no other mkps installed.

@dnlldl
Copy link

dnlldl commented Mar 31, 2024

Doesn't work anymore on 2.3.0b4-cre.

Error running automation call restart (exit code 5), error:
Error in plugin file /omd/sites/<site>/local/share/check_mk/checks/ssllabs_grade: name 'factory_settings' is not defined
Error precompiling checks for host <hostname>: Cannot find check file needed for agent_ssllabs```

@schoekek
Copy link
Owner

schoekek commented Apr 4, 2024

We won't switch to 2.3 until QIII/2024. Unfortunately there is no new mkp before then.

@dnlldl
Copy link

dnlldl commented May 25, 2024

We won't switch to 2.3 until QIII/2024. Unfortunately there is no new mkp before then.

Any update on this?

@philrandal
Copy link

philrandal commented Jun 7, 2024

@christmart is right about the additional lines needed in ssllabs_datasource_programs.py.

@dnlldl The 2.3.0 error is a mystery. I get it too. I'll try to get to the bottom of it in the next week or so.

I'm not familiar enough with the checkmk plugin api to be able to do this one quickly, alas.

@philrandal
Copy link

OK, if we install into 2.1.0 it works as expected, and if we then upgrade that site to 2.2.0 it still works.

However, when I create a test site in 2.2.0 the mkp installs but we are missing the "Check SSL Server via ssllabs API" other integrations ruleset.

Looks like the whole thing needs updating to the 2.0 API as a first step.

@dnlldl
Copy link

dnlldl commented Jun 13, 2024

OK, if we install into 2.1.0 it works as expected, and if we then upgrade that site to 2.2.0 it still works.

However, when I create a test site in 2.2.0 the mkp installs but we are missing the "Check SSL Server via ssllabs API" other integrations ruleset.

Looks like the whole thing needs updating to the 2.0 API as a first step.

This doesn't work on 2.3 either but you might want to check https://thl-cmk.hopto.org/gitlab/checkmk/various/agent_ssllabs

@philrandal
Copy link

philrandal commented Jun 14, 2024

Sorry to hijack this issue, but I got the latter working in 2.3 by making the following change to local/lib/python3/cmk/special_agents/agent_ssllabs.py

#from cmk.special_agents.utils.agent_common import special_agent_main
from cmk.special_agents.v0_unstable.agent_common import special_agent_main

#from cmk.special_agents.utils.argument_parsing import create_default_argument_parser
from cmk.special_agents.v0_unstable.argument_parsing import create_default_argument_parser

Cloned it to github and created a cmk23 branch which has a working mkp for cmk 2.2.0 and 2.3.0

https://github.com/philrandal/agent_ssllabs/tree/cmk23

@dnlldl
Copy link

dnlldl commented Jun 18, 2024

Sorry to hijack this issue, but I got the latter working in 2.3 by making the following change to local/lib/python3/cmk/special_agents/agent_ssllabs.py

#from cmk.special_agents.utils.agent_common import special_agent_main from cmk.special_agents.v0_unstable.agent_common import special_agent_main

#from cmk.special_agents.utils.argument_parsing import create_default_argument_parser from cmk.special_agents.v0_unstable.argument_parsing import create_default_argument_parser

Cloned it to github and created a cmk23 branch which has a working mkp for cmk 2.2.0 and 2.3.0

https://github.com/philrandal/agent_ssllabs/tree/cmk23

I assume using the "v0_unstable" libraries won't work forever though? There must be something new that needs to be done to make it properly working.

@Yogibaer75
Copy link

I assume using the "v0_unstable" libraries won't work forever though? There must be something new that needs to be done to make it properly working.

At the moment these are the correct imports. This API is not fixed for a version 1 release. I think with 2.4 next year this will be then v1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants