其实ps这个命令在监控中起着不可缺少的作用:
  ps axjf 树装显示进程
  ps -eLf|head 1
UID PID PPID LWP C NLWP STIME TTY TIME CMD

  注意上面的NLWP,就是线程数,而LWP就是线程ID。
  所以如果要统计系统中某个JAVA进程的线程数,命令就是:
  ps -eLf|grep java|wc -l

Popularity: 62% [?]

  这个问题也很常见,如何在Linux上访问Windows的文件共享呢?不用smbclient这种方式。(smb这种方式是拷贝文件的最快方式)。
mount -t smbfs -o iocharset=utf8,codepage=cp936,username=ntboy //rlzy-03/c$ /mnt/smb1

Popularity: 38% [?]

  这个需求很常见,就是要监控java进程的日志,需要截取某一时刻起到另一时刻的日志,对内容进行分析,用sed来完成吧,截取某特定两行之间的内容:
记录一下脚本:
sed -n "`sed -n "/17:29:27/{=;q;}" access.log`,`sed -n "/17:30:12/{=;q;}" access.log`p" access.log
  把这个弄成可以带参数的脚本时还出了一档子事,死活不能执行,无法调参,无比恶心阿,最后请出eval大神才解决问题:
  三个参数,第一个是文件名,第二个是要找的第一个字符串,第三个是第二个字符串:
#!/bin/bash
a1=`sed -n "/$2/{=;q;}" $1`
b2=`sed -n "/$3/{=;q;}" $1`
eval sed -n "${a1},${b2}p" $1

Popularity: 31% [?]

  接了个小活,在VPS CentOS 5.3上配置一些软件,整个一个光板CentOS啊,得装yum和开发环境阿,好编译软件:
记录一下安装YUM的脚本:
rpm -import http://mirror.centos.org/centos-5/5.3/os/i386/RPM-GPG-KEY-CentOS-5
rpm -ihv http://mirror.centos.org/centos/5.3/os/i386/CentOS/libxml2-2.6.26-2.1.2.7.i386.rpm
rpm -ihv http://mirror.centos.org/centos/5.3/os/i386/CentOS/libxml2-python-2.6.26-2.1.2.7.i386.rpm
rpm -ihv http://mirror.centos.org/centos-5/5.3/os/i386/CentOS/python-elementtree-1.2.6-5.i386.rpm
rpm -ihv http://mirror.centos.org/centos-5/5.3/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
rpm -ihv http://mirror.centos.org/centos-5/5.3/os/i386/CentOS/python-sqlite-1.1.7-1.2.1.i386.rpm
rpm -ihv http://mirror.centos.org/centos-5/5.2/os/i386/CentOS/m2crypto-0.16-6.el5.2.i386.rpm
rpm -ihv http://mirror.centos.org/centos-5/5.2/os/i386/CentOS/python-urlgrabber-3.1.0-2.noarch.rpm
rpm -ihv http://mirror.centos.org/centos-5/5.2/os/i386/CentOS/sqlite-3.3.6-2.i386.rpm
rpm -ihv http://mirror.centos.org/centos-5/5.2/os/i386/CentOS/yum-metadata-parser-1.1.2-2.el5.i386.rpm
rpm -ihv http://mirror.centos.org/centos-5/5.2/os/i386/CentOS/yum-3.2.8-9.el5.centos.1.noarch.rpm

Popularity: 35% [?]

IDC机房专线的搭建过程

1 Comment. Posted in idc机房监控 by admin on 07-24-2009.

  专线系统的搭建过程:
  由于工作的要求,需要在IDC机房拉专线,这里把过程仔细描述一下,备忘。
  首先呢,专线连接的是两方,要问清专线的所有权,是对方还是己方,这里涉及到一个谁出月租的问题。
  我们的专线是自己出,那么就到电信或者联通去申请吧,拿着各种手续申请吧。
  现在基本没有什么X.25和帪中继以及DDN了,都是SDH的线路,2兆。专线其实说白了就是根电话线,申请好以后,负责拉专线的人就拉到机房,这时候千万记住要求拉专线的人打环测试,就是打个环路测试线路的情况。
  测好后就留下一个2芯的电话头,怎么把它接到网络上呢,首先把这个电话头插到协议转换器上(类似Modem)的一个东西,然后这个协转会带有一根线(很贵),这根线要插到一个Cisco的串口卡上,然后把串口卡插到Cisco路由器上。这样的话,己方的工作就完成了。对方也需要同样处理。
  统计一下需要的东西: Cisco路由器一台,Cisco串口卡一个,协议转换器一台,协议转换器转接线一根。
  OK,物理工作就完成了。下面就需要配置Cisco路由器。这里一定要首先准备好一张网络拓扑图。
  因为专线不会只有一根,所以建议以起子接口的方式配置路由器。这样便于以后随时添加串口卡和线路。

  从图中我们看到数据的流向很清晰:
  我们需要在Cisco路由器上配三个东西:子接口IP,串口IP,路由
interface FastEthernet0/1
ip address 192.168.46.1 255.255.255.0
ip address 123.121.45.65 255.255.255.248 secondary

interface Serial0/1/1
ip address 123.121.45.58 255.255.255.248
encapsulation ppp
!
ip route 10.1.3.0 255.255.255.0 123.121.45.57

  同样我们在自己的服务器上配置:
ifconfig eth0:1 123.121.45.66
route add -net 10.1.3.0 netmask 255.255.255.0 gw 123.121.45.65 dev eth0:1

  然后我们ping 10.1.3.29和10.1.3.72如果通的话就是配好了。

Popularity: 38% [?]

RHCE Certificate

1 Comment. Posted in Linux系统管理 by admin on 07-23-2009.

Dear Ran Rui Zhang:

The results of your RHCE Certification Exam are reported below.  The RHCE Certification Exam allows candidates to qualify for the Red Hat Certified Engineer (RHCE) and Red Hat Certified Technician(RHCT) certificates.  Please note that the RHCE designation is understood to both include and supersede the RHCT designation.

SECTION I:    TROUBLESHOOTING AND SYSTEM MAINTENANCE
RHCE requirements:  completion of compulsory items (50 points)
overall section score of 80 or higher
RHCT requirements:  completion of compulsory items (50 points)

Compulsory Section I score:                        50.0
Non-compulsory Section I score:                    50.0
Overall Section I score:                           100

SECTION II:  INSTALLATION AND CONFIGURATION
RHCE requirements: score of 70 or higher on RHCT components (100 points)
score of 70 or higher on RHCE components (100 points)

RHCT requirement:  score of 70 or higher on RHCT components (100 points)

RHCT components score:                             100.0
RHCE components score:                             100.0

RHCE Certification:                                PASS

Popularity: 41% [?]

    接上篇:
    四、Nokia E71手机的配置:
    功能表-->工具-->设置-->连接-->SIP设置
    
More »

Popularity: 48% [?]

    接上篇:
    Elastix的Web配置:
    登陆http://222.222.222.222,缺省会跳转到https://222.222.222.222,选择继续:
    
More »

Popularity: 41% [?]

  这里的Voip系统纯属于自架,您拥有绝对的控制权,如果购买了其他国家的trunk线路(欧洲大概是10欧元包月),打起国际长途来就更省钱了!!!平时在家也可以使用voip,绝对的省钱啊。

  说一下需要的硬件:
  1. 计算机一台,越破越好。这里用的是台破586,512内存。
  2. xp100语音卡一块,淘宝可以买到,大概100元。
  3. belkin无线路由器一台,淘宝也可以买到,大概130左右,推荐7231。
  4. E71手机一个,推荐港行,大概2350,亚太的2100多,绝对不要买什么大陆行货,被阉割了wifi功能,voip是绝对无法用的。

    
More »

Popularity: 45% [?]

php下的GD书写TTF字体

2 Comments. Posted in php by admin on 06-18-2009.

  看到老外的项目需求网上面有一个需求是这样的:
  做一个跟http://www.coolarchive.com/logogenerator.php差不多的自动建立LOGO的玩意。
  感觉不难,于是尝试了一下,其实难度在于php环境中GD和TTF环境测支持,其次就在于php的TTF写字时,计算文本框大小的问题。
  例子:http://www.linuxboy.net/work/logo
  只放了一种TTF字体,arial.ttf,有需要源代码的可以问我要。

Popularity: 27% [?]