LoginSignup
2
1

More than 3 years have passed since last update.

CentOSにインストールしたmunin-updateが自動起動されないときの対処方法

Posted at

対象OS: CentOS 7.x以降

munin-updateは、パッケージインストール時にデフォルトで5分間隔で自動起動するよう設定されるはずだと思います。
パッケージのバグなのか仕様なのかわかりませんが、パッケージインストール時に自動起動設定されなかった場合の対処方を説明します。

私がこの現象に遭遇したのは、CentOS 8, munin-2.0.66-1です。

munin-updateはsystemd.timerが起動する

systemd配下で起動するサービスは、cronを使わずにsystemd.timerを使って自動起動させるものが多くなっています。
muninのパッケージに含まれている /usr/lib/systemd/system/munin.timer がその定義ファイルです。

/usr/lib/systemd/system/munin.timer
[Unit]
Description=Munin server to collect data from nodes
Documentation=man:munin-cron(8)

[Timer]
OnCalendar=*:00/5

[Install]
WantedBy=timers.target

/etc/cron.d/muninを作成するのは余り良くない

/etc/crond.d/muninを作成し自動起動設定すると説明している記事がありますが、muninのパッケージが正しくsystemd.timerの設定を行うようになったら、munin-updateが二重起動するようになってしまいます。

自動起動設定

systemd.timerにmuninパッケージが提供する設定ファイルを登録します。

# cd /etc/systemd/system/timers.target.wants
# ln -s /usr/lib/systemd/system/munin.timer .
# systemctl start munin.timer
# systemctl enable munin.timer

正しく設定できたかどうかを確認します。

# systemctl status munin.timer
● munin.timer - Munin server to collect data from nodes
   Loaded: loaded (/usr/lib/systemd/system/munin.timer; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2021-03-29 17:25:55 JST; 24min ago
  Trigger: n/a
     Docs: man:munin-cron(8)

 3月 29 17:25:55 hoge systemd[1]: Started Munin server to collect data from nodes.

system.timerの状態でも確認できます。

# systemctl -t timer
UNIT                         LOAD   ACTIVE SUB     DESCRIPTION
dnf-makecache.timer          loaded active waiting dnf makecache --timer
munin.timer                  loaded active waiting Munin server to collect data from nodes
systemd-tmpfiles-clean.timer loaded active waiting Daily Cleanup of Temporary Directories
unbound-anchor.timer         loaded active waiting daily update of the root trust anchor for DNSSEC

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

4 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

以上です。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1