Os:centos-6.6-x86_64 (Minimal) Puppet 3.7.3Zabbix 2.4puppet/zabbix Master:master/zabbix.redking.compuppet/zabbix Agent:agent1~5.redking.com
Puppet Installation
1. Server-side installation Puppet-server
Puppet is not in the basic CentOS source, need to join the official source provided by Puppetlabs, Puppet master server-side installation Puppet-server, automatically match the installation facter and other related dependent packages
[Email protected] ~]# RPM-IVH http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm[[ Email protected] ~]# yum install-y puppet-server[[email protected] ~]# chkconfig puppetmaster on[[email protected] ~]# SE Rvice puppetmaster Start
2. Client Installation Puppet
[Email protected] ~]# RPM-IVH http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm[[ Email protected] ~]# yum install-y puppet[[email protected] ~]# chkconfig puppet on[[email protected] ~]# service puppet Start
Puppet Master server Configuration
1. Configure automatic authentication
Allow hosts for all redking.com domains to issue certificates automatically. Create a autosign.conf file
[email protected] ~]# cat >/etc/puppet/autosign.conf <<EOF> *.redking.com> eof[[email protected] ~]#
Puppet Agent Client Configuration
1. Modify the client Master Profile puppet.conf to increase the listener and the specified service-side domain name
[[email protected] ~]# vim/etc/puppet/puppet.conf [agent] Listen = True Server = master.redking.com
650) this.width=650; "title=" clipboard "style=" border-right-width:0px;background-image:none;border-bottom-width:0 px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" Clipboard "src=" Http://s3.51cto.com/wyfs02/M00/58/B7/wKioL1S5dtPiKSW1AALmZvET0j4695.jpg "width=" 644 "height=" 428 " />
Puppet test
This way we can use Puppet to manage the Puppet, manage all puppet clients by configuring puppet modules, and apply the configuration file to all servers.
The client needs to make a request to the server to have the server manage the clients. This is actually a process of issuing a certificate. The first time you run the puppet client, an SSL certificate is generated and assigned to the puppet server, and if you agree to manage the client, the certificate will be issued and the certificate can be issued with this command, since we have set the server address on the client. So you don't need to address the server.
[Email protected] ~]# puppet agent--test
650) this.width=650; "title=" clipboard[1] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[1" "src=" http://s3.51cto.com/wyfs02/M00/58/BA/wKiom1S5dgWgTscNAAFHVcFCDsQ757.jpg "width = "644" height= "/>"
To learn more about the process of registering and troubleshooting later, you can add parameters
–no-daemonize Foreground output Log
–verbose Enter a more detailed log
–debug more detailed log, when troubleshooting the use of
–test indicates the test, with a –test parameter can be
[[Email protected] ~]# puppet agent--no-daemonize--onetime--verbose--debug
Service-side View Certificate issuance information
[Email protected] ~]# Puppet cert list--all
650) this.width=650; "title=" clipboard[2] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[2" "src=" http://s3.51cto.com/wyfs02/M01/58/BA/wKiom1S5dgXzTwkFAAG2tpaXkQU031.jpg "width = "644" height= "158"/>
Zabbix Server Installation
1. Configure the software repository and install Zabbix
[Email protected] ~]# RPM-IVH http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm [email protected] ~]# Yum install-y zabbix-server-mysql zabbix-web-mysql mysql-server
Create a Web server Apache virtual host profile by default by creating Zabbix running users and groups.
2. Create the database and import the data table
[Email protected] ~]# RPM-IVH http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm [[email protected] ~]# Yum install-y zabbix-server-mysql zabbix-web-mysql mysql-server[[email protected] ~]# service MYSQ LD Start[[email protected] ~]# chkconfig mysqld on[[email protected] ~]# mysqladmin-u root password ' 123456 ' [[Email Prote CTED] ~]# mysql-uroot-p123456mysql> CREATE database Zabbix character Set utf8;mysql> grant all privileges on Zabbi x.* to [e-mail protected] identified by ' Zabbix ';mysql> flush privileges;
Enter the Zabbix database file directory to import the database information
[Email protected] ~]# cd/usr/share/doc/zabbix-server-mysql-2.4.3/create/[[email protected] create]# mysql-uroot- p123456 Zabbix < Schema.sql[[email protected] create]# mysql-uroot-p123456 Zabbix < images.sql[[email protected] C reate]# mysql-uroot-p123456 Zabbix < Data.sql
3. Modify Zabbix profile configuration database related information
[Email protected] ~]# vim/etc/zabbix/zabbix_server.confdbhost=localhostdbname=zabbixdbuser=zabbixdbpassword= Zabbix
4. Set the default time zone for PHP
[Email protected] ~]# Vim/etc/php.inidate.timezone = PRC
5. Start Zabbix and Apache services
[[Email protected] ~]# service zabbix-server start[[email protected] ~]# chkconfig zabbix-server on[[email protected] ~]# Service httpd Start[[email protected] ~]# chkconfig httpd on
6. Set Zabbix
Zabbix Installation page: http://zabbix.redking.com/zabbix/setup.php
650) this.width=650; "title=" clipboard[3] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[3" "src=" http://s3.51cto.com/wyfs02/M02/58/BA/wKiom1S5dgbSa4LaAAHs0R_sjvc577.jpg "width = "644" height= "478"/>
650) this.width=650; "title=" clipboard[4] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[4" "src=" http://s3.51cto.com/wyfs02/M00/58/BA/wKiom1S5dgezYB6GAAGnehMNBAA173.jpg "width = "644" height= "478"/>
Zabbix Background interface
650) this.width=650; "title=" clipboard[5] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[5" "src=" http://s3.51cto.com/wyfs02/M01/58/B7/wKioL1S5dtaxdUkNAAGC-V7u34w845.jpg "width = "644" height= "222"/>
Writing Zabbix Modules
1. Create a Module catalog
[[email protected] ~]# mkdir-p/etc/puppet/modules/zabbix/{manifests,templates}
2. Create a manifests file
The server side holds all the configuration code for the client server, which is called manifest in puppet. After the client downloads manifest, the server can be configured according to manifest, such as package management, user management, file management, and so on.
The Zabbix agent uses the official software source, the client configuration file is template-based file download, because the client needs to specify Zabbix Server, so the configuration file is passed by variables, and finally use "-" to specify the dependency order between resources.
[[email protected] ~]# Vim/etc/puppet/modules/zabbix/manifests/init.ppclass Zabbix {package {' zabbix-agent ': Ensure =& Gt Installed,require = yumrepo["Zabbix"],}yumrepo {' Zabbix ': BaseURL = "http://repo.zabbix.com/zabbix/2.4/rhel/ \ $releasever/\ $basearch/", DESCR =" Zabbix official Repository ", enabled + 1,gpgcheck = 0,}file {'/etc/zabbix /zabbix_agentd.conf ': content = Template ("Zabbix/zabbix_agentd_conf.erb"), ensure = file,}service {' Zabbix-agent ': ensure = "Running", Hasstatus = true,enable = True,subscribe = [file[]/etc/zabbix/zabbix_ Agentd.conf "]],}package [" Zabbix-agent "], File ["/etc/zabbix/zabbix_agentd.conf "], service [" Zabbix-agent "] }
3. Create a template file
[Email protected] ~]# vim/etc/puppet/modules/zabbix/templates/zabbix_agentd_conf.erbpidfile=/var/run/zabbix/ zabbix_agentd.pidlogfile=/var/log/zabbix/zabbix_agentd.logenableremotecommands=1logremotecommands=1server=< %= zabbix_server%>hostname=<%= FQDN%>listenip=<%= ipaddress%>include=/etc/zabbix/zabbix_agentd.d/
4. Create a node file
[Email protected] ~]# mkdir/etc/puppet/manifests/nodes[[email protected] ~]# vim/etc/puppet/manifests/nodes/ Agentgroup.ppnode/^agent\d+\.redking\.com$/{$zabbix _server = "zabbix.redking.com" include Zabbix}
5. Modify SITE.PP to load the test node into puppet
[Email protected] ~]# vim/etc/puppet/manifests/site.pppackage {allow_virtual = True,}import "nodes/agentgroup.pp "
Node agent.redking.com test
[Email protected] ~]# puppet agent--test
650) this.width=650; "title=" clipboard[6] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[6" "src=" http://s3.51cto.com/wyfs02/M02/58/B7/wKioL1S5dtfxn1dWAAJBDfbA9Hw295.jpg "width = "644" height= "348"/>
The client has automatically installed zabbix-agent and turned on the service.
Zabbix Web Interface Testing
Set Discovery Rules
650) this.width=650; "title=" clipboard[7] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[7" "src=" http://s3.51cto.com/wyfs02/M00/58/B7/wKioL1S5dtfig3OMAAE-3-vJl0I025.jpg "width = "644" height= "197"/>
Set up actions
650) this.width=650; "title=" clipboard[8] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[8" "src=" http://s3.51cto.com/wyfs02/M01/58/B7/wKioL1S5dtiQu2RxAAFf2-sSDQc991.jpg "width = "644" height= "224"/>
650) this.width=650; "title=" clipboard[9] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[9" "src=" http://s3.51cto.com/wyfs02/M02/58/B7/wKioL1S5dtii3a7-AAHmEvzGiZg654.jpg "width = "644" height= "345"/>
Monitoring interface
650) this.width=650; "title=" clipboard[10] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[10" "src=" http://s3.51cto.com/wyfs02/M02/58/BA/wKiom1S5dgqgX_9lAAFqxSkv_Pw609.jpg " Width= "644" height= "304"/>
650) this.width=650; "title=" clipboard[11] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[11" "src=" http://s3.51cto.com/wyfs02/M00/58/BA/wKiom1S5dgvBL_WQAAIDSK1x-bA724.jpg " Width= "644" height= "329"/>
650) this.width=650; "title=" clipboard[12] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[12" "src=" http://s3.51cto.com/wyfs02/M02/58/B7/wKioL1S5dtrRFKjTAAHAf5pfOl4335.jpg " Width= "644" height= "/>"
650) this.width=650; "title=" clipboard[13] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[13" "src=" http://s3.51cto.com/wyfs02/M01/58/BA/wKiom1S5dgyzG55aAAHIFiWseog046.jpg " Width= "644" height= "309"/>
650) this.width=650; "title=" clipboard[14] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[14" "src=" http://s3.51cto.com/wyfs02/M02/58/BA/wKiom1S5dg2Q3rB0AAIBo-wpHYE845.jpg " Width= "644" height= "337"/>
650) this.width=650; "title=" clipboard[15] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[15" "src=" http://s3.51cto.com/wyfs02/M00/58/BA/wKiom1S5dg6CsMUoAAHf9DepMQU221.jpg " Width= "644" height= "373"/>
650) this.width=650; "title=" clipboard[16] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clipboard[16" "src=" http://s3.51cto.com/wyfs02/M01/58/BA/wKiom1S5dg7RVgV1AAFMudvg5UI573.jpg " Width= "644" height= "/>"
650) this.width=650; "title=" clipboard[17] "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt = "clipboard[17]" src= "http://s3.51cto.com/wyfs02/M02/58/BA/wKiom1S5dg-x2GhuAAH07CUxIgQ622.jpg" width= "644" height = "333"/>
==================================end=============================
This article is from the "Queen de tech blog" blog, so be sure to keep this source http://redking.blog.51cto.com/27212/1604984
centos6.6+puppet3.7.3 distributed Deployment Zabbix2.4 Monitoring System