Monday, July 4, 2016

hddtemp + gkrellm

Here is how I got gkrellm to show my hard drive temperatures on kali2.

apt-get -y install hddtemp gkrellm*

edit /etc/default/hddtemp set RUN_DAEMON="true"
update-rc.d hddtemp enable
/etc/init.d/hddtemp start still didnt start in daemon mode,

http://ubuntuforums.org/showthread.php?t=1359129 shows you have to run
sudo dpkg-reconfigure hddtemp
I set it in suid mode and to run in daemon mode, then ran /etc/init.d/hddtemp start and it kept running:

# ps aux | grep hdd
root     25386  0.0  0.0   6308  1968 ?        S    18:07   0:00 /usr/sbin/hddtemp -d -l 127.0.0.1 -p 7634 -s | -S 600 /dev/sda /dev/sdb /dev/sdc

testing it: # telnet localhost 7634

next I try gkrellm-hddtemp: http://www.guzu.net/linux/hddtemp.php

$ make

Type 'make gkrellm1' and then 'make install1'
  or 'make gkrellm2' and then 'make install2'

$ dpkg -l gkrellm
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  gkrellm        2.3.6~rc1-1  amd64        GNU Krell Monitors

so I want make install2

$ make gkrellm2
gcc -Wall -fPIC -O2 -DGKRELLM2 `pkg-config --cflags gtk+-2.0` -I. -c gkrellm-hddtemp.c
gkrellm-hddtemp.c: In function ‘string_extents’:
gkrellm-hddtemp.c:93:22: warning: passing argument 1 of ‘gdk_string_extents’ from incompatible pointer type
   gdk_string_extents(ext->ts.font, string, &ext->lbearing, &ext->rbearing,
                      ^
In file included from /usr/include/gtk-2.0/gdk/gdk.h:42:0,
                 from /usr/include/gtk-2.0/gtk/gtk.h:32,
                 from /usr/include/gkrellm2/gkrellm.h:47,
                 from gkrellm-hddtemp.c:40:
/usr/include/gtk-2.0/gdk/gdkfont.h:122:10: note: expected ‘struct GdkFont *’ but argument is of type ‘struct PangoFontDescription *’
 void     gdk_string_extents (GdkFont     *font,
          ^
gcc -shared -Wl -o gkrellm-hddtemp.so gkrellm-hddtemp.o
gcc: error: unrecognized command line option ‘-Wl’
Makefile:19: recipe for target 'gkrellm2' failed
make: *** [gkrellm2] Error 1

googling "gcc: error: unrecognized command line option ‘-Wl’"  I find:
http://stackoverflow.com/questions/33114509/gcc-error-unrecognized-command-line-option-wl-in-makfile

so I try to compile it with Wall instead of Wl and it works:

$~/dev/gkrellm-hddtemp-0.2-beta$ gcc -shared -Wall -o gkrellm-hddtemp.so gkrellm-hddtemp.o

$ sudo make install2
install -d /root/.gkrellm2/plugins/
install gkrellm-hddtemp.so /root/.gkrellm2/plugins/

then I run it again as my normal user since it seems to be using ~/.gkrellm2 instead of some dir in /etc, and restart gkrellm:

I see hddtemp in the plugins list and enabling it shows 3 boxes with temperatures.  Success!

Now how to make gkrellm show smartd status?

No comments:

Post a Comment