Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

Failed to read sensors list on Arch Linux (4.8.8-2-ARCH) #9

Closed
BlackZork opened this issue Nov 28, 2016 · 5 comments
Closed

Failed to read sensors list on Arch Linux (4.8.8-2-ARCH) #9

BlackZork opened this issue Nov 28, 2016 · 5 comments

Comments

@BlackZork
Copy link

Patch below:

--- /usr/lib/monitoring-plugins/check_lm_sensors        2016-11-28 22:03:57.000000000 +0000
+++ /usr/lib/monitoring-plugins/check_lm_sensors.mod    2016-11-28 22:03:18.626803491 +0000
@@ -454,13 +454,13 @@
         ## use critic

         # list sensors
-        opendir $dir_handle, "$DEV_DIR/$device/device/"
+        opendir $dir_handle, "$DEV_DIR/$device"
           or return;
         my @sensors = apply { s/_input//mxs; }
         grep { m/^[^.].*_input/mxs } readdir $dir_handle;
         closedir $dir_handle
           or $plugin->nagios_exit( $plugin_module->UNKNOWN,
-            "Error closing $DEV_DIR/$device/device: $OS_ERROR" );
+            "Error closing $DEV_DIR/$device: $OS_ERROR" );

         for my $sensor (@sensors) {

@@ -470,11 +470,11 @@

             ## no critic (InputOutput::RequireBriefOpen)
             open $sensor_handler, q{<},
-              "$DEV_DIR/$device/device/$sensor"
+              "$DEV_DIR/$device/$sensor"
               . '_input'
               or $plugin->nagios_exit(
                 $plugin_module->UNKNOWN,
-                "Error reading $DEV_DIR/$device/device/$sensor"
+                "Error reading $DEV_DIR/$device/$sensor"
                   . "_input: $OS_ERROR"
               );
             while (<$sensor_handler>) {
@@ -485,7 +485,7 @@
             close $sensor_handler
               or $plugin->nagios_exit(
                 $plugin_module->UNKNOWN,
-                "Error closing $DEV_DIR/$device/device/$sensor"
+                "Error closing $DEV_DIR/$device/$sensor"
                   . "_input: $OS_ERROR"
               );
             ## use critic
@The-Compiler
Copy link

This seems like a duplicate of #6, and it should probably search both paths. I've talked to @matteocorti about it before, but I can't write any perl, so I'm just sticking to 3.1.1 at the moment.

@matteocorti
Copy link
Owner

The problem is that some systems use /$device/device/$sensor and some other /$device/$sensor . The plugin should check which one is there. This patch will solve the problem for some systems and break others.

@BlackZork
Copy link
Author

Yes, I know. Patch was only to show what change is needed for plugin to show anything on current Arch. I do not have perl skills to fix it. It seems from #6 that code need to check it not per system but per $device.

@matteocorti
Copy link
Owner

I am looking for a maintainer since I have no Linux machines where I could test new versions ....

@isaaclw
Copy link

isaaclw commented Jul 13, 2017

This patch also fixed the debian stretch version, which was broken.

$ apt-cache policy nagios-plugins-contrib
nagios-plugins-contrib:
  Installed: 21.20170222
  Candidate: 21.20170222
  Version table:
 *** 21.20170222 500
        500 http://ftp.us.debian.org/debian stretch/main amd64 Packages
        100 /var/lib/dpkg/status

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

No branches or pull requests

4 participants