您好,登錄后才能下訂單哦!
這篇文章主要為大家展示了“puppet中nagios客戶端模塊的示例分析”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“puppet中nagios客戶端模塊的示例分析”這篇文章吧。
為了方便與puppet結合著用,所以接下去原本用源碼編譯的,統統改成用rpmbuild打包完,在放進自己建的源里面,本文也將說明本地源如何創建。
文中軟件包nrpe,和nagios-plugins均由上篇文章的spec生成。
老規矩,先上架構圖(ps:其實都差不多- -):
1.init.pp
import "*"
2.web.pp
class nagios::web ( $nagiospluginsversion="1.4.16-10", $nrpeversion="2.13-10" ){ file {"sa": path => "/root/sa", ensure => directory, } package {"xinetd": ensure => present, } package {"nagios-plugins": ensure => $nagiospluginsversion, } package {"nrpe": ensure => $nrpeversion, require => Package["nagios-plugins"], } file {"nrpe.cfg": mode => 0644, owner => nagios, group => nagios, path => "/usr/local/nagios/etc/nrpe.cfg", require => Package["nrpe"], content => template('nagios/web-nrpe.erb'), notify => Service['xinetd'], } file {"nrpe": mode => 0644, owner => root, group => root, path => "/etc/xinetd.d/nrpe", content => template('nagios/nrpe.erb'), require => Package["nrpe"], notify => Service['xinetd'], } service {"xinetd": ensure => running, enable => true, subscribe => File["nrpe","nrpe.cfg"], } }
3,nrpe.erb
# default: on # description: NRPE (Nagios Remote Plugin Executor) service nrpe { flags = REUSE socket_type = stream port = 5666 wait = no user = nagios group = nagios server = /usr/local/nagios/bin/nrpe server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd log_on_failure += USERID disable = no only_from = 127.0.0.1 <%= nagios_server %> }
4,nrpe-web.erb
里面就是源碼編譯出來的nrpe.cfg的內容
5,site.pp
######################## for module nagios ######################## $nagios_server = "192.168.10.211"
設置了nagios_server變量的值
6,node調用
(1),modules.pp
import "nagios"
(2),site.pp
node /^redis\.\w+\.com$/ { include nagios::web }
當然也可以寫進nodes.pp里面設置的節點里
7,創建本地源
我使用的是ftp來做
(1)yum install vsftpd -y (2)yum install createrep -y
然后把nrpe,nagios-plugins軟件包復制到/var/ftp/pub下,生成依賴關系
createrepo /var/ftp/pub
創建ftp.repo
[ftp] name=base baseurl=ftp://192.168.10.211/pub enabled=1 gpgcheck=0
最后在
yum makecache
別忘了防火墻開啟ftp端口
以上是“puppet中nagios客戶端模塊的示例分析”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。