3月 302015
 

安装RPM软件源

http://repoforge.org/use/

查看服务监听端口

[root@localhost ~]# netstat -ltnp |grep 667
tcp 0 0 0.0.0.0:667 0.0.0.0:* LISTEN 28906/darkstat
tcp 0 0 :::667 :::* LISTEN 28906/darkstat

查看软件包路径

[root@localhost ~]# rpm -lq darkstat
/usr/sbin/darkstat
/usr/share/doc/darkstat-3.0.717
/usr/share/doc/darkstat-3.0.717/AUTHORS
/usr/share/doc/darkstat-3.0.717/COPYING.GPL
/usr/share/doc/darkstat-3.0.717/INSTALL
/usr/share/doc/darkstat-3.0.717/LICENSE
/usr/share/doc/darkstat-3.0.717/NEWS
/usr/share/doc/darkstat-3.0.717/README
/usr/share/doc/darkstat-3.0.717/export-format.txt
/usr/share/man/man8/darkstat.8.gz

查看运行进程

[root@localhost ~]# ps aux |grep darkstat
root 18827 0.0 0.0 103244 868 pts/0 S+ 01:26 0:00 grep darkstat
nobody 28906 0.0 0.2 18404 4572 ? Ss Mar25 4:45 darkstat -i eth0
nobody 28907 0.0 0.0 19168 928 ? Ss Mar25 0:00 darkstat -i eth0
[root@localhost ~]#

查看包信息

[root@localhost ~]# yum info darkstat
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * epel: mirror01.idc.hinet.net
 * extras: centos.ustc.edu.cn
 * rpmforge: ftp.riken.jp
 * updates: centos.ustc.edu.cn
Installed Packages
Name : darkstat
Arch : x86_64
Version : 3.0.717
Release : 1.el6.rf
Size : 343 k
Repo : installed
From repo : rpmforge
Summary : Network traffic analyzer
URL : http://dmr.ath.cx/net/darkstat/
License : GPL
Description : darkstat is a network traffic analyzer. It's basically a packet
 : sniffer which runs as a background process on a cable/DSL router
 : and gathers all sorts of useless but interesting statistics.

[root@localhost ~]#

darkstat-traffice-monitor-01

3月 242015
 

安装

[root@localhost ~]# yum -y install yum-utils

下载

[root@localhost ~]# yumdownloader rp-pppoe libpcap ppp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.pubyun.com
 * extras: mirrors.btte.net
 * updates: centosx4.centos.org
rp-pppoe-3.10-11.el6.x86_64.rpm | 97 kB 00:00
libpcap-1.4.0-1.20130826git2dbcaa1.el6.x86_64.rpm | 130 kB 00:00
libpcap-1.4.0-1.20130826git2dbcaa1.el6.i686.rpm | 130 kB 00:00
ppp-2.4.5-5.el6.x86_64.rpm | 323 kB 00:00
[root@localhost ~]# ls
anaconda-ks.cfg
install.log
install.log.syslog
libpcap-1.4.0-1.20130826git2dbcaa1.el6.i686.rpm
libpcap-1.4.0-1.20130826git2dbcaa1.el6.x86_64.rpm
ppp-2.4.5-5.el6.x86_64.rpm
rp-pppoe-3.10-11.el6.x86_64.rpm
[root@localhost ~]# 
3月 232015
 

阿里云香港节点到美国硅谷节点

[root@iZ620ub9b34Z ~]# tracepath 198.11.179.238
 1?: [LOCALHOST] pmtu 1500
 1: 58.96.171.248 (58.96.171.248) 7.233ms
 1: 58.96.171.248 (58.96.171.248) 3.091ms
 2: 10.88.16.13 (10.88.16.13) 1.018ms
 3: 58.96.160.210 (58.96.160.210) 0.773ms
 4: 80.77.0.197 (80.77.0.197) 1.408ms asymm 8
 5: 10.55.208.158 (10.55.208.158) 83.488ms asymm 6
 6: xe-0-1-0-7.r04.sttlwa01.us.bb.gin.ntt.net (128.241.1.209) 216.947ms asymm 9
 7: so-2-2-0.0.pjr01.wad001.flagtel.com (85.95.25.37) 52.048ms asymm 9
 8: ae-3.r23.snjsca04.us.bb.gin.ntt.net (129.250.3.124) 182.331ms asymm 9
 9: xe-0-1-0-10.r04.lsanca03.us.bb.gin.ntt.net (198.172.90.221) 186.902ms asymm 8
 10: ae-6.r21.lsanca03.us.bb.gin.ntt.net (129.250.5.69) 186.672ms asymm 9
 11: xe-0-0-0-30.r05.plalca01.us.ce.gin.ntt.net (129.250.197.38) 187.560ms asymm 9
 12: 198.11.128.181 (198.11.128.181) 185.627ms asymm 10
 13: ae-4.r05.plalca01.us.bb.gin.ntt.net (129.250.5.32) 149.500ms asymm 11
 14: 198.11.179.238 (198.11.179.238) 178.624ms reached
 Resume: pmtu 1500 hops 14 back 50
 [root@iZ620ub9b34Z ~]#

深圳电信100M拨号光纤

[root@localhost ~]# tracepath 198.11.179.238
 1: 192.168.150.73 (192.168.150.73) 0.251ms pmtu 1500
 1: 192.168.150.1 (192.168.150.1) 0.832ms
 1: 192.168.150.1 (192.168.150.1) 0.792ms
 2: 192.168.150.1 (192.168.150.1) 1.073ms pmtu 1492
 2: 1.0.40.59.broad.sz.gd.dynamic.163data.com.cn (59.40.0.1) 2.026ms
 3: 113.106.38.157 (113.106.38.157) 3.980ms
 4: 219.133.30.234 (219.133.30.234) 2.481ms asymm 5
 5: 183.56.65.2 (183.56.65.2) 8.229ms
 6: 202.97.33.230 (202.97.33.230) 6.494ms asymm 7
 7: 202.97.60.206 (202.97.60.206) 6.735ms
 8: 202.97.58.130 (202.97.58.130) 271.240ms
 9: 203.14.186.38 (203.14.186.38) 251.500ms asymm 11
 10: 218.30.43.18 (218.30.43.18) 184.121ms asymm 11
 11: 198.11.128.125 (198.11.128.125) 201.388ms asymm 12
 12: 198.11.128.189 (198.11.128.189) 188.146ms asymm 13
 13: 10.107.64.133 (10.107.64.133) 184.789ms asymm 14
 14: 198.11.179.238 (198.11.179.238) 200.295ms reached
 Resume: pmtu 1492 hops 14 back 51
 [root@localhost ~]#
3月 212015
 

Smokeping的master/slave配置

从多个位置和网络检测同一主机位置的网络

安装smokeping及相关依赖软件包

确认master上共享密钥配置文件的权限和内容
[root@localhost ~]# cd /opt/smokeping/etc/
[root@localhost etc]# ll smokeping_secrets.dist
-rw——-. 1 apache root 59 Mar 20 03:49 smokeping_secrets.dist
[root@localhost etc]# cat smokeping_secrets.dist
host1:mysercert
host2:yoursercert
boomer:lkasdf93uhhfdfddf
[root@localhost etc]#

编辑slave共享密钥配置文件
[root@localhost ~]# cd /opt/smokeping/etc/
[root@localhost etc]# vi smokeping_secrets.dist
lkasdf93uhhfdfddf
Slave以Debug方式启动
[root@localhost etc]# /opt/smokeping/bin/smokeping –master-url=http://192.168.150.79/smokeping/smokeping.cgi –cache-dir=/opt/smokeping/cache/ –shared-secret=/opt/smokeping/etc/smokeping_secrets.dist –slave-name=boomer –logfile=/opt/smokeping/slave.log –debug-daemon
Sent data to Server and got new config in response.
Note: logging to syslog as local0/info.
Daemonizing /opt/smokeping/bin/smokeping …
[root@localhost etc]#

Slave正常工作后的日志输出
Fri Mar 20 09:22:10 2015 – FPing: Executing /usr/sbin/fping -C 20 -q -B1 -r1 -i10 www.baidu.com
Fri Mar 20 09:22:29 2015 – FPing: Got fping output: ‘www.baidu.com : 26.36 26.28 25.46 25.71 25.84 25.29 25.20 25.00 24.92 25.96 25.19 25.48 24.71 25.67 26.62 25.13 25.11 24.79 24.90 25.69’
Fri Mar 20 09:22:29 2015 – Sent data to Server. Server said OK
Fri Mar 20 09:22:29 2015 – FPing: Sleeping 41 seconds.

smokeping-example-graph-01 smokeping-example-graph-02 smokeping-example-graph-03 smokeping-example-graph-04

3月 192015
 

下载软件源
http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
http://mirrors.zju.edu.cn/epel/6/i386/epel-release-6-8.noarch.rpm
[root@localhost ~]# yum -y install http://mirrors.zju.edu.cn/epel/6/i386/epel-release-6-8.noarch.rpm
[root@localhost ~]# yum -y install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
[root@localhost ~]# yum makecache

安装smokeping依赖软件包
[root@localhost ~]# yum -y install mod_fcgid httpd httpd-devel rrdtool fping wget curl bind-utils gcc make
[root@localhost ~]# yum -y install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI perl-FCGI perl-RRD-Simple perl-ExtUtils-MakeMaker

解压缩并安装
[root@localhost ~]# mkdir -p /opt/smokeping/{data,var,cache}
[root@localhost ~]# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz
[root@localhost ~]# tar xzf smokeping-2.6.11.tar.gz
[root@localhost ~]# cd smokeping-2.6.11/setup/
[root@localhost setup]# ./build-perl-modules.sh
[root@localhost setup]# cp -r ../thirdparty/ /opt/smokeping/
[root@localhost setup]# cd ..
[root@localhost smokeping-2.6.11]# ./configure –prefix=/opt/smokeping
[root@localhost smokeping-2.6.11]# make install

安装启动脚本
[root@localhost smokeping-2.6.11]# wget http://new.wedebugyou.com/static/smokeping_start_stop.txt
[root@localhost smokeping-2.6.11]# mv smokeping_start_stop.txt /etc/init.d/smokeping
[root@localhost smokeping-2.6.11]# chmod 755 /etc/init.d/smokeping

更改文件权限并修改主配置文件
[root@localhost smokeping-2.6.11]# cd /opt/smokeping/etc/
[root@localhost etc]# ll smokeping_secrets.dist
-rw-r–r–. 1 root root 59 Mar 20 03:49 smokeping_secrets.dist
[root@localhost etc]# chmod 600 smokeping_secrets.dist
[root@localhost etc]#
[root@localhost etc]# cp config.dist config
[root@localhost etc]# vi config

#cgiurl = http://some.url/smokeping.cgi
cgiurl = http://192.168.150.79/smokeping/smokeping.cgi

#host = james.address
host = www.baidu.com

修改权限允许Apache读写操作
[root@localhost etc]# cd ..
[root@localhost smokeping]# ln -s /opt/smokeping/cache /opt/smokeping/htdocs/cache
[root@localhost smokeping]# chown -R apache cache
[root@localhost smokeping]# chown -R apache data

增加Apache配置文件
[root@localhost smokeping]# cd /etc/httpd/conf.d/
[root@localhost conf.d]# vi smokeping.conf
ScriptAlias /smokeping/smokeping.cgi /opt/smokeping/htdocs/smokeping.fcgi.dist
Alias /smokeping /opt/smokeping/htdocs

<Directory “/opt/smokeping/htdocs”>
Options FollowSymLinks
</Directory>

启动Smokeping服务器和Apache服务器
[root@localhost ~]# service smokeping start
Starting SMOKEPING: Note: logging to syslog as local0/info.
Daemonizing /opt/smokeping/bin/smokeping …
[ OK ]
[root@localhost ~]#
[root@localhost ~]# service httpd start

错误分析:权限
修改为600仅限所有者操作,修改所有者为apache允许Slave通过API操作
[root@localhost ~]# chkconfig –add smokeping
[root@localhost ~]# service smokeping start
Starting SMOKEPING: ERROR: /opt/smokeping/bin/../etc/config, line 112: File ‘/opt/smokeping/etc/smokeping_secrets.dist’ is world-readable or writable, refusing it
[FAILED]
[root@localhost ~]#
错误分析:权限
slave在master缩略图中不显示的问题
[root@localhost ~]# ll /opt/smokeping/data/Test/
total 23360
-rw-r–r–. 1 root root 2986808 Mar 20 07:19 Baidu~boomer.rrd
-rw-r–r–. 1 root root 2986808 Mar 20 08:15 Baidu.rrd
-rw-r–r–. 1 root root 2986808 Mar 20 08:15 FtiaoCT.rrd
-rw-r–r–. 1 root root 2986808 Mar 20 08:15 FtiaoCU.rrd
-rw-r–r–. 1 root root 2986808 Mar 20 04:06 James~boomer.rrd
-rw-r–r–. 1 root root 2986808 Mar 20 06:43 James.rrd
-rw-r–r–. 1 root root 2986808 Mar 20 04:06 James~slave2.rrd
-rw-r–r–. 1 root root 2986808 Mar 20 08:15 Sina.rrd
[root@localhost ~]# chown -R apache /opt/smokeping/data/

3月 192015
 

mariadb-out-of-memory-error-01 mariadb-out-of-memory-error-02

[root@linuxcache ~]# journalctl -u mariadb
-- Logs begin at Thu 2015-02-19 14:49:37 CST, end at Thu 2015-03-19 06:23:37 CST. --
Mar 02 10:54:59 linuxcache.com mysqld_safe[22408]: /usr/bin/mysqld_safe: line 182: 22567 Killed nohup /usr/libexec/mysqld --basedir=/usr --datadir=/var
Mar 02 10:55:04 linuxcache.com mysqld_safe[22408]: 150302 10:55:04 mysqld_safe Number of processes running now: 0
Mar 02 10:55:04 linuxcache.com mysqld_safe[22408]: 150302 10:55:04 mysqld_safe mysqld restarted
Mar 02 10:55:05 linuxcache.com mysqld_safe[22408]: /usr/bin/mysqld_safe: line 189: /usr/bin/sed: Cannot allocate memory
Mar 02 10:55:09 linuxcache.com mysqld_safe[22408]: /usr/bin/mysqld_safe: eval: line 182: syntax error near unexpected token `2'
Mar 02 10:55:09 linuxcache.com mysqld_safe[22408]: /usr/bin/mysqld_safe: eval: line 182: `nohup /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-di
Mar 02 10:55:09 linuxcache.com systemd[1]: mariadb.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 02 10:55:09 linuxcache.com systemd[1]: Unit mariadb.service entered failed state.
Mar 09 15:08:16 linuxcache.com systemd[1]: Starting MariaDB database server...
Mar 09 15:08:16 linuxcache.com mysqld_safe[30588]: 150309 15:08:16 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Mar 09 15:08:16 linuxcache.com mysqld_safe[30588]: 150309 15:08:16 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Mar 09 15:08:19 linuxcache.com systemd[1]: Started MariaDB database server.
Mar 16 23:46:11 linuxcache.com mysqld_safe[30588]: /usr/bin/mysqld_safe: line 182: 30747 Killed nohup /usr/libexec/mysqld --basedir=/usr --datadir=/var
Mar 16 23:46:20 linuxcache.com mysqld_safe[30588]: ps: error while loading shared libraries: libc.so.6: cannot map zero-fill pages: Cannot allocate memory
Mar 16 23:46:25 linuxcache.com mysqld_safe[30588]: 150316 23:46:25 mysqld_safe Number of processes running now: 0
Mar 16 23:46:44 linuxcache.com mysqld_safe[30588]: 150316 23:46:44 mysqld_safe mysqld restarted
Mar 16 23:46:53 linuxcache.com mysqld_safe[30588]: /usr/bin/mysqld_safe: line 182: 2432 Killed nohup /usr/libexec/mysqld --basedir=/usr --datadir=/var
Mar 16 23:46:53 linuxcache.com mysqld_safe[30588]: 150316 23:46:53 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
Mar 17 12:49:24 linuxcache.com systemd[1]: Starting MariaDB database server...
Mar 17 12:49:24 linuxcache.com mysqld_safe[3489]: 150317 12:49:24 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Mar 17 12:49:24 linuxcache.com mysqld_safe[3489]: 150317 12:49:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Mar 17 12:49:26 linuxcache.com systemd[1]: Started MariaDB database server.
Mar 17 17:17:34 linuxcache.com mysqld_safe[3489]: /usr/bin/mysqld_safe: line 182: 3648 Killed nohup /usr/libexec/mysqld --basedir=/usr --datadir=/var/
Mar 17 17:17:36 linuxcache.com mysqld_safe[3489]: 150317 17:17:36 mysqld_safe Number of processes running now: 0
Mar 17 17:17:36 linuxcache.com mysqld_safe[3489]: 150317 17:17:36 mysqld_safe mysqld restarted
Mar 17 17:17:37 linuxcache.com mysqld_safe[3489]: 150317 17:17:37 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
Mar 17 18:20:02 linuxcache.com systemd[1]: Starting MariaDB database server...
Mar 17 18:20:02 linuxcache.com mysqld_safe[5586]: 150317 18:20:02 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Mar 17 18:20:02 linuxcache.com mysqld_safe[5586]: 150317 18:20:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Mar 17 18:20:04 linuxcache.com systemd[1]: Started MariaDB database server.
Mar 19 06:23:10 linuxcache.com mysqld_safe[5586]: /usr/bin/mysqld_safe: line 182: 5745 Killed nohup /usr/libexec/mysqld --basedir=/usr --datadir=/var/
Mar 19 06:23:29 linuxcache.com mysqld_safe[5586]: 150319 06:23:29 mysqld_safe Number of processes running now: 0
Mar 19 06:23:29 linuxcache.com mysqld_safe[5586]: 150319 06:23:29 mysqld_safe mysqld restarted
Mar 19 06:23:31 linuxcache.com mysqld_safe[5586]: /usr/bin/mysqld_safe: line 182: 11197 Killed nohup /usr/libexec/mysqld --basedir=/usr --datadir=/var/
Mar 19 06:23:31 linuxcache.com mysqld_safe[5586]: 150319 06:23:31 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
[root@linuxcache ~]# systemctl start mariadb