Package: munin-plugins-core
Followup-For: Bug #863231
Control: retitle -1 Plugins "apt" and "apt_all" use state file with same name 
in different locations
Control: forwarded -1 https://github.com/munin-monitoring/munin/issues/1072

Hello,

ok - I took another look at the issue. Sadly it is a bit more
complicated :(

We have two different plugins: apt and apt_all.


They behave as follows:

= apt =
* default state file (defined in plugin code):
  /var/lib/munin-node/plugin-state/root/plugin-apt.state
* configuration in /etc/munin/plugin-conf.d/munin-node:
  [apt]
  user root

Result:
* the cron job uses the root/ state file
* the plugin uses the root/ state file


= apt_all =
* default state file (defined in plugin code):
  /var/lib/munin-node/plugin-state/nobody/plugin-apt.state
* no configuration in /etc/munin/plugin-conf.d/munin-node:

Result:
* the cron job uses the nobody/ state file
* the plugin uses the nobody/ state file


Thus both plugins can work on their own without a problem.
(even though the differing locations are a bit of a mess)

If both plugins are enabled, the cron job that we ship with
our package executes only the "apt_all" code (thus writing
to nobody/).


But this is not complicated enough - there is another detail! :)

Usage of the state files:
* apt:
    * cron job: check the age of its timestamp in order to run
      "apt-get update" from time to time
      A "timestamp" line is also written to the file - but no one
      reads it.
    * plugin: call "apt-get upgrade" and output the resulting values
      (the statefile is not used at all)
* apt_all:
    * cron job: update the state file if necessary: calculate the
      "value" statements (via "apt-get upgrade") for the plugin
      output and store these in the state file); afterwards
      "apt update" is called for updating the current set of known
      packages (bug: "apt-get update" should be called first)
    * plugin: update the state file (only if necessary due to its age)
      and afterwards just print its current content

Thus the differing locations of both plugins are currently a good
thing (by accident), since their content differs (arbitrary
timestamp line vs. wanted output of plugin).

The current behaviour seems to be:
* only "apt" plugin enabled: proper results
* only "apt_all" plugin enabled: proper results
* "apt" and "apt_all" enabled: proper results
  (the "apt_all update" causes the "apt-get update" call that the
  "apt" plugin requires)

Thus (based on a mixture of various unexpected details) both plugins
should currently work as intended.

But obviously these plugins leave lots of room for improvements,
clarifications and maybe merging/abandoning.

Thus retitling this bug with regard to the filename confusion.

I created an upstream issue:
  https://github.com/munin-monitoring/munin/issues/1072

Cheers,
Lars

Reply via email to