linuxserver / docker-smokeping

GNU General Public License v3.0
347 stars 95 forks source link

[BUG] Could not import InfluxDB modules - (you may need to install the JSON::MaybeXS module) #179

Closed pizzydizzy closed 1 month ago

pizzydizzy commented 1 month ago

Is there an existing issue for this?

Current Behavior

After configuring the influxdb section, when the container starts it logs:

ERROR: Could not import InfluxDB modules, but InfluxDB host was configured: Can't locate JSON/MaybeXS.pm in @INC (you may need to install the JSON::MaybeXS module) (@INC entries checked: .. /usr/share/smokeping /usr/local/lib/perl5/site_perl /usr/local/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at /usr/local/share/perl5/site_perl/InfluxDB/HTTP.pm line 13. BEGIN failed--compilation aborted at /usr/local/share/perl5/site_perl/InfluxDB/HTTP.pm line 13. Compilation failed in require at /usr/share/smokeping/Smokeping.pm line 4169.

Expected Behavior

No response

Steps To Reproduce

  1. Create the container and configure the influxdb section configured in "Database" config file (at the end):

InfluxDB

host = database = timeout = 10 port = username = password =

  1. Start the container and see logs on open the webgui:

ERROR: Could not import InfluxDB modules, but InfluxDB host was configured: Can't locate JSON/MaybeXS.pm in @INC (you may need to install the JSON::MaybeXS module) (@INC entries checked: .. /usr/share/smokeping /usr/local/lib/perl5/site_perl /usr/local/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at /usr/local/share/perl5/site_perl/InfluxDB/HTTP.pm line 13. BEGIN failed--compilation aborted at /usr/local/share/perl5/site_perl/InfluxDB/HTTP.pm line 13. Compilation failed in require at /usr/share/smokeping/Smokeping.pm line 4169.

Environment

- OS:
- How docker service was installed:

CPU architecture

x86-64

Docker creation

docker run -d \
  --name=smokeping \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Etc/UTC \
  -e CACHE_DIR=/tmp `#optional` \
  -p 80:80 \
  -v /local-smokeping-config-path/config:/config \
  -v /local-smokeping-data-path/data:/data \
  --restart unless-stopped \
  lscr.io/linuxserver/smokeping:latest

Container logs

DBG: Setting up a new InfluxDB connection
ERROR: Could not import InfluxDB modules, but InfluxDB host was configured: Can't locate JSON/MaybeXS.pm in @INC (you may need to install the JSON::MaybeXS module) (@INC entries checked: .. /usr/share/smokeping /usr/local/lib/perl5/site_perl /usr/local/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at /usr/local/share/perl5/site_perl/InfluxDB/HTTP.pm line 13.
BEGIN failed--compilation aborted at /usr/local/share/perl5/site_perl/InfluxDB/HTTP.pm line 13.
Compilation failed in require at /usr/share/smokeping/Smokeping.pm line 4169.
github-actions[bot] commented 1 month ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

thespad commented 1 month ago

Can you do docker exec -it smokeping apk add perl-json-maybexs and see if that is sufficient to resolve the dep issue? If so we can get it added to the image.

pizzydizzy commented 1 month ago

Can you do docker exec -it smokeping apk add perl-json-maybexs and see if that is sufficient to resolve the dep issue? If so we can get it added to the image.

Done, but now it needs:

DBG: Setting up a new InfluxDB connection ERROR: Could not import InfluxDB modules, but InfluxDB host was configured: Can't locate Object/Result.pm in @INC (you may need to install the Object::Result module) (@INC entries checked: .. /usr/share/smokeping /usr/local/lib/perl5/site_perl /usr/local/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at /usr/local/share/perl5/site_perl/InfluxDB/HTTP.pm line 15. BEGIN failed--compilation aborted at /usr/local/share/perl5/site_perl/InfluxDB/HTTP.pm line 15. Compilation failed in require at /usr/share/smokeping/Smokeping.pm line 4169.

thespad commented 1 month ago

OK, this is going to be fun walking the dependencies.

Exec into a shell in the container and do:

apk add build-base perl-app-cpanminus perl-dev
cpanm Object::Result

And then try again; we'll have to keep going until we find all the deps. With any luck it'll just be that one.

thespad commented 1 month ago

Looks like Object::Result depends on Method::Signatures which is from 2017 and therefore fails its tests due to deprecated deps. Going to be horribly messy but might be able to do:

apk add build-base perl-app-cpanminus perl-dev
cpanm Method::Signatures --force
cpanm Object::Result
pizzydizzy commented 1 month ago

Looks like Object::Result depends on Method::Signatures which is from 2017 and therefore fails its tests due to deprecated deps. Going to be horribly messy but might be able to do:

apk add build-base perl-app-cpanminus perl-dev
cpanm Method::Signatures --force
cpanm Object::Result

I was just dealing with it. It also needs:

cpanm InfluxDB::LineProtocol

Now it starts without errors and any dependencies issues.

thespad commented 1 month ago

OK, let me put a PR together to add all the bits