Package: munin-plugins-core
Version: 2.0.47-1
Control: severity -1 wishlist

The output of several plugins (including cpusped) is not sorted at all, and a
simple numeric iteration (e.g. of cpu cores or network interfaces) results in
incorrect sorting (1, 10, 11, 12, ..., 2, 20, 21, etc).

I fixed this on my system by replacing the /etc/munin/plugins/cpuspeed symlink
(to /usr/share/munin/plugins/cpuspeed) with a copy of the plugin and making
the following one line change to use sort's -V version-sort aka natural sort
option:


# diff -u /usr/share/munin/plugins/cpuspeed /etc/munin/plugins/cpuspeed
--- /usr/share/munin/plugins/cpuspeed   2019-03-01 02:06:07.000000000 +1100
+++ /etc/munin/plugins/cpuspeed 2019-03-12 12:25:17.239713453 +1100
@@ -141,7 +141,7 @@
         print_warning "cpu$N"
         print_critical "cpu$N"
 
-    done
+    done | sort -V
     if [ "${MUNIN_CAP_DIRTYCONFIG:-0}" != 1 ]; then exit 0; fi
 fi
 


There are probably several other plugins that would benefit from adding "sort
-V" - anything likely to have 10 or more similar values (e.g. there's a 9 year
old ticket http://munin-monitoring.org/ticket/919 reporting the same issue
with network interfaces).  Please forward this upstream.

e.g. on my 1950x threadripper (16 core/32 thread) system, i was getting:

# munin-run cpuspeed
cpu0.value 284378906000
cpu1.value 284676376000
cpu10.value 286158358000
cpu11.value 285770772000
cpu12.value 286035834000
cpu13.value 286069598000
cpu14.value 286123850000
cpu15.value 286026202000
cpu16.value 284606020000
cpu17.value 284633320000
cpu18.value 284625240000
cpu19.value 284638744000
cpu2.value 284703898000
cpu20.value 285276808000
cpu21.value 285240678000
cpu22.value 284850692000
cpu23.value 285244496000
cpu24.value 286126160000
cpu25.value 286147946000
cpu26.value 286171272000
cpu27.value 286062250000
cpu28.value 286091928000
cpu29.value 286104400000
cpu3.value 284666958000
cpu30.value 286057878000
cpu31.value 286207444000
cpu4.value 286922096000
cpu5.value 286545698000
cpu6.value 286363752000
cpu7.value 286276020000
cpu8.value 286119812000
cpu9.value 286037900000


Now I'm getting this, so the graphs on my munin web page are properly sorted:

cpu0.value 284391408000
cpu1.value 284688894000
cpu2.value 284716416000
cpu3.value 284679476000
cpu4.value 286934664000
cpu5.value 286558216000
cpu6.value 286376270000
cpu7.value 286288580000
cpu8.value 286132378000
cpu9.value 286050418000
cpu10.value 286170884000
cpu11.value 285783268000
cpu12.value 286048376000
cpu13.value 286082230000
cpu14.value 286136368000
cpu15.value 286038780000
cpu16.value 284618538000
cpu17.value 284645838000
cpu18.value 284637736000
cpu19.value 284651262000
cpu20.value 285289428000
cpu21.value 285253196000
cpu22.value 284863188000
cpu23.value 285257014000
cpu24.value 286138678000
cpu25.value 286160610000
cpu26.value 286183790000
cpu27.value 286074776000
cpu28.value 286104446000
cpu29.value 286116918000
cpu30.value 286070438000
cpu31.value 286219946000



thanks,

craig

--
craig sanders <c...@taz.net.au>

Reply via email to