[p=30,2,center]学习资料:IT运维管理社区专家讲堂直播300期视频回放[p=30,2,center]
[p=30,2,center]
关于zabbix及相关服务软件版本Linux:centos6.6nginx:1.9.15MySQL:5.5.49PHP:5.5.35[url=][/url]安装nginx$yum-yinstallgccgcc-c++autoconfautomakezlibzlib-developensslopenssl-develpcre*makegd-devellibjpeg-devellibpng-devellibxml2-develbzip2-devellibcurl-devel$useraddnginx-s/sbin/nologin-M$wgetdownload/nginx-1.9.15.tar.gz&&tarxvfnginx-1.9.15.tar.gz&&cdnginx-1.9.15$./configure--prefix=/usr/local/product/nginx1.9.14--user=www--group=www--with-http_ssl_module--with-http_v2_module--with-http_stub_status_module--with-pcre$make&&makeinstall$ln-s/usr/local/product/nginx1.9.14/usr/local/nginx//创建软链接--with-http_stub_status_module:支持nginx状态查询--with-http_ssl_module:支持https--with-http_spdy_module:支持google的spdy,想了解请百度spdy,这个必须有ssl的支持--with-pcre:为了支持rewrite重写功能,必须制定pcre[url=][/url]安装PHP$wgetget/php-5.5.35.tar.gz/from/this/mirror$mvmirrorphp-5.5.35.tar.gz&&tarxvfphp-5.5.35.tar.gz&&cdphp-5.5.35$./configure--prefix=/usr/local/product/php-5.5.35--with-config-file-path=/usr/local/product/php-5.5.35/etc--with-bz2--with-curl--enable-ftp--enable-sockets--disable-ipv6--with-gd--with-jpeg-dir=/usr/local--with-png-dir=/usr/local--with-freetype-dir=/usr/local--enable-gd-native-ttf--with-iconv-dir=/usr/local--enable-mbstring--enable-calendar--with-gettext--with-libxml-dir=/usr/local--with-zlib--with-pdo-mysql=mysqlnd--with-mysqli=mysqlnd--with-mysql=mysqlnd--enable-dom--enable-xml--enable-fpm--with-libdir=lib64--enable-bcmath$make&&makeinstall$ln-s/usr/local/product/php-5.5.35/usr/local/php$cpphp.ini-production/usr/local/php/etc/php.ini$cd/usr/local/php/etc/$cpphp-fpm.conf.defaultphp-fpm.confmax_execution_time=300memory_limit=128Mpost_max_size=16Mupload_max_filesize=2Mmax_input_time=300date.timezone=PRC[url=][/url]安装MySQL$groupaddmysql$mkdir-pv/data/mysql$useradd-r-gmysql-d/data/mysql-s/sbin/nologinmysql$chown-Rmysql.mysql/data/mysql$yuminstallcmakegcc*ncurses-devel-y$wgetget/Downloads/MySQL-5.5/mysql-5.5.49.tar.gz$tar-xvfmysql-5.5.49.tar.gz&&cdmysql-5.5.49$cmake-DCMAKE_INSTALL_PREFIX=/usr/local/product/mysql5.5.49-DDEFAULT_CHARSET=utf8-DENABLED_LOCAL_INFILE=1-DMYSQL_DATADIR=/data/mysql-DWITH_EXTRA_CHARSETS=all-DWITH_READLINE=1-DWITH_INNOBASE_STORAGE_ENGINE=1-DMYSQL_TCP_PORT=3306-DDEFAULT_COLLATION=utf8_general_ci$make&&makeinstall$ln-s/usr/local/product/mysql5.5.49/usr/local/mysql$chown-Rmysql.mysql/usr/local/mysql$cd/usr/local/mysql/support-files/$cpmy-medium.cnf/data/mysql/my.cnf$cpmysql.server/etc/init.d/mysqld$chmod+x/etc/init.d/mysqld$cd/usr/local/mysql/scripts$./mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/data/mysql/datadir=/data/mysql/$/etc/init.d/mysqldstartmysql>createdatabasezabbixdefaultcharsetutf8;QueryOK,1rowaffected(0.00sec)mysql>grantallprivilegesonzabbix.*tozabbix@'localhost'identifiedby'zabbix';QueryOK,0rowsaffected(0.03sec)mysql>flushprivileges;QueryOK,0rowsaffected(0.00sec)$mysqlERROR2002(HY000):Can'tconnecttolocalMySQLserverthroughsocket'/var/lib/mysql/mysql.sock'(2)解决办法:$ln-s/tmp/mysql.sock/var/lib/mysql/$mysqladmin-urootpassword"zabbix"[url=][/url]安装zabbixserver$wgetprojects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz$tarzxfzabbix-3.0.3.tar.gz&&cdzabbix-3.0.3$./configure--prefix=/usr/local/zabbix-3.0.3/--enable-server--enable-agent--with-mysql--with-net-snmp--with-libcurl--with-libxml2$make&&makeinstall故障1:checkingformysql_config...noconfigure:error:MySQLlibrarynotfound解决:$yuminstallmysql-devel-y故障2:checkingfornet-snmp-config...noconfigure:error:InvalidNet-SNMPdirectory-unabletofindnet-snmp-config解决:$yuminstallnet-snmp-devel-y$groupaddzabbix$useraddzabbix-s/sbin/nologin-M-gzabbix$mysql-uroot-pzabbixzabbix<database/mysql/schema.sql$mysql-uroot-pzabbixzabbix<database/mysql/images.sql$mysql-uroot-pzabbixzabbix<database/mysql/data.sql[url=][/url]zabbix管理网站配置(nginx)$mkdir/data/web/-p$mkdir/data/logs/zabbix-p$cp-rpfrontends/php/*/data/web//$pwd/usr/local/nginx/conf$cdextra/$vimzabbix.confserver{listen16888;server_name[/url];access_log/data/logs/zabbix/zabbix.lifec.com.access.logmain;indexindex.htmlindex.phpindex.html;root/data/web/zabbix.lifec.com;location/{try_files$uri$uri//index.php?$args;}location~^(.+.php)(.*)${fastcgi_split_path_info^(.+.php)(.*)$;includefastcgi.conf;fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_paramPATH_INFO$fastcgi_path_info;}}$vimnginx.confusernginx;worker_processes1;#error_loglogs/error.logwarning;#error_loglogs/error.lognotice;#error_loglogs/error.loginfo;pidlogs/nginx.pid;events{worker_connections1024;}http{includemime.types;default_typeapplication/octet-stream;log_formatmain'$remote_addr-$remote_user[$time_local]"$request"''$status$body_bytes_sent"$http_referer"''"$http_user_agent""$http_x_forwarded_for"';access_loglogs/access.logmain;sendfileon;#tcp_nopushon;#keepalive_timeout0;keepalive_timeout65;#gzipon;includeextra/*.conf;}$vimetc/zabbix_server.confLogFile=/tmp/zabbix_server.logPidFile=/tmp/zabbix_server.pidDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=zabbix[url=]启动服务$/usr/local/nginx/sbin/nginx$/usr/local/php/sbin/php-fpm$/usr/local/zabbix-3.0.3/sbin/zabbix_server如果启动的时候报错:$/usr/local/zabbix-3.0.2/sbin/zabbix_server/usr/local/zabbix-3.0.2/sbin/zabbix_server:errorwhileloa**sharedlibraries:libmysqlclient.so.18:cannotopensharedobjectfile:Nosuchfileordirectory$ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib64/10.0.0.1[/url]$echo"/usr/local/nginx/sbin/nginx">>/etc/rc.local$echo"/usr/local/php/sbin/php-fpm">>/etc/rc.local$echo"/etc/init.d/mysqldstart">>/etc/rc.local$echo"/usr/local/zabbix-3.0.3/sbin/zabbix_server">>/etc/rc.local[url=]web端配置zabbix浏览器安装:[url=]http://10.0.0.1:16888[/url]
需要下载文件,上传到指定的服务器目录中并修改属组
$pwd/data/web//conf$chown1000:1000zabbix.conf.php
$vim/data/web//include/locales.inc.php'zh_CN'=>['name'=>_('Chinese(zh_CN)'),'display'=>true],$unzipyaheiFont_CHS.zip//文件在git的fonts目录里$rzmsyh.ttf$cd/data/web//fonts$mvDejaVuSans.ttfDejaVuSans_bak$mvmsyh.ttfDejaVuSans.ttf$chown1000:1000DejaVuSans.ttf//重启服务即可[url=][/url]zabbix-agent安装$rpm-Uvhzabbix/3.....3-1.el6.x86_64.rpmerror:Faileddependencies:libodbc.so.2()(64bit)isneededbyzabbix-agent-3.0.3-1.el6.x86_64解决办法:$yum-yinstallunixODBC$vim/etc/zabbix/zabbix_agentd.confPidFile=/var/run/zabbix/zabbix_agentd.pidLogFile=/var/log/zabbix/zabbix_agentd.logLogFileSize=0Server=10.0.0.1ServerActive=10.0.0.1Hostname=8.8.8.8Include=/etc/zabbix/zabbix_agentd.d/[url=][/url]自动注册和自动发现区别
- 自动发现:
适用于提供相同服务的Server群组,因为自动发现是批量添加DiscoveryHost的,你可以让所有主机链接同一个模板,并且让他们提供相同的服务。没错,如果你学过Shell,并且能写出批量部署服务的脚本,那么这个自动发现再适合你不过了。 - 自动注册:
自动注册呢,它是比较灵活的,根据HostMetadata的value来匹配规则,并且通过不同的值来执行不同的操作。
也就是说,如果是普通Server,你只要把value设置为Linux,并且让它链接普通的模板
如果是MysqlServer,你可以把value设置为Mysql,并且让它链接Mysql和普通的模板。
自动发现
ii.端口自动发现
$cat/etc/zabbix/zabbix_scripts/dport_check.d/tes.conf127.0.0.1:12066:docker_tes//#IP:#PORT:#DESC
|