0

Debian 7 サーバー上の puppet を介して、標準の check_mk xinetd 構成ファイルを使用して check_mk エージェントをインストールしようとしています。

Check_mk は問題なくインストールされますが、xinetd 構成に問題があります。

puppet マスターのソース構成ファイルのポートを変更puppet agent -tし、クライアント ホストで実行すると、新しい構成は正しくデプロイされますが、システムが xinetd サービスの状態を認識できないため、puppet は xinetd サービスをリロードしません。

パペット マニフェストは次のようになります。

    class basic::check-mk {
case $operatingsystem {
  debian: {
         package {'check-mk-agent':
                 ensure => present,
                 }

         file    { '/etc/xinetd.d/check_mk':
                 notify => Service['xinetd'],
                 ensure => file,
                 source => 'puppet:///modules/basic/etc--xinetd--checkmk',
                 mode   => '0644',
                 }

         service { 'xinetd':
                 ensure  => running,
                 enable  => true,
                 restart => '/etc/init.d/xinetd reload',
                 }
          }
 }
}

デバッグは次のようになります。

    info: Applying configuration version '1464186485'
debug: /Stage[main]/Ntp::Config/notify: subscribes to Class[Ntp::Service]
debug: /Stage[main]/Ntp/Anchor[ntp::begin]/before: requires Class[Ntp::Install]
debug: /Stage[main]/basic::Check-mk/Service[xinetd]/subscribe: subscribes to File[/etc/xinetd.d/check_mk]
debug: /Stage[main]/Ntp::Install/before: requires Class[Ntp::Config]
debug: /Stage[main]/Ntp::Service/before: requires Anchor[ntp::end]
debug: /Schedule[daily]: Skipping device resources because running on a host
debug: /Schedule[monthly]: Skipping device resources because running on a host
debug: /Schedule[hourly]: Skipping device resources because running on a host
debug: Prefetching apt resources for package
debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n''
debug: Puppet::Type::Package::ProviderApt: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n''
debug: /Schedule[never]: Skipping device resources because running on a host
debug: file_metadata supports formats: b64_zlib_yaml pson raw yaml; using pson
debug: /Stage[main]/basic::Check-mk/File[/etc/xinetd.d/check_mk]/content: Executing 'diff -u /etc/xinetd.d/check_mk /tmp/puppet-file20160525-10084-1vrr8zf-0'
notice: /Stage[main]/basic::Check-mk/File[/etc/xinetd.d/check_mk]/content:
--- /etc/xinetd.d/check_mk      2016-05-25 14:57:26.220873468 +0200
+++ /tmp/puppet-file20160525-10084-1vrr8zf-0    2016-05-25 16:28:06.393363702 +0200
@@ -25,7 +25,7 @@
 service check_mk
 {
         type           = UNLISTED
-        port           = 6556
+        port           = 6554
         socket_type    = stream
         protocol       = tcp
         wait           = no

debug: Finishing transaction 70294357735140
info: FileBucket got a duplicate file {md5}cb0264ad1863ee2b3749bd3621cdbdd0
info: /Stage[main]/basic::Check-mk/File[/etc/xinetd.d/check_mk]: Filebucketed /etc/xinetd.d/check_mk to puppet with sum cb0264ad1863ee2b3749bd3621cdbdd0
notice: /Stage[main]/basic::Check-mk/File[/etc/xinetd.d/check_mk]/content: content changed '{md5}cb0264ad1863ee2b3749bd3621cdbdd0' to '{md5}56ac5c1a50c298de4999649b27ef6277'
debug: /Stage[main]/basic::Check-mk/File[/etc/xinetd.d/check_mk]: The container Class[basic::Check-mk] will propagate my refresh event
info: /Stage[main]/basic::Check-mk/File[/etc/xinetd.d/check_mk]: Scheduling refresh of Service[xinetd]
debug: Service[ntp](provider=debian): Executing '/etc/init.d/ntp status'
debug: Service[xinetd](provider=debian): Executing '/etc/init.d/xinetd status'
debug: Service[xinetd](provider=debian): Executing '/etc/init.d/xinetd start'
notice: /Stage[main]/basic::Check-mk/Service[xinetd]/ensure: ensure changed 'stopped' to 'running'
debug: /Stage[main]/basic::Check-mk/Service[xinetd]: The container Class[basic::Check-mk] will propagate my refresh event
debug: Service[xinetd](provider=debian): Executing '/etc/init.d/xinetd status'
debug: /Stage[main]/basic::Check-mk/Service[xinetd]: Skipping restart; service is not running
notice: /Stage[main]/basic::Check-mk/Service[xinetd]: Triggered 'refresh' from 1 events
debug: /Stage[main]/basic::Check-mk/Service[xinetd]: The container Class[basic::Check-mk] will propagate my refresh event
debug: Class[basic::Check-mk]: The container Stage[main] will propagate my refresh event
debug: /Schedule[weekly]: Skipping device resources because running on a host
debug: /Schedule[puppet]: Skipping device resources because running on a host
debug: Finishing transaction 70294346109840
debug: Storing state
debug: Stored state in 0.01 seconds
notice: Finished catalog run in 1.43 seconds
debug: Executing '/etc/puppet/etckeeper-commit-post'
debug: report supports formats: b64_zlib_yaml pson raw yaml; using pson

次の行は私には疑わしいようです:

debug: /Stage[main]/basic::Check-mk/Service[xinetd]: Skipping restart; service is not running

service --status-all言う[ ? ] xinetd。システムがサービスの状態を認識しないのはなぜですか?

4

2 に答える 2

2

デバッグ ログと手動serviceコマンドの出力はxinetd、機能するサブコマンドがないことを示していますstatus。その結果、Puppet はその実行状態を管理する方法 (または管理するかどうか) を知りません。

サブコマンドを認識してLSB準拠の応答を行うようにinitscriptを修正することを検討できますstatus(または、サービスが実行されている場合は少なくともコード0で終了し、それ以外の場合はコード0で終了します)。statusまたは、リソースに属性を追加してService、Puppet がサービスの実行状態を確認するために使用できる代替コマンドを提供することもできます。(私は現在のドキュメントにリンクしServiceていますが、Puppet 2.7 のかなり前からその属性があったと確信しています。)

于 2016-05-25T16:12:38.757 に答える
1

解決済み:この問題を解決するには、xinetd の init.d スクリプトにステータス セクションを追加する必要がありました。その後service xinetd status、パペットはサービスの状態を認識することができました。追加されたセクションは次のようになります。

status)
    if pidof xinetd > /dev/null
    then
      echo "xinetd is running."
      exit 0
    else
      echo "xinetd is NOT running."
      exit 1
    fi
;;

さらに、Usage 行に status オプションを追加しました。

    *)
    echo "Usage: /etc/init.d/xinetd {start|stop|reload|force-reload|restart|status}"
    exit 1
    ;;

これで問題は解決しました。

于 2016-05-26T15:40:15.400 に答える