kernel: TCP: time wait bucket table overflow解决方法
Debian/Ubuntu的apt-get太常用了,不过偶尔可能也会碰到不太熟悉,想不起来的包的名称,除了去debian packages去查找,另外的方法就是给Debian/Ubuntu添加自动补齐/完成功能。方法如下:
服务器出现了大量的丢包现象,通过查看message出现了下面的错误
kernel:ip_conntrack:table full,dropping packet
因为cacti中默认的单位是byte,这样在显示及设置起来比较麻烦,因些我们需要
自定义一个cdef以供使用,方法如下:
Create a Console->Graph Management->CDEF->add
“Byte to Mbits”
Item Item Value
Item #1 Special Data Source: CURRENT_DATA_SOURCE
Item #2 Custom String: 8
Item #3 Operator: *
Item #4 Custom String: 1024
Item #5 Operator: /
Item #6 Custom String: 1024
Item #7 Operator: /
ok,现在我们就可以在Threshold Templates添加监控流量的模板了,在
Threshold CDEF选择我们自定义的Byte to Mbits就可以了。
cacti不仅把所统计的流量以图像显示出来,而且还能通过插件使得cacti的功能得到进一步的提升。Cacti插件是对cacti的扩展,要使用cacti插件必须先扩展cacti架构,来支持插件。为了让cacti能够使用插件,必须先给cacti安装一个补丁->Plugin Architecture。由于对应不同的cacti的版本,都会有相应的PA。所以在安装PA的时候,一定要选择正确的版本。在cactiusers.org你会找到不同的插件和PA。
PA 与cacti版本的关系:
PA 1.0 = cacti 0.8.6i
PA 1.1 = cacti 0.8.6i et 0.8.6j
PA 2.0 = cacti 0.8.7b
PA 2.2 = cacti 0.8.7c
PA 2.4 = cacti 0.8.7d
PA 2.5 = cacti 0.8.7e
因为之前安装的cacti的版本是0.8.7e所以就使用ccacti-plugin-0.8.7e-PA-v2.5.zip来进行安装;
一、安装PA
[root@dns plugin]# pwd
/home/redhat/cacti/plugin
[root@dns plugin]# unzip cacti-plugin-0.8.7e-PA-v2.5.zip
解压出来的有cacti-plugin-0.8.7e-PA-v2.5.diff 和pa.sql是我们最需要的;这里不防看一下Readme.txt文档
http://cactiusers.org/wiki/Homepage
[root@dns plugin]# cp -R * /usr/www/www/cacti
(或者直接把tar包拷贝到cacti目录下面在解压)
把刚才解压到文件全部移到cacti目录下,在做这一步之前先备份整个cacti目录;[root@dns www]#cp -rv cacti cacti.bak
[root@dns www]#cd cacti
[root@dns cacti]# pwd
/usr/www/www/cacti
[root@dns plugin]# mysql -u cacti -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 573 to server version: 5.0.22-log
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| cacti |
| test |
+——————–+
3 rows in set (0.02 sec)
mysql> use cacti;
Database changed
mysql> source pa.sql; (导入数据库)
Query OK, 0 rows affected, 1 warning (0.03 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 1 row affected (0.00 sec)
Query OK, 1 row affected (0.01 sec)
Query OK, 1 row affected (0.00 sec)
mysql> quit
Bye
安装补丁:
[root@dns cacti]# patch -p1 -N < cacti-plugin-0.8.7e-PA-v2.5.diff
如果是通过"http://ip/cacti/“的URL访问,要修改global.php:
[root@dns cacti]#vi include/global.php
修改
33 /* Default database settings*/
34 $database_type = "mysql";
35 $database_default = "cacti";
36 $database_hostname = "localhost";
37 $database_username = "cacti";
38 $database_password = "cacti";
39 $database_port = "3306";
和原来配置cacti时一样;
修改第56行改为 : $config['url_path'] = '/cacti/';
授权admin用户"plugin Management":
登录后,Utilities--User Management--admin--Realm Permissions,选中“Plugin Management",Save。
会在console-configuration下面多出一个plugin management,进入到里面会看到安装插件的版本;
二、安装monitor、settings、thold插件
monitor:通过简单明了的图标提供服务器的运行状态
settings:给不同的插件提供一些共用的信息,如邮件信息,dns信息。
thold :提供设备异常预警。
http://cactiusers.org/wiki/PluginsInstall 上面例子
wget http://cactiusers.org/downloads/settings.tar.gz
wget http://cactiusers.org/downloads/monitor.tar.gz
wget http://cactiusers.org/downloads/thold.tar.gz
1)、[root@dns cacti]#
直接把三个插件tar包cp到安装目录cacti下的plugins中;
[root@dns plugins]#tar -zxvf monitor-0.8.2.tar.gz
得到monitor目录
[root@dns plugins]# tar -zxvf settings-0.5.tar.gz
得到settings 目录
[root@dns plugins]# tar -zxvf thold-0.4.1.tar.gz
得到 thold目录
2)、如果是升级安装,只需要完全覆盖原目录即可。
3)、激活monitor插件,修改cacti配置文件(cacti目录下的include/config.php)。在配置中查找到第44行$plugins = array();,在此
行下面加入:
$plugins[] = 'monitor';
$plugins[] = 'settings';
$plugins[] = 'thold';
注意:上面monitor的名字必须与 cacti/plugins/目录下插件目录的名字相同。
4).有些插件需要进行额外的配置,请根据插件的安装文档进行配置,在此略述。
5).移除插件时只要修改cacti配置文件,注释掉与插件相关的行即可。
如://$plugins[] = 'monitor';
6)、保存推出, 在console-Plugin Management会看到安装的monitor插件
7)、导入数据库monitor 与thold的数据库文件按
[root@dns plugins]# ls
index.php monitor monitor-0.8.2.tar.gz settings settings-0.5.tar.gz thold thold-0.4.1.tar.gz
[root@dns plugins]# pwd
/usr/local/www/cacti/plugins
[root@dns plugins]#mysql -u cacti -p
mysql> use cacti;
Database changed
mysql> source monitor/monitor.sql
mysql> source thold/thold.sql
mysql>exit
一定要确保导入的过程中没有错误出现;
==================================================================
上面这两步很关键,我在这个上面实验了几次,有的会出现如下错误:
ERROR 1060 (42S21): Duplicate column name ‘monitor’
ERROR 1060 (42S21): Duplicate column name ‘monitor_text’
Query OK, 2 rows affected (0.00 sec)
是什么问题呢
ERROR 1050 (42S01): Table ‘plugin_thold_log’ already exists
Query OK, 1 row affected (0.00 sec)
这样的话就直接造成后面不能在Templates->Threshold Templates中添加,会提示
我还不知道怎么去解决这两个问题,大牛知道了可以在下面回帖,多谢了!!
===================================================================
8)、授权使用;
进入”Console”->”User Management”->”admin”->Realm Permissions把View Monitoring 打勾
9)、保存,在页面上看到:
10)、当点击”monitor”的时候发现会有一句错误
Warning: Invalid argument supplied for foreach() in /usr/www/www/cacti/plugins/monitor/monitor.php on line 199
进入到该目录打开这个文件,发现一句:AND thold_enabled = “on”,是不是因为咱们现在还没启用thold呢?那咱们就先启用thold:
11)、点击”Plugin Management”:
先点”Install”再点”Enable” 然后在点击monitor 就没有提示了:
12).在console选项卡下,点击左侧菜单中的Settings链接,在右侧出现的web页中点击Misc选项卡来配置Monitor插件。
*上述中可以调整Monitor的各项配置。例如:勾选“Show Icon Legend”可以在监控页面显示图例;“View”可以选用Tiles类型,以显示设备状态表格。
*为cacti添加新设备时,勾选上“Monitor Host”项。对已添加的设备可以通过“Management->Devices”进去修改。
*单击Web页面上方的“monitor”标签链接,可以进入查看各设备/主机的状态图示。
以下所看到的是Monitor选项卡下所监控的机器状态。当有机器Down掉后,相应机器图标将由绿色变成红色,并发出声音进行报警。
13)、使用thold插件
*打开“Console->Settings->Mail/DNS”,可以调整“SMTP Options”和“DNS Options”等配置,用于确保预警邮件能够发出。
网上大牛建议mail servers选择smtp,并正确设置smtp和dns信息。因为无论选择phpmail还是sendmail都要使用sendmail这程序,都要装一个邮件系统。没有必要吧,多一个程序多一个风险。设置完了可以点一下右上角的”Send a Test Email”以确定配置正确)
“send a test mail”测试一下设置是否正确,一般都会成功的,到收件箱中就会收到一封测试邮件;
S
14)、Console->Settings->Alerting/Thold配置出现问题的时候有邮件通知,Alerting/Thold可以调整Thold的各项配置。例如:“Dead Host Notifications Email”处可填写设备宕机时发送警告信息到哪个邮箱;勾选“Send alerts as text”项,设置只发送文本格式的邮件。在”Default Alerting Options”里,启用”Dead Hosts Notificatios”并正确填写警告的邮件地址:
15)、Templates->Threshold Templates,可以添加、取出需要关联到预警系统的模板,例如:可以添加和“Interface-Traffic”模板的关联,如“traffic_in”、“traffic_out”数据项,分别设置警告阈值“High Threshold”(如200000000比特/秒);
16)、打开“Create->New Graphs”,选择需要提供预警的设备,单击右侧上方的“Auto-create thresholds”创建预警项目。
17)、打开“Management->Thresholds”,可以管理已经创建的预警项目。
做到这里,基本上对cacti有了一些基本的了解,还需继续深入的去研究学习;后续做cacti的多种监控;
nginx.conf
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 64;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr – $remote_user [$time_local] $request ‘
# ‘”$status” $body_bytes_sent “$http_referer” ‘
# ‘”$http_user_agent” “$http_x_forwarded_for”‘;
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#设定请求缓冲
client_header_buffer_size 1k;
large_client_header_buffers 4 4k;
#开启gzip模块
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain;
output_buffers 1 32k;
postpone_output 1460;
upstream bbs.973game.com {
server 222.76.214.53:80;
}
upstream www.domain2.com {
server 117.25.131.122:81;
}
upstream www.domain3.com {
server 222.76.210.22:8888;
}
server {
listen 81;
server_name www.domain3.com;
#charset koi8-r;
access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm index.php;
proxy_pass http://www.domain3.com;
include proxy.conf;
}
}
server {
listen 81;
server_name www.domain2.com;
#charset koi8-r;
access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm index.php;
proxy_pass http://www.domain2.com;
include proxy.conf;
}
}
server {
listen 81;
server_name bbs.973game.com;
#charset koi8-r;
access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm index.php;
proxy_pass http://bbs.973game.com;
include proxy.conf;
}
#location /NginxStatus {
# stub_status on;
# access_log on;
#auth_basic “NginxStatus”;
#auth_basic_user_file conf/htpasswd;
#} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.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$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$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;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#}
}
proxy.conf
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;








最新评论
强啊!我顶一个!
呵呵。
博客什么时候更新的啊 上次来
前排站位…好久没来你博客了。
hi,博主我的博客和你是用同
1、首先在Window
博主很牛x
亲,好久没来你博客了,您还记
昨天百年一遇光棍节有没有脱啊
博主大哥您好,怎样获得您的联