zabbix安装部署

    xiaoxiao2026-05-07  1

    zabbix是经常在运维的工作中会经常用到的一个软件,下面简单的介绍下安装部署以及设置报警的过程。下面简单的介绍下操作过程。 环境介绍:zabbix-server :192.168.10.185  zabbix-agent:192.168.10.113 1、zabbix的安装 zabbix的安装需要的是lnmp(lamp)环境,在这之前需要安装好。我这里有一个lnmp的安装的脚本。这个自己安装(顺序  mysql-php-nginx)。 2、zabbix的安装 安装之前解决掉相关的依赖 yum install net-snmp-devel libxml2-devel libcurl-devel 我下载的是zabbix-2.2.14.tar.gz版本 tar -zxvf zabbix-2.2.14.tar.gz [root@node3 src]# cd zabbix-2.2.14 [root@node3 src]# ./configure --prefix=/usr/local/zabbix-2.2.2/ --enable-server \ --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 make && make install 3、安装完成之后进行相关的配置 [root@node3 core]# cd /usr/local/src/zabbix-2.2.14/misc/init.d/fedora/core [root@node3 core]cp zabbix* /etc/init.d/ [root@node3 core]chmod +x zabbix.* 4、mysql设置 在mysql数据库中建立zabbix数据库,并且进行授权。 mysql>create database zabbix; mysql>grant all  on zabbix.* to zabbix@’192.168.10.185’ identified by ‘zabbix’; mysql>grant all  on zabbix.* to zabbix@’localhost’ identified by ‘zabbix’; mysql>flush privileges; 5、将zabbix的数据文件导入到zabbix数据库中 [root@node3 core]# cd /usr/local/src/zabbix-2.2.14/database/mysql/ [root@node3 core]mysql -uroot -p zabbix<schema.sql     [root@node3 core]mysql -uroot -p zabbix<images.sql [root@node3 core]mysql -uroot -p zabbix<data.sql 6、nginx配置  server {     listen       9090  default_server;     server_name  _;     return       444;     }     server {         listen       9090;         server_name  zabbix.***.com.cn;         #charset koi8-r;         access_log  /var/log/nginx_logs/***_zabbix.access.log  main;                 root   /***_data/***_web/***_zabbix2;         location / {             index  index.html index.shtml index.htm index.php;         }         location ~.*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp3|mp4|pdf|)$ {             expires 30d;             log_not_found off;             access_log off;         }         location ~.*\.(js|css)?$ {             expires 1d;             log_not_found off;             access_log off;         }         error_page  404  /404.html;         # redirect server error pages to the static page /50x.html         #         #error_page   500 502 503 504  http://www.***.com.cn/404.html;         error_page   500 502 503 504  /404.html;         #location = /50x.html {         #    root   /html;         #}         # proxy the PHP scripts to Apache listening on 127.0.0.1:80         #         #location ~ \.php$ {         #   proxy_pass   http://127.0.0.1;         #}         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000         #         location ~ \.php$ {             fastcgi_pass   127.0.0.1:9000;             fastcgi_index  index.php;             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;             include        fastcgi_params;         }         # deny access to .htaccess files, if Apache's document root         # concurs with nginx's one         #         location ~ /\.ht {             deny  all;         }     } 而后将zabbix的网页内容拷贝到nginx的文件目录下面 [root@node3 vhost]# cp /usr/local/src/zabbix-2.2.14/frontends/php/*  /网站目录(nginx的root部分的目录) 7、配置php,编辑php.ini文件 max_execution_time = 300  memory_limit = 128M  post_max_size = 16M  upload_max_filesize = 2M  max_input_time = 300  date.timezone PRC 将上面的值进行修改。 8、配置zabbix_server LogFile=/tmp/zabbix_server.log DBHost=192.168.10.185 DBName=zabbix DBUser=zabbix DBPassword=zabbix 对上面的内容根据数据库的设置进行设置。 9在web界面进行zabbix的安装,如果在安装的后面提示没有zabbix.conf.php这个文件的话,在网页目录的conf文件下面有这个文件的example文件,可以进行名字的更改即可。 文件的内容是数据库的连接选项,也可以进行手动的修改。 OK,安装完成,下面就可以进行登陆了。(第一次登陆的时候,默认的用户名是admin密码是zabbix)
    转载请注明原文地址: https://ju.6miu.com/read-1309450.html
    最新回复(0)