Talk:Plugin:Exec

From collectd Wiki
Jump to: navigation, search

Suggested new script template. This should make it better at behaving like the builtin plugins but adds a few lines of complexity which might note be desirable for an example.

 HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
 INTERVAL="${COLLECTD_INTERVAL:-60}"
 
 measure() {
   echo "PUTVAL \"$HOSTNAME/exec-magic/gauge-magic_level\" interval=$INTERVAL N:$VALUE"
 }
 
 measure
 while sleep "$INTERVAL"; do
   VALUE=do_magic()
   measure
 done
Personal tools
Namespaces

Variants
Actions
Navigation
Tools