Luci statistics - Collectd - Thermal graph

Hello,

Does anyone know, how to add Thermal (CPU °C) to the Luci statistics? In turris repo there is thermal module, no sensors. Thermal module generates some rrd files, but I dont know how to teach luci statistics to show them

1 Like

skus balicek collectd-mod-thermal
try package collectd-mod-thermal

Yes, I already installed it, and as I wrote, it generates rrd files. But seems to turris version of luci-statistics doesnt recognize it…

I recreated thermal commit from Lucis github on my Omnia, but its not enough :frowning:

collectd-mod-thermal generates rrd file, but imho without data to show. If you use
rrdtool fetch temperature-temperature.rrd AVERAGE
command, all values are “nan”, this means UNKNOWN.

Strange… I have sometimes nan, sometimes like:

1489693080:  6.1882200000e+01
1489693140:  6.1501400000e+01
1489693200:  6.1977400000e+01
1489693260:  6.2263000000e+01

unreliable. Pity, that sensors package isnt avaible in turris repo, I think it would work out of the box.

Other thing is, that collectd in turris repo is 4.10.8. This version is from year 2012. Even chaos calmer 15.05.1 has 5.4.2 https://downloads.openwrt.org/chaos_calmer/15.05.1/mvebu/generic/packages/packages/

1 Like

I did the thermal commit you mentioned and I have my first valid (non-nan) values in the temperature-temperature.rrd file since then. But no menu item for graph in Luci.

@Jirka Yes, many packages in OpenWRT / TurrisOS are really old :frowning:

I’ve kind of gotten the thermal stuff working.

Since there’s no indication how the thermal plugin (/usr/lib/collectd/thermal.so) gets enabled, I don’t know how you’re getting any data in temperature-temperature.rrd, but here’s how i was able to get a graph. I’m still working on getting a menu item.

When you’re talking about luci-app-statistics, there are two main files that need to get modified.
/usr/bin/stat-genconfig - this is the lua script to generate /etc/config/luci_statistics file
/usr/lib/lua/luci/controller/luci_statistics/luci_statistics.lua - this should define the menu items displayed.

The for each graph/config there needs to be a specific file. “thermal.lua” in this case:
/usr/lib/lua/luci/statistics/rrdtool/definitions/thermal.lua - graph description file
/usr/lib/lua/luci/model/cbi/luci_statistics/thermal.lua - config description file

I grab files from the the main openwrt sources for luci-app-statistics. It’s important to not just replace stat-genconfig and luci_statistics.lua since there may be a lot of differences between the version on github and the one on your router. You’ll need to edit them by hand.

As I mentioned earlier, I’ve got a graph, but no menu entry. To enable the plugin, I added the following to my /etc/config/luci-statistics:

config statistics 'collectd_thermal’
option enable ‘1’

I then re-started luci_statistics

/etc/init.d/luci_statistics stop
/etc/init.d/luci_statistics start

Check to see you’re getting data. The “temperature-temperature.rrd” file will be wherever you’re keeping your data. By default this is in “/var/lib”, but will be somewhere else if you’re keeping your data in a more permanent location.

I can show the graph without the menu by going directly to it. So the normal URL for the graphs on your router are:

http://[router-ip]/cgi-bin/luci/admin/statistics/graph/

Most graphs/configs are labelled rationally, and that is the case here. So, to display the thermal graph it’s just:

http://[router-ip]/cgi-bin/luci/admin/statistics/graph/thermal

I’ll keep working on getting a menu item to show up, but if you have data the graph should just work.

Sorry, this seems a lot more involved than when I first started out. But there’s also more information here than strictly necessary and also probably not enough.

3 Likes

I think its because missing translation / i18n strings. I am afraid we need luci modules bump for that :frowning: (I didnt find any “cleartext” lang files on Omnia).

Missing collectd-mod-sensors in repo is mystery to me.

1 Like

I’m getting data because I changed my files according to the thermal commit that Jirka mentioned several posts earlier. The changes are the same as you mentioned in your post. New is the idea to use direct link, thank you :slight_smile: Now I can see the graph, the last thing is to make menu items for LuCI.


1 Like

Great observation, thanks! Thermal graphs works fine through direct link.

Problem solved. The luci cache was the root cause, not all of our changes was propagated.

rm -rf /tmp/luci-modulecache/*
/etc/init.d/lighttpd restart

after then all lua changes appeared :slight_smile:

P.S.: CPUfreq collectd module would be good also :yum:

2 Likes

In case someone needed, compiled collectd-mod-sensors_4.10.8-3_mvebu for Omnia

This was not sufficient for me and after some unsuccessful tries I solved it by restarting of my router.

sometimes also help temporarilly disable cache in /etc/config/luci. But you have working stats and thats the most important :slight_smile:

So what is the final complete procedure for making the temperature graphs on Turris Omnia?

Changed all files, tried all commands from here, but nothing. Is it also for Turris v1.x?

Please note, I dont use script /etc/init.d/luci.statistics, I am using collect.conf directly.

  1. instal thermal collectd mod
  2. configure collectd.conf for use it
  3. disable luci cache, restart lighttpd
  4. recreate .lua files from github for thermal
  5. test luci, if graphs shows correctly
  6. enable luci cache, restart lighttpd

Tried, but failed. Log says:

[2017-03-20 14:55:13] sensors plugin: stat (/etc/sensors3.conf) failed: No such file or directory
[2017-03-20 14:55:13] sensors plugin: fopen(/etc/sensors3.conf) failed: No such file or directory
[2017-03-20 14:55:13] read-function of plugin `sensors’ failed. Will suspend it for 60 seconds.

did you configure sensors in collect configuration file?

The older (4.10) collectd version has

# ifndef SENSORS_CONF_PATH
#  define SENSORS_CONF_PATH "/etc/sensors.conf"
# endif
/* #endif SENSORS_API_VERSION < 0x400 */

#elif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500)
typedef struct featurelist
{
    const sensors_chip_name    *chip;
    const sensors_feature      *feature;
    const sensors_subfeature   *subfeature;
    struct featurelist         *next;
} featurelist_t;

# ifndef SENSORS_CONF_PATH
#  define SENSORS_CONF_PATH "/etc/sensors3.conf"
# endif

You should define some config file I assume. Examples you can find on internet.

No, as the sensors-detect is throwing a Unhandled fault: imprecise external abort (0x1406) at 0xbed4eb4c, so I did not invest any more time as it is not really needed, only nice to have.

Ah… sorry for hearing that.