Closed peterge1998 closed 8 months ago
It tells you
./proxmox_bs.py: line 61: /etc/check_mk/proxmox_bs.env: No such file or directory
So you need to create the /etc/check_mk/proxmox_bs.env
file. The check needs API access, so go to configuration ➜ access control, click "API Token" and add one if you haven't already.
Fill the /etc/check_mk/proxmox_bs.env
file with the API token details so it looks somewhat like this:
#!/bin/bash
export PBS_USERNAME=user@pam!tokenname
export PBS_PASSWORD=abcd1234-1234-abcd-1234-abcdef123456
It would be great if the project's README would list all these steps in the installation instructions instead of having users figure that out for themselves.
Ah, makes sense to put the API token into the env file! Now it does not complain anymore.
I renamed the file to mk_proxmox_bs.py, to match the naming convention and permissions that another host with mk_docker.py has.
But the check is still not showing up when I run a service discovery on the pbs host - any idea why?
root@pbsbn:/usr/lib/check_mk_agent/plugins# ls -l
total 4
-rwxr-xr-x 1 root root 2851 Feb 28 13:20 mk_proxmox_bs.py
Regarding the project's README, a link to this issue should be enough for anyone to set it up :)
root@pbsbn:/usr/lib/check_mk_agent/plugins# check_mk_agent | grep plugin
PluginsDirectory: /usr/lib/check_mk_agent/plugins
<<<checkmk_agent_plugins_lnx:sep(0)>>>
pluginsdir /usr/lib/check_mk_agent/plugins
/usr/lib/check_mk_agent/plugins/mk_proxmox_bs.py:CMK_VERSION="unversioned"
Naming it .py does not make sense as it is not python but a bash script, so .sh (or no extension as suggested by the project and other bash scripts shipped with check_mk) would fit better. It should not make a difference though.
As for why the check does now show up, good question. The first thing I do is run the check manually on the command line, usually cd /usr/lib/check_mk_agent/plugins; ./myplugin
.
If that works, I run check_mk_agent > agentout.txt
so I can examine what's going on. If it does not show up and I can't figure it out, I start debugging (adding a bunch of echo
s to a copy of the agent and running that).
Just to document this here: I had to set 2 more things in the env file, the PBS_REPOSITORY and the PBS_FINGERPRINT because we used self signed certificates (forum post).
Now my env file looks like this:
#!/bin/bash
export PBS_USERNAME=root@pam!<tokenname>
export PBS_PASSWORD=<api-secret>
export PBS_REPOSITORY=localhost:<datastore>
export PBS_FINGERPRINT=<fingerprint>
I also had to set up the permissions for /
for the user the token belongs to.
Now the check works fine:
Thanks for making this plugin! <3
Thanks for the feedback. I'll check if we can extend the docs.
And of course you need to install AND enable the mkp from the releases :)
We use cmk raw edition. Installing the mkp works just fine, but when installing this to
/usr/lib/check_mk_agent/plugins/proxmox_bs.py
i get this error:When I ran it for the first time, it just said this:
But after running
apt install jq
, the requirements warning is gone.