這篇文章主要為大家展示了“puppet中nagios客戶端模塊的示例分析”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“puppet中nagios客戶端模塊的示例分析”這篇文章吧。
創(chuàng)新互聯(lián)專注于企業(yè)營銷型網(wǎng)站、網(wǎng)站重做改版、密山網(wǎng)站定制設計、自適應品牌網(wǎng)站建設、html5、購物商城網(wǎng)站建設、集團公司官網(wǎng)建設、成都外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應式網(wǎng)頁設計等建站業(yè)務,價格優(yōu)惠性價比高,為密山等各大城市提供網(wǎng)站開發(fā)制作服務。
為了方便與puppet結合著用,所以接下去原本用源碼編譯的,統(tǒng)統(tǒng)改成用rpmbuild打包完,在放進自己建的源里面,本文也將說明本地源如何創(chuàng)建。
文中軟件包nrpe,和nagios-plugins均由上篇文章的spec生成。
老規(guī)矩,先上架構圖(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的內(nèi)容
5,site.pp
######################## for module nagios ######################## $nagios_server = "192.168.10.211"
設置了nagios_server變量的值
6,node調(diào)用
(1),modules.pp
import "nagios"
(2),site.pp
node /^redis\.\w+\.com$/ { include nagios::web }
當然也可以寫進nodes.pp里面設置的節(jié)點里
7,創(chuàng)建本地源
我使用的是ftp來做
(1)yum install vsftpd -y (2)yum install createrep -y
然后把nrpe,nagios-plugins軟件包復制到/var/ftp/pub下,生成依賴關系
createrepo /var/ftp/pub
創(chuàng)建ftp.repo
[ftp] name=base baseurl=ftp://192.168.10.211/pub enabled=1 gpgcheck=0
最后在
yum makecache
別忘了防火墻開啟ftp端口
以上是“puppet中nagios客戶端模塊的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學習更多知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道!