hddtemp template (update)

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

tomcatsniper
Posts: 2
Joined: Thu Jul 03, 2008 2:27 pm

doesn't work for me!

Post by tomcatsniper »

Data Query Debug Information

+ Running data query [19].
+ Found type = '4 '[script query].
+ Found data query XML file at '/var/www/cacti/resource/script_queries/hddtemp.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /var/www/cacti/scripts/hddtemp.php 127.0.0.1 index'
+ Executing script query '/usr/bin/php -q /var/www/cacti/scripts/hddtemp.php 127.0.0.1 query device'
+ Found item [device=''] index:
+ Executing script query '/usr/bin/php -q /var/www/cacti/scripts/hddtemp.php 127.0.0.1 query model'
+ Found item [model=''] index:
+ Executing script query '/usr/bin/php -q /var/www/cacti/scripts/hddtemp.php 127.0.0.1 query unit'
+ Found item [unit=''] index:
+ Found data query XML file at '/var/www/cacti/resource/script_queries/hddtemp.xml'
+ Found data query XML file at '/var/www/cacti/resource/script_queries/hddtemp.xml'
+ Found data query XML file at '/var/www/cacti/resource/script_queries/hddtemp.xml'


separately from console:
[root@localhost scripts]# /usr/bin/php -q /var/www/cacti/scripts/hddtemp.php 127.0.0.1 index
/dev/hda

[root@localhost scripts]# /usr/bin/php -q /var/www/cacti/scripts/hddtemp.php 127.0.0.1 query device
/dev/hda:/dev/hda

[root@localhost scripts]# /usr/bin/php -q /var/www/cacti/scripts/hddtemp.php 127.0.0.1 query model
/dev/hda:TOSHIBA MK3021GAS

[root@localhost scripts]# /usr/bin/php -q /var/www/cacti/scripts/hddtemp.php 127.0.0.1 query unit
/dev/hda:C

why doesn't take the values in XML????
tomcatsniper
Posts: 2
Joined: Thu Jul 03, 2008 2:27 pm

doesn't work for me!

Post by tomcatsniper »

sorry for double post :D
sander815
Posts: 13
Joined: Tue Aug 17, 2004 2:30 am

Post by sander815 »

i am getting this with my 1st HD:

Code: Select all

[root@smeserver hddtemp]# telnet 127.0.0.1 7634
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
|/dev/hda|WDC WD2500SB-01KBC0|UNK|*|Connection closed by foreign host.
[root@smeserver hddtemp]#
while hddtemp seems to be working fine:
[root@smeserver hddtemp]# hddtemp /dev/hda
/dev/hda: WDC WD2500SB-01KBC0: 36°C
EvylRat
Posts: 4
Joined: Fri Oct 23, 2009 5:57 pm

Post by EvylRat »

I had trouble getting any version to work. Currently on v1.0
my output from telnet

Code: Select all

|/dev/sg0|WDC WD5000AAKS-00A7B0|34|C||/dev/sg1|Hitachi HDP725050GLA360|32|C||/dev/sg2|SAMSUNG HD501LJ|29|C||/dev/sg3|SAMSUNG HD501LJ|28|C||/dev/sg4|ST340015A|28|C||/dev/sda|WDC WD5000AAKS-00A7B0|34|C||/dev/sdb|Hitachi HDP725050GLA360|32|C||/dev/sdc|SAMSUNG HD501LJ|30|C||/dev/sdd|SAMSUNG HD501LJ|28|C||/dev/sde|ST340015A|28|C|Connection closed by foreign host.
and

Code: Select all

/usr/bin/php -q /usr/share/cacti/site/scripts/hddtemp.php 127.0.0.1 query unit
/dev/sg0:C
/dev/sg1:C
/dev/sg2:C
/dev/sg3:C
/dev/sg4:C
/dev/sda:C
/dev/sdb:C
/dev/sdc:C
/dev/sdd:C
/dev/sde:C
So something's not right there.
looking in hddtemp.php
i found this

Code: Select all

function query($disks,$query){
  switch ($query){
  case "device" : $col = 0; break;
  case "model" : $col = 1; break;
  case "unit" : $col = 3; break;
So column 3 is going to return C. column 2 is going to return the temp.
so change to

Code: Select all

function query($disks,$query){
  switch ($query){
  case "device" : $col = 0; break;
  case "model" : $col = 1; break;
  case "unit" : $col = 2; break;
and I get

Code: Select all

 /usr/bin/php -q /usr/share/cacti/site/scripts/hddtemp.php 127.0.0.1 query unit
/dev/sg0:34
/dev/sg1:32
/dev/sg2:29
/dev/sg3:28
/dev/sg4:28
/dev/sda:34
/dev/sdb:32
/dev/sdc:29
/dev/sdd:28
/dev/sde:28
EvylRat
Posts: 4
Joined: Fri Oct 23, 2009 5:57 pm

Post by EvylRat »

but my graphs are still not being produced. Looking in <path_to_rra> there are no rdd files for the temps.
Anyone else getting this?
EvylRat
Posts: 4
Joined: Fri Oct 23, 2009 5:57 pm

Post by EvylRat »

change from Spine to cmd.php for poller and it works now
Ovaron
Posts: 1
Joined: Wed Mar 24, 2010 9:14 am

Post by Ovaron »

Hi!

I got problems getting your Template working. I'm using Version 0.8.2 with Cacti 0.8.7d.

i'm able to follow the install instructions till the point where I want to create the new graph. I select my host, select "Linux - hddtemp - disk temperature" from the Graph Type dropdown list, but the Data Query () show the following message :
This data query returned 0 rows, perhaps there was a problem executing this data query. You can run this data query in debug mode to get more information.
The debug information:
+ Running data query [11].
+ Found type = '4 '[script query].
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/hddtemp.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /usr/share/cacti/site/scripts/hddtemp.php 10.2.2.214 index'
+ Executing script query '/usr/bin/php -q /usr/share/cacti/site/scripts/hddtemp.php 10.2.2.214 query device'
+ Executing script query '/usr/bin/php -q /usr/share/cacti/site/scripts/hddtemp.php 10.2.2.214 query model'
+ Executing script query '/usr/bin/php -q /usr/share/cacti/site/scripts/hddtemp.php 10.2.2.214 query unit'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/hddtemp.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/hddtemp.xml'
+ Found data query XML file at '/usr/share/cacti/site/resource/script_queries/hddtemp.xml'
btw: telnet to the hddtemp deamon on the target host gives me the
following output:
telnet 10.2.2.214 Trying 10.2.2.X.214..
Connected to 10.2.2.214.
Escape character is '^]'.
|/dev/sg1|ST3160023AS|30|C||/dev/sda|ST3160023AS|30|C|Connection closed by foreign host
It would be very nice if someone is able to help me with my problem, this is the first time i'm using cacti.

edit: i solved my problem, the hddtemp.php file was in the wrong directory.
tkmbe
Posts: 45
Joined: Thu Mar 31, 2005 12:06 pm
Location: Obera, Argentina

Re: hddtemp template (update)

Post by tkmbe »

Hi

Have installed the templates from cacti-linux-hddtemp-1.0.tar.gz but the templates for 4 or 9 disk will override each other.
A part I want to use the one of 4 disks and all models are shown the same (of the first disk) in graph template.
Nobody else has this issue?
JonathanM
Posts: 5
Joined: Wed Dec 31, 2003 3:42 am

Re: hddtemp template (update)

Post by JonathanM »

I wasn't able to get the hddtemp daemon working as required (segfaulting among a few other issues).
So I rolled a work around solution in the form of an xinetd service.
Thought it may be useful to someone here:

Code: Select all

service id-hddtemp
{
    disable         = no
    port            = 7530
    socket_type     = stream
    protocol        = tcp
    wait            = no
    user            = root
    server          = /root/scripts/id-hddtemp
    type            = unlisted
}
And a script:

Code: Select all

#!/bin/bash

# CMDS
SMARTCTL="/usr/sbin/smartctl"
PERL="/usr/bin/perl"

# VARS
PARTITIONS="/proc/partitions"

# LIST THE DISKS
for DISK in $($PERL -ne 'print "$1\n" if /(sd[a-z])$/' "${PARTITIONS}")
do
        MODEL=$($SMARTCTL -d sat -i "/dev/${DISK}" | $PERL -ne 'print "$1\n" if /Device Model: +([^ ]+)/')
        SERIAL=$($SMARTCTL -d sat -i "/dev/${DISK}" | $PERL -ne 'print "$1\n" if /Serial Number: +([^ ]+)/')
        TEMP=$($SMARTCTL -d sat -A "/dev/${DISK}" | $PERL -ne 'print "$1\n" if /^194 [^(]* ([0-9]+)/')
        if [[ -z "$TEMP" ]]; then
                continue;
        fi
        echo -n "|/dev/${DISK}|${MODEL}-${SERIAL}|${TEMP}|C|"
done
The script could be refactored into a single perl request, but ... I got lazy, anyone else ?? :)

Note:
The xinetd service runs as root, which is insecure.
Lock down xinetd if you plan on using this ANYWHERE besides a private lan/wan.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests