海运的博客

Cacti安装Email报警监控插件

发布时间:May 11, 2012 // 分类:Cacti // No Comments

Cacti安装请参考:Centos服务器安装cacti中文版
Cacti安装插件支持请参考:cacti中文版安装插件支持
安装settings、thold、monitor插件:

#https://www.haiyun.me
cd /home/wwwroot/cacti
wget -O settings-v0.7-1.tgz http://docs.cacti.net/_media/plugin:settings-v0.7-1.tgz
tar zxvf settings-v0.7-1.tgz 
mv settings plugins/
wget http://docs.cacti.net/_media/thold-v0.4.9-3.tgz
wget -O thold-v0.4.9.3.tgz http://docs.cacti.net/_media/plugin:thold-v0.4.9-3.tgz
tar zxvf thold-v0.4.9.3.tgz 
mv thold plugins
wget -O monitor-v1.31.tgz http://docs.cacti.net/_media/plugin:monitor-v1.3-1.tgz
tar zxvf monitor-v1.31.tgz 
mv monitor plugins

编辑Cacti配置文件:

vim include/global.php 

在$plugins = array();下方添加:

$plugins[] = thold;
$plugins[] = settings;
$plugins[] = monitor; 

登录web界面——插件管理——安装并启用相应插件。
cacti插件安装.png
Cacti发送邮件方式设置,本例以smtp方式,设置——MAIL/DNS
cacti发送邮件设置.png
Cacti报警配置,设置——Thresholds :
cacti报警设置.png
添加监控报警,Management——Thresholds——添加:
cacti添加监控报警.png

Cacti中文版安装插件支持

发布时间:May 11, 2012 // 分类:Cacti // No Comments

Cacti默认安装后不支持插件,需打一个补丁PA,即:Plugin Architecture,Cacti中文版安装请参考:Centos服务器安装Cacti中文版
注:最新版Cacti已整合PA,安装插件更方便。
PA安装:

cd /home/wwwroot/cacti
wget http://blogimg.chinaunix.net/blog/upfile2/090818213852.gz
gzip -d 090818213852.gz
patch -p1 -N < 090818213852

如果Cacti以二级目录的形式www.haiyun.me/cact,需修改:

vim include/global.php

修改url目录为二级目录:

$config['url_path'] = '/cacti/'; 

导入PA数据库:

mysql -u root -p cacti < pa.sql #cacti为cacti数据库名称

为用户添加插件管理权限,Cacti管理界面——用户管理——Admin,添加插件管理。
cacti用户添加插件管理权限.png

Nginx自定义404错误页面

发布时间:May 9, 2012 // 分类:Nginx // No Comments

编辑Nginx配置文件,在server段添加:

listen 80;
         root  /home/wwwroot/www.haiyun.me;
         error_page 404  /404.html;  

也可同时定义多个错误状态:

error_page 404 502 403  /404.html;  

还可以更改错误状态码:

error_page 404  =200 /404.html;  

如果错误页面是php程序:

error_page 404 = /404.php;  

404页面最好不要超过512字节,IE浏览器会转向其默认错误页面。

用Curl调试web服务器

发布时间:May 9, 2012 // 分类:常用软件 // No Comments

Curl是款功能很强大的www客户端,之前介绍过用curl上传下载FTP文件,本次记录下curl用于调试web服务器常用的命令。
1.获取服务器head信息:

curl -I https://www.haiyun.me

2.测试服务器网页压缩,如返回乱码即压缩。

curl  -H  "Accept-Encoding: gzip" https://www.haiyun.me

3.查看请求及返回head信息,如服务器支持压缩会返回Content-Encoding: gzip。

curl -v -I -H  "Accept-Encoding: gzip" https://www.haiyun.me

4.测试服务器虚拟主机:

curl -L -H "Host: www.haiyun.me" http://192.168.1.2/

5.测试HTTP性能:

curl -so /dev/null -w "%{time_namelookup} %{time_connect} %{time_redirect} %{time_pretransfer} \
%{time_starttransfer} %{time_total}\n" www.haiyun.me

6.测试服务器KeepAlive:

curl -v -I -H "Keep-Alive: 60" -H "Connection: keep-alive" www.haiyun.me www.haiyun.me

7.测试Proxy:

curl -I --proxy 192.168.1.1:7070 www.haiyun.me
curl -I --socks5 192.168.1.1:7070 www.haiyun.me

8.指定域名对应ip地址,相对于host支持https sni。

curl --resolve www.haiyun.me:443:1.2.3.4 https://www.haiyun.me/

Nginx编译安装more_set_headers模块自定义head头信息

发布时间:May 9, 2012 // 分类:Nginx // No Comments

通过服务器的head头可以得到服务器的很多信息,这给服务器安全带来很大隐患,如:

curl -I https://www.haiyun.me
HTTP/1.1 301 Moved Permanently
Server: nginx/1.0.15
Date: Fri, 10 Feb 2012 10:43:42 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.2.17p1
location: forum.php

Nginx可以编译添加第三方模块more_set_headers来自定义或清除相关head信息。

cd /usr/local/src/
wget http://nginx.org/download/nginx-1.0.15.tar.gz
tar zxvf nginx-1.0.15.tar.gz
cd nginx-1.0.15
wget -O header.zip --no-check-certificate https://github.com/agentzh/headers-more-nginx-module/zipball/v0.17rc1
unzip header.zip 
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-\
http_ssl_module --with-http_gzip_static_module --add-module=./agentzh-headers-more-nginx-module-3580526/
make && make install

应用示例,清除服务器及php信息,在配置文件http段添加以下:

more_clear_headers "X-Powered-By:";
more_clear_headers "Server:";

重新加载配置文件:

/etc/init.d/nginx reload

查看当前head头信息:

curl -I https://www.haiyun.me
HTTP/1.1 301 Moved Permanently
Date: Fri, 10 Feb 2012 10:58:38 GMT
Content-Type: text/html
Connection: keep-alive
location: forum.php

现在nginx及php信息都没了,当然也可自定义为其它信息。

分类
最新文章
最近回复
  • 海运: 恩山有很多。
  • swsend: 大佬可以分享一下固件吗,谢谢。
  • Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...
  • 孤狼: 擦。。。。apcupsd会失联 nut在冲到到100的时候会ONBATT进入关机状态,我想想办...
  • 海运: 网络,找到相应的url编辑重发请求,firefox有此功能,其它未知。
  • knetxp: 用浏览器F12网络拦截或监听后编辑重发请求,修改url中的set为set_super,将POS...
  • Albert: 啊啊啊啊啊啊啊啊啊 我太激动了,终于好了英文区搜索了半天,翻遍了 pve 论坛没找到好方法,博...
归档