From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Fischer To: development@lists.ipfire.org Subject: 'collectd' and 'cpufreq' on IPFire Duobox - wrong path in initscript? Date: Tue, 03 Jul 2018 21:52:42 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8768361974742834049==" List-Id: --===============8768361974742834049== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi! This was triggered by https://git.ipfire.org/?p=3Dipfire-2.x.git;a=3Dcommitdi= ff;h=3D37458540bf727df09989c10d640ad13c1a989029 I thought some cpu graphs on my "Duo Box" could be helpful and installed 'cpufrequtils'. But after adding the above commit to '/etc/init.d/collectd' and restarting 'collectd' =3D> no graphs appeared. Reason: The needed directory '/sys/devices/system/cpu/cpufreq/policy0/' doesn't exist on my machine, so the 'LoadPlugin' was always commented and deactivated. Instead there are '/sys/devices/system/cpu/cpu0' and '/sys/devices/system/cpu/cpu1'. So I tested this the hard way. After commenting the if-statement, everything is working, CPU graphs appear and show reasonable values: ... # Enable cpufreq plugin if cpufreq found #if [ ! -e /sys/devices/system/cpu/cpufreq/policy0/*_cur_freq ]; then # sed -i -e "s|^LoadPlugin cpufreq|#LoadPlugin cpufreq|g" /etc/collectd.conf #else sed -i -e "s|^#LoadPlugin cpufreq|LoadPlugin cpufreq|g" /etc/collectd.conf #fi ... Changed this to: ... if [ ! -e /sys/devices/system/cpu/cpu0/cpufreq/*_cur_freq ]; then .. But this gave me an error: /etc/init.d/collectd: line 95: [: /sys/devices/system/cpu/cpu0/cpufreq/cpuinf= o_cur_freq: binary operator expected I changed the line to: ... if [ ! -e /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq ]; then ... And now it is running as expected. Would this be ok for other machines? Bug or feature - can anyone confirm? Best, Matthias P.S.: I didn't forget the Telko - I was still at work. Too bad... --===============8768361974742834049==--