vivaz.net Ride Like The Wind

10Mar/100

a logrotate scripts

logrotate.sh

#!/bin/bash

cd `dirname $0`
d=`date +%Y%m%d`
d7=`date -d'7 day ago' +%Y%m%d`

cp tu.log tu.log.${d}
echo "" > tu.log
rm -rf tu.log.${d7}

dirname $0 是代表脚本所在目录

Tagged as: , No Comments
10Mar/100

Use cacti monitor http online users

1.vi /etc/snmp/snmpd.conf, add scripts

extend .1.3.6.1.4.1.2021.50 tuhttp /bin/bash /opt/httpd2/conf/tuhttp.sh

2.vi tuhttp.sh

#!/bin/bash
num=$(ps -e |grep http|grep -v grep|grep -v jkhttp|wc -l)
#num=$(grep "ONLINE USERS=" /opt/photo/log/tu.log | sed '$!d' | sed 's/\(.*\)USERS=\([0-9]*\)$/\2/')
echo $num
echo OK

ps: tu.log is my system log, ignore

3.reload snmpd

/etc/init.d/snmpd reload

4.check snmp info

snmpwalk -v 2c 10.30.0.22 -c public .1.3.6.1.4.1.2021.50

display:

UCD-SNMP-MIB::ucdavis.50.1.0 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.2.1.2.6.116.117.104.116.116.112 = STRING: "/bin/bash"
UCD-SNMP-MIB::ucdavis.50.2.1.3.6.116.117.104.116.116.112 = STRING: "/opt/httpd2/conf/tuhttp.sh"
UCD-SNMP-MIB::ucdavis.50.2.1.4.6.116.117.104.116.116.112 = ""
UCD-SNMP-MIB::ucdavis.50.2.1.5.6.116.117.104.116.116.112 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.50.2.1.6.6.116.117.104.116.116.112 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.2.1.7.6.116.117.104.116.116.112 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.2.1.20.6.116.117.104.116.116.112 = INTEGER: 4
UCD-SNMP-MIB::ucdavis.50.2.1.21.6.116.117.104.116.116.112 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.3.1.1.6.116.117.104.116.116.112 = STRING: "3"
UCD-SNMP-MIB::ucdavis.50.3.1.2.6.116.117.104.116.116.112 = STRING: "3
OK"
UCD-SNMP-MIB::ucdavis.50.3.1.3.6.116.117.104.116.116.112 = INTEGER: 2
UCD-SNMP-MIB::ucdavis.50.3.1.4.6.116.117.104.116.116.112 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.50.4.1.2.6.116.117.104.116.116.112.1 = STRING: "3"
UCD-SNMP-MIB::ucdavis.50.4.1.2.6.116.117.104.116.116.112.2 = STRING: "OK"

ps:we need .1.3.6.1.4.1.2021.50.3.1.1.6.116.117.104.116.116.112

5.add cacti data templates
Console -> Data Templates
data_templates

6.add cacti graph templates
Console -> Graph Templates
graph_templates

7.add these templates to host
Console -> Devices -> Create Graphs for this Host

8.All Done
cacti_httpnum

refer: http://bbs.linuxtone.org/thread-1372-1-1.html

Tagged as: , No Comments
12Feb/100

Compile Memcached + Php extension at Centos5.2 x64

1.get source

wget http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz
wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz

2.compile libevent

tar -zxvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure
make
make install

3.compile memcached

tar -zxvf memcached-1.4.4.tar.gz
cd memcached-1.4.4
./configure --prefix=/opt/memcached --with-libevent
make
make install

4.start memcached

cd /opt/memcached/bin
./memcached -d -m 256 -p 11211 -u root // -d daemon, -m ram, -p port default is 11211, -u user
if your os is 64bit maybe get a error "cant find libevent" try this
在 64bit 系统启动,会报找不到 libenent,可以如下操作
cp -R /usr/local/lib/libevent* /usr/lib64/

5.php memcache ext

wget http://pecl.php.net/get/memcache-2.2.4.tgz
cd memcache-2.2.4
whereis php-config
whereis phpize
phpize && ./configure --enable-memcache --with-php-config=/usr/local/bin/php-config
make
make test
make install

vi /usr/local/lib/php.ini

extension_dir = "/usr/local/lib/php/extensions/no-debug-zts-20060613/"
extension = "memcache.so"

6.monitor memcached

wget http://livebookmark.net/memcachephp/memcachephp.zip
put memcache.php file to wwwroot

vi memcache.php

define('ADMIN_USERNAME','user'); // Admin Username
define('ADMIN_PASSWORD','pass'); // Admin Password
$MEMCACHE_SERVERS[] = 'yourMemCachedHost:11211'; // add more as an array

http://host.com/memcache.php

memcache.php

5Jan/100

FF13全英文奖杯对照及获得方法

:2: :2: :2: http://bbs.a9vg.com/read.php?tid=1380341&fpage=1

奖杯类别 奖杯描述 获得方法
白金 Ultimate 所有奖杯全部获得
铜 Instruments of Fate 序章剧情后获得
铜 Instruments of Dissent 第2章剧情后获得
铜 Instruments of Tragedy 第3章剧情后获得
铜 Instruments of Flight 第4章剧情后获得
铜 Instruments of Vengeance 第5章剧情后获得
铜 Instruments of Survival 第6章剧情后获得
铜 Instruments of Rebellion 第7章剧情后获得
铜 Instruments of Shame 第8章剧情后获得
铜 Instruments of Wrath 第9章剧情后获得
铜 Instruments of Truth 第10章剧情后获得
铜 Instruments of Hope 第11章剧情后获得
银 Instruments of Faith 第12章剧情后获得
金 Instruments of Change 游戏通关
铜 Pulsian Pioneer 行走10000步以上,机器人パクティ修理完了之后与机器人对话
铜 Gysahl Wreath 用陆行鸟挖到リボン
铜 Kelger’s Cup 完成全部难易度为D(1~5)的冥碑任务
铜 Xezat’s Chalice 完成全部难易度为C(6~15、18~22、28、35~37、39、56~57)的冥碑任务
银 Exorcist 完成第64个冥碑任务
银 Floraphobe 完成第54个冥碑任务
银 Natural Selector 完成全部泰坦试炼
银 Dorgann’s 难易度为B的任务全部完成
银 Galuf’s Grail 完成全部64个冥碑任务
金 L’Cie Paragon 64个冥碑任务全部取得5星评价
铜 Commando’s Seal Attacker等级达到5级
铜 Ravager’s Seal Blaster等级达到5级
铜 Sentinel’s Seal defencer等级达到5级
铜 Saboteur’s Seal Jammer等级达到5级
铜 Synergist’s Seal Enhancer等级达到5级
铜 Medic’s Seal Healler等级达到5级
银 Limit Breaker 给予敌人单击伤害达到100000以上
银 Adamant Will 完成编号为56~62的冥碑任务后,将出现在大平原的ロングイ(龙龟)击倒
银 Master’s Seal 将Lv10的水晶盘全部填满
金 Treasure Hunter 全部武器(102种)与饰品(119种)取得过一次后与机器人パクティ对话
金 Loremaster 完全获得100种敌人的情报
金 Superstar 最终决战得到5星评价

Tagged as: No Comments
23Dec/090

My Xmas Gift



xmas_gift, originally uploaded by nikogoo.

Filed under: Normal No Comments
23Dec/093

kinder



kinder, originally uploaded by nikogoo.

Filed under: Normal 3 Comments
2Dec/096

taobao玩偶



taobao玩偶, originally uploaded by nikogoo.

终于到了,这个 pose 潮人伐

Filed under: Normal 6 Comments
1Dec/091

just noise

很久没关注自己的 blog 了,今天才发现好几个插件已经宕掉 :23: ,另外还有一名老外看了偶的教程并留言欣喜中 :4:

说说近期的情况和生活吧。

1. PS3 神机入手,当时只在 twitter 上留言 CX 一哈,特此补发(2009.10.03 入手)
DSC05415

2. 远在哈尔滨的小姨子和妹夫 11 月份来上海看望了我们,并带来许多干肠,怨念啊 :39:

3. 随公司去了一次东方绿洲和朱家角,感觉良好
CIMG0307

P1010497

4. 好友终于买车了,这样每个周末的 羽毛球+FB+三国杀 队伍扩充至 6 人(偶在乡下比较远)

5. 孝敬了 哈尼 大人一台 ipod nano5(背面刻有她的 twitter id 哦 :36:

6. 移动 IDC 杯具,导致整整业务中断了 48 小时,以后无线业务会越来越难做

7. 参加了同学婚礼,目前算下来朋友中该摆酒的都摆了,偶们自己的还是遥遥无期,真有点对不起哈尼 :15:

Tagged as: 1 Comment
13Aug/090

鋼殻のレギオス

最近比较好看的一部动画,异生物+格斗+学院爱情,人设也不错,最喜欢小菲丽,很萌 :3:

20regios1

regi33

Tagged as: No Comments
15Jun/091

cacti install and threshold settings

CentOS5.2 x64/ net-snmp 5.3.1 / rrd-tool 1.2.30
Cacti 0.8.7d
cacti-plugin-0.8.7d-PA-v2.4
Settings - v0.5
Thold - v0.4.1

1. install package

yum -y install httpd
yum -y install php
yum -y install php-mysql
yum -y install php-snmp
yum -y install mysql-server
yum -y install perl
yum -y install net-snmp-utils
yum -y install libpng
yum -y install freetype
yum -y install libart_lgpl

2. set chkconfig

chkconfig httpd on
chkconfig mysqld on

3.download rrdtool http://oss.oetiker.ch/rrdtool/download.var

wget http://dag.wieers.com/rpm/packages/rrdtool/perl-rrdtool-1.2.23-1.el5.rf.i386.rpm
wget http://dag.wieers.com/rpm/packages/rrdtool/rrdtool-1.2.23-1.el5.rf.i386.rpm

4.install rddtool

rpm -ivh perl-rrdtool-1.2.23-1.el5.rf.i386.rpm rrdtool-1.2.23-1.el5.rf.i386.rpm

5. change mysql charset
vi /etc/my.cnf

[mysqld]
collation-server = utf8_general_ci
default-collation = utf8_general_ci
character-set-server = utf8
default-character-set = utf8

6. download cacti

wget http://www.cacti.net/downloads/cacti-0.8.7d.tar.gz
tar zxvf cacti-0.8.7d.tar.gz

7. download cacti-plugin-0.8.7d-PA-v2.4.zip from cactiuser & extract it
2 method of install:

1) cd /path/cacti-0.8.7d && patch -p1 -N --dry-run < /path/to/cacti-plugin-0.8.7d-PA-v2.4.diff
2) cd /path/cacti-0.8.7d && cp -R /path/to/files-0.8.7d/* ./

注: 第一种方式在我这里报错了,官方论坛上也有提及,如果你也有遇到可以直接用第二种方式更新

8. imp cacti db

mysqladmin create cacti
mysql -u root -p cacti < /path/to/cacti.sql
mysql -u root -p cacti < /path/to/pa.sql
mysql> create user cacti@’localhost’;
mysql> create user cacti@’127.0.0.1′;
mysql> grant all privileges on cacti.* to cacti@’localhost’;
mysql> grant all privileges on cacti.* to cacti@’127.0.01′;
mysql> set password for cacti@’localhost’ = password(’cactipasswd’);
mysql> set password for cacti@’127.0.0.1′ = password(’cactipasswd’);

9. ensure the db-section at global.php is correct

vi /opt/www/html/cacti/include/global.php #-->check this section: /* Default database settings*/

10. set crontab
crontab -u cacti -e

*/5 * * * * /usr/bin/php /opt/www/html/cacti/poller.php > /dev/null 2>&1

11. install threshold

wget http://cactiusers.org/downloads/settings.tar.gz
wget http://cactiusers.org/downloads/thold.tar.gz
wget http://cactiusers.org/downloads/monitor.tar.gz

12. exract

tar zxvf settings.tar.gz
tar zxvf thold.tar.gz
tar zxvf monitor.tar.gz

13. place plug-in files into appropriate directory

mv settings /opt/www/html/cacti/plugins/
mv thold /opt/www/html/cacti/plugins/
mv monitor /opt/www/html/cacti/plugins/

14. update mysql db

mysql -u root -p cacti < thold.sql
mysql -u root -p cacti < monitor.sql

15. activate plug-ins now:
vi /opt/www/html/cacti/include/global.php

$plugins = array();
$plugins[] = 'settings';
$plugins[] = 'thold';
$plugins[] = 'monitor';

16. After installation, the 1st thing u need do is edit admin account, otherwise the “plug-in management” & “ThreshHold Templates” will not be added into console tab
Console -> User Management -> admin
cacti user

cacti plugin

Now go to:
Console -> Plugin Management
At “Thresholds”, click “Install” & “Enable”
enable thresholds

17. Use Tholds
17.1 mail settings
Go to console -> Settings select the “Mail/DNS” tab
Go to console -> Settings select the “Alerting/Thold” tab
enable “Dead Hosts Notifications”
Dead Host Notifications Email: enter the web-admin mail account
From Email Address: cacti alert mail accout
Save the configuration.
Then we will receive alter-mail when a host goes down or up:

17.2 create Threshhold Templates
Go to Console -> Threshhold Templates
Create Threshhold Templates you need

17.3 Apply the Threshhold Templaes

Then Go to Console -> devices
Click the device you want to apply the Threshhold Template
And then click “Create Graphs for this Host”

Create Graphs for this Host -> Auto-create thresholds

17.4 some threshold examples

Create disk usage Thold template
When (used_space/total_space%) > 90%, cacti will send alert mail
4.1.1 Add “VALUE_OF_HDD_TOTAL” at global _arrays.php

vi /opt/www/html/cacti/include/global _arrays.php
add VALUE_OF_HDD_TOTAL

find

$custom_data_source_types = array(

add

"VALUE_OF_HDD_TOTAL" => "Value of hdd_total data source",

add a new CDEF
Now go to Console -> Graph Management -> CDEFs click “Add” to add a new CDEF
Add new CDEF named like “Used Disk Space Percent”, at this CDEF, add 5 items:

Item #1 Special Data Source: CURRENT_DATA_SOURCE
Item #2 Custom String: 100
Item #3 Operator: *
Item #4 Special Data Source: VALUE_OF_HDD_TOTAL
Item #5 Operator: /

cdef

create new Threshold Templates
Go to Console -> Threshold Templates -> click Add
For linux host, we choose “ucd/net – CPU Usage - user” template;
for windows host, we choose “Host MIB - Hard Drive Space” template
this depends on what templates we used in device graphic:

Data Field: hdd_used
Enabled: yes
Threshold Type: High / Low
High Threshold: 90
Low Threshold: 0
Data Type: CDEF

Threshold CDEF: Used Disk Space Percent (the CDEF Name we just created)
Alert E-Mail: the email-address that alert message will send to

ucdnet memroy usage linux
cacti_graph_template_ucdnet_-_memory_usage_linux

graph_image

Reference:

http://forums.cacti.net/viewtopic.php?t=13829

http://cactiusers.org/wiki/TholdDocs

http://www.bsdmap.com/2008/12/07/how-to-install-cacti/

pyopyo docs

Tagged as: , 1 Comment
13Jun/092

httpd2.2 tomcat5.5 mod_jk integration

httpd 编译参数

./configure --prefix=/opt/httpd2/ \
--with-mpm=worker \
--enable-ssl \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-rewrite \
--enable-usertrack \
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-http \
--enable-deflate

编译安装

make && make install

下载 mod_jk 并 cp 至 httpd modules 目录(请根据自己的发行版选择,这里使用 centos 52 x64)

wget http://apache.etoak.com/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.28/x86_64/mod_jk-1.2.28-httpd-2.2.X.so
cp /where/is/your/mod_jk-1.2.28-httpd-2.2.X.so /opt/httpd2/modules/mod_jk.so

配置 workers.properties
vi /opt/httpd2/conf/workers.properties

#
# workers.properties
#
# list the workers by name
worker.list=s1
# localhost server 1
# ------------------------
worker.s1.port=8009
worker.s1.host=localhost
worker.s1.type=ajp13

配置 http.conf 添加 modjk 参数
vi /opt/httpd2/conf/httpd.conf

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkLogFile logs/mod_jk.log
JkLogLevel error

添加动态页面转发

JkMount /*.jsp s1
JkMount /*.action s1
JkMount /*Servlet* s1

httpd-mpm.conf 参数


ServerLimit 30
StartServers 2
ThreadLimit 200
MaxClients 3000
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 100
MaxRequestsPerChild 10000

配置 tomcat server.xml
默认的 server.xml 过于臃肿,可以使用 server-minimal.xml 代替

vi /opt/tomcat5/conf/server.xml
修改 8009 的参数

maxTreads="800" minSpareThreads="10" maxSpareThreads="50"
acceptCount="50" connectionTimeout="60000"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

配置 context,注意 docBase 和 httpd 的 DocumentRoot 一致

unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

重启动 tomcat 和 httpd,大功告成。 :35:

btw: tomcat 启动内存调节
编辑 catalina.sh 添加下面的内容

JAVA_OPTS='-Xms1024m -Xmx2048m'

Tagged as: , , 2 Comments
30May/091

Test WP Super Cache

wp super cache is done :34:

Filed under: Tech 1 Comment
30May/093

kds emotions

特别喜欢 kds 的表情符号,今天抽空替换到了自己 blog 上 :7: :7: :7: ,不知道在山上算啥水平 :8: :8: :8:

Filed under: Normal 3 Comments
30May/091

Shanghai Maglev

昨天送老丈人去浦东机场,回来时和 lp 一起坐做的磁悬浮最高时速达到了 430公里,有意思的是加速过弯时车厢会非常倾斜(30度左右)但感觉不到抖动,唯一的遗憾就是时间太短票价过高 7 分钟 50 元...

shanghai maglev

Filed under: Life 1 Comment
30May/090

change host again,but ~MISSING DATA FOR THREE YEARS~

cry

Filed under: News No Comments