Re: Issues with the lm_sensors service

"gulikoza" <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
hddtemp should be dropped. I don't use it and I wrote the script. My nc did
not print connection refused so I left it in...
HDD temperature could possibly be parsed from smartctl but then again
selinux might not allow that.

One note, please move execution of $pathto_sensors inside the if($kvm == 0)
so that it is not ran if not needed. Otherwise an error will be added to the
output (No sensors found - see my mail to this list on 19.8.2013).

As an alternative to parsing /proc/cpuinfo, virt-what could be used? But I
don't know how specific this is to redhat and it would add another
dependency...

The whole point of detecting kvm is to avoid:

No sensors found!
Make sure you loaded all the kernel drivers you need.

Now, if this is printed on a bare metal machine, it might remind the
administrator to configure lm_sensors. It is of course useless on a virtual
machine so that's what I've tried to avoid. Then again, sensors could be run
with 2> /dev/null, avoid the whole detection procedure and not print any
errors. But in my case, I wanted to be informed when sensors was not
configured on a bare metal machine.

Regards,
gulikoza

-----Original Message-----
From: Orion Poplawski [mailto:[email protected]] 
Sent: Thursday, January 02, 2014 6:12 PM
To: logwatch-devel
Subject: [Logwatch-devel] Issues with the lm_sensors service

I have some issues with the zz-lm_sensors service:

- On Fedora, nc is blocked by SELinux:

 --------------------- lm_sensors output Begin ------------------------

 Ncat: Permission denied.

type=AVC msg=audit(1388681104.665:133): avc:  denied  { name_connect } for
pid=2394 comm="nc" dest=7634
scontext=system_u:system_r:logwatch_t:s0-s0:c0.c1023
tcontext=system_u:object_r:hddtemp_port_t:s0 tclass=tcp_socket

Even when run from the console I get:

 --------------------- lm_sensors output Begin ------------------------

 Ncat: Connection refused.


This I think is better:

my $query_hddtemp  = $ENV{'query_hddtemp'}  || '/usr/bin/nc 127.0.0.1 7634
2>/dev/null';


Although I am a little leery of adding network connections to logwatch.

Also, how common is hddtemp?

- It always generates output.  I run logwatch in a mode where I only want
output if there are problems.  So, similar to the zz-disk_space it should
only
output if already printing or $Detail is not 0.

- I *think* SELinux may be blocking access to /proc/cpuinfo as well so that
it
cannot determine if a machine is virtual.


Patch which I'll commit shortly:

 Index: scripts/services/zz-lm_sensors
===================================================================
--- scripts/services/zz-lm_sensors      (revision 176)
+++ scripts/services/zz-lm_sensors      (working copy)
@@ -27,7 +27,7 @@
 #Output sensors stats

 my $pathto_sensors = $ENV{'pathto_sensors'} || '/usr/bin/sensors';
-my $query_hddtemp  = $ENV{'query_hddtemp'}  || '/usr/bin/nc 127.0.0.1
7634';
+my $query_hddtemp  = $ENV{'query_hddtemp'}  || '/usr/bin/nc 127.0.0.1 7634
2>/dev/null';
 my $get_kvm_status = $ENV{'get_kvm_status'} || 'cat /proc/cpuinfo | grep -c
"QEMU Virtual CPU"';

 my $sensors = qx($pathto_sensors);
@@ -34,7 +34,7 @@
 my $hdd     = qx($query_hddtemp);
 my $kvm     = qx($get_kvm_status);

-if ($kvm == 0) {
+if ($kvm == 0 and (($ENV{PRINTING} eq 'y') or $Detail)) {
    if ($sensors) {
       print $sensors;
    }



-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       [email protected]
Boulder, CO 80301                   http://www.nwra.com

----------------------------------------------------------------------------
--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Logwatch-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/logwatch-devel


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.