当前位置:首页>编程日记>正文

ubuntu 14.10安装zabbix(lnmp环境)


   今天折腾了好一阵,终于在lnmp环境下装好了zabbix。激动的我眼泪都流出来几滴,总结一下碰到的问题

安装 lnmp环境和zabbix的过程我就不多说,网上很多,我就是参照:

https://github.com/itnihao/zabbix-book/blob/master/03-chapter/zabbix_install_on_ubuntu.md

不过上面介绍的是lamp环境下安装zabbix。其实也没差多少,就是将apache换成nginx(为apt-get安装)。但问题往往就出现在这里。

在上面安装步骤中,有一步是拷贝配置文件到apache的site-enable目录夹下,指令为:


#sudo cp /usr/share/doc/zabbix-frontend-php/examples/apache.conf /etc/apache2/sites-enabled/apache.conf


由于我这边是nginx当然就不能这么操作了。索性我发现在examples目录下还有一个nginx.conf文件,内容如下



location /zabbix {if ($scheme ~ ^http:){rewrite ^(.*)$  https://$host$1 permanent;}alias                   /usr/share/zabbix;index                   index.php;error_page              403 404 502 503 504  /zabbix/index.php;location ~ .php$ {if (!-f $request_filename) { return 404; }expires                 epoch;include                 /etc/nginx/fastcgi_params;fastcgi_index   index.php;fastcgi_pass    unix:/var/run/php5-fpm.sock;}location ~ .(jpg|jpeg|gif|png|ico)$ {access_log      off;expires         33d;}
}


然后我就将这段内容复制粘贴到了/etc/nginx/sites-enabled/default的server中去:



server {listen 80 default_server;
#       listen [::]:80 default_server ipv6only=on;index index.html index.htm index.php;# Make site accessible from http://localhost/         server_name localhost;location / {root /usr/share/nginx/html;try_files $uri $uri/ =404;}location ~ .php$ {fastcgi_split_path_info ^(.+.php)(/.+)$;fastcgi_pass unix:/var/run/php5-fpm.sock;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;include fastcgi_params;}location /zabbix {if ($scheme ~ ^http:){rewrite ^(.*)$  https://$host$1 permanent;}alias                   /usr/share/zabbix;index                   index.php;error_page              403 404 502 503 504  /zabbix/index.php;location ~ .php$ {if (!-f $request_filename) { return 404; }expires                 epoch;include                 /etc/nginx/fastcgi_params;fastcgi_index   index.php;<span style="color:#FF0000;">fastcgi_param  SCRIPT_FILENAME       /usr/share$fastcgi_script_name;</span>fastcgi_pass    unix:/var/run/php5-fpm.sock;}location ~ .(jpg|jpeg|gif|png|ico)$ {access_log      off;expires         33d;}}
}



尤其注意红色部分,是原配置中没有的,而且通过apt-get安装了zabbix-frontend-php之后,网页文件全部都放在/usr/share/zabbix下。不然的话当你通过网页访问zabbix的时候,将会看到一片雪白,或者404。今天大部分时间都是栽这里

了,要谨慎。



此外还有可能碰到的一个问题就是连不上mysql。可以对比一下my.cnf和zabbix_server.conf文件中关于mysqld.soct文件的位置是否一致。

在zabbix_server.conf中默认的位置为:


DBSocket=/var/run/mysqld/mysqld.sock



my.cnf中为:



[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock



改成一样就行了。


最后还有要注意的就是/etc/service文件。刚开始的时候使用netstat -ltnp | grep :10051 总是监控不到动静,后来想起在lamp下搭建zabbix的时候需要将

zabbix-agent     10050/tcp         # zabbix agent
zabbix-agent    10050/udp        # zabbux agent
zabbix-trapper    10051/tcp        # zabbix trapper
zabbix-trapper    10051/udp        # zabbix trapper



写到/etc/service文件中去,有的帖子上说,不加也没问题。官方文档上是默认添加的,而且这可能也是到时页面空白的原因之一。


http://www.coolblog.cn/news/cd03b0f316e3efa4.html

相关文章:

  • asp多表查询并显示_SpringBoot系列(五):SpringBoot整合Mybatis实现多表关联查询
  • s7day2学习记录
  • 【求锤得锤的故事】Redis锁从面试连环炮聊到神仙打架。
  • 矿Spring入门Demo
  • 拼音怎么写_老师:不会写的字用圈代替,看到孩子试卷,网友:人才
  • Linux 实时流量监测(iptraf中文图解)
  • Win10 + Python + GPU版MXNet + VS2015 + RTools + R配置
  • 美颜
  • shell访问php文件夹,Shell获取某目录下所有文件夹的名称
  • 如何优雅的实现 Spring Boot 接口参数加密解密?
  • LeCun亲授的深度学习入门课:从飞行器的发明到卷积神经网络
  • Mac原生Terminal快速登录ssh
  • java受保护的数据与_Javascript类定义语法,私有成员、受保护成员、静态成员等介绍...
  • mysql commit 机制_1024MySQL事物提交机制
  • 支撑微博千亿调用的轻量级RPC框架:Motan
  • jquery 使用小技巧
  • 2019-9
  • 法拉利虚拟学院2010 服务器,法拉利虚拟学院2010
  • vscode pylint 错误_将实际未错误的py库添加到pylint白名单
  • 科学计算工具NumPy(3):ndarray的元素处理
  • 工程师在工作电脑存 64G 不雅文件,被公司开除后索赔 41 万,结果…
  • linux批量创建用户和密码
  • newinsets用法java_Java XYPlot.setInsets方法代碼示例
  • js常用阻止冒泡事件
  • 气泡图在开源监控工具中的应用效果
  • 各类型土地利用图例_划重点!国土空间总体规划——土地利用
  • php 启动服务器监听
  • dubbo简单示例
  • 【设计模式】 模式PK:策略模式VS状态模式
  • [iptables]Redhat 7.2下使用iptables实现NAT
  • Ubuntu13.10:[3]如何开启SSH SERVER服务
  • CSS小技巧——CSS滚动条美化
  • JS实现-页面数据无限加载
  • 阿里巴巴分布式服务框架 Dubbo
  • 最新DOS大全
  • Django View(视图系统)
  • 阿里大鱼.net core 发送短信
  • 程序员入错行怎么办?
  • 两张超级大表join优化
  • 第九天函数
  • Linux软件安装-----apache安装
  • HDU 5988 最小费用流
  • Sorenson Capital:值得投资的 5 种 AI 技术
  • 《看透springmvc源码分析与实践》读书笔记一
  • 正式开课!如何学习相机模型与标定?(单目+双目+鱼眼+深度相机)
  • Arm芯片的新革命在缓缓上演
  • nagios自写插件—check_file
  • python3 错误 Max retries exceeded with url 解决方法
  • 行为模式之Template Method模式
  • 通过Spark进行ALS离线和Stream实时推荐