您好,登录后才能下订单哦!
这篇文章主要为大家展示了“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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。