Package: netmrg
Version: 0.18.2-14
Severity: normal
Tags: patch

Here is a script that makes it possible to monitor the CPU temperature
or fan speed using the data gathered by the lm-sensors modules.

In theory it would be enough to use something like 'cat
/sys/class/hwmon/hwmon0/device/temp1_input' as the test script. Then
simply apply the right scaling to the graph and that's it.

But NetMRG prepends '/usr/lib/netmrg/' to the command which gives
'/usr/lib/netmrg/cat' which obviously failsi (and is undocumented as
far as I can tell). I assume this is done for security reasons.

So I have written a short script to somewhat based on the
linux26diskaccess.pl one that performs parameter checking and accesses this
data. It can then be invoked with something like this:

 * Test Script: CPU Temp
   Command:     lmsensors.pl temp1
   Data Type:   Standard Out / Gauge

 * Test Script: CPU Fan
   Caommand     lmsensors.pl fan1
   Data Type:   Standard Out / Gauge

Obviously the exact sensor corresponding to the CPU or case temperature
depend on the systemi and would have to be determined beforehand.
Also the above approach requires creating one test script per sensor to
monitor which is a bit ugly. Maybe a better approach would be to use the
per-monitor parameters field but I found no documentation about this and
haven't experimented yet.

Anyway, this can probably be useful to others so I am submitting this
script here for inclusion.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17.8fg1
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages netmrg depends on:
ii  adduser                    3.102         Add and remove users and groups
ii  apache2-mpm-prefork [httpd 2.2.3-3.2     Traditional model for Apache HTTPD
ii  debconf [debconf-2.0]      1.5.11        Debian configuration management sy
ii  libc6                      2.3.6.ds1-11  GNU C Library: Shared libraries
ii  libgcc1                    1:4.1.1-21    GCC support library
ii  libmysqlclient15off        5.0.32-3      mysql database client library
ii  libsnmp9                   5.2.3-7       NET SNMP (Simple Network Managemen
ii  libssl0.9.8                0.9.8c-4      SSL shared libraries
ii  libstdc++6                 4.1.1-21      The GNU Standard C++ Library v3
ii  libxml2                    2.6.27.dfsg-1 GNOME XML library
ii  mysql-client-5.0 [mysql-cl 5.0.32-3      mysql database client binaries
ii  php4                       6:4.4.4-8     server-side, HTML-embedded scripti
ii  php4-cli                   6:4.4.4-8     command-line interpreter for the p
ii  php4-mysql                 6:4.4.4-8     MySQL module for php4
ii  rrdtool                    1.2.15-0.3    Time-series data storage and displ
ii  wwwconfig-common           0.0.48        Debian web auto configuration
ii  zlib1g                     1:1.2.3-13    compression library - runtime

netmrg recommends no packages.

-- debconf information excluded

*** /usr/lib/netmrg/lmsensors.pl
#!/usr/bin/perl
use strict;

### argument processing
my $sensor=$ARGV[0];
my $hwmon=$ARGV[1] || "hwmon0";
if (@ARGV < 1 or @ARGV > 2 or $sensor !~ /^\w+$/ or $hwmon !~ /^\w+$/)
{
        print "U\n";
        print "\n";
        print "$0 <sensor> [monitor]\n";
        print "\n";
        print "Reports sensor gauges for use as a NetMRG test script.\n";
        print "\n";
        print "Options:\n";
        print "  sensor  Is the sensor value to report\n";
        print "  monitor The hardware monitor the sensor is attached to, 
'hwmon0' by default\n";
        print "\n";
        exit 1;
}


# read the data from the correct path
my $path = "/sys/class/hwmon/$hwmon/device/${sensor}_input";
open(STAT, $path) || die ("U\nERROR: couldn't open $path\n\n");
my $value = <STAT>;
close(STAT);
print $value;


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to