为了能及时知道网站的运行情况,我打算给我们服务器上一套监控系统,在网站出现问题后,及时的通知我,初步打算采用邮件,短信,msn这三种方式,今天我们这篇文章主要是讲linux下短信猫的安装。

硬件环境:一台老掉牙的服务器(自攒的,用了5年了),GPRS短信猫(串口的)
软件环境:CentOS5.4(基础化安装,安装组件参见<利用yum安装postfix邮件服务器>)

好,介绍完毕,我们首先对linux进行yum update -y &操作保证最新。

第一:安装硬件:把短信猫接上电,把sim卡插入,把串口接到服务器主板的接口上。
第二:安装minicom,gettext-devel gettext
[root@nagios ~]# yum install -y minicom gettext-devel gettext
第三:运行命令:
[root@nagios ~]# minicom -s ,配置Serial port setup–>Bps/Par/Bits, 将相关值改为9600 8N1, /dev/modem改为对应串口(ttyS0是串口1,ttyS1是串口2). 最后选择Save setup as dfl—>Exit from Minicom
第四:从http://www.gnokii.org/下载gnokii,并编译安装.
[root@nagios ~]# tar jxvf gnokii-0.6.28.1.tar.bz2 
[root@nagios ~]# cd gnokii-0.6.28
[root@nagios ~]# ./configure
[root@nagios ~]# gmake
[root@nagios ~]# gmake install
[root@nagios ~]#cp /usr/local/share/doc/gnokii/sample/gnokiirc  /root/.gnokiirc
[root@nagios ~]#vi ~/.gnokiirc(修改如下几项)
model = AT
# model = 6110
serial_baudrate = 9600

[root@nagios ~]#gnokii -identify#检测
GNOKII Version 0.6.28
LOG: debug mask is 0x1
Config read from file /root/.gnokiirc.
phone instance config:
model = AT
port = /dev/ttyS0
connection = serial
initlength = default
serial_baudrate = 9600
serial_write_usleep = -1
handshake = software
require_dcd = 0
smsc_timeout = 10
rfcomm_channel = 0
sm_retry = 0
Initializing AT capable mobile phone ...
Serial device: opening device /dev/ttyS0
Serial device: setting RTS to high and DTR to high
Message sent: 0x00 / 0x0004
-----华丽的省略线------ (不省略博文不显示)           
Received message type 06
IMEI         : 012345678901234
Manufacturer : WAVECOM MODEM
Model        : MULTIBAND  900E  1800 
Product name : MULTIBAND  900E  1800 
Revision     : 534_09gg.2D 1748852
Serial device: closing device
[root@nagios ~]#
说明木问题了,你可以发给短信试一试:
[root@nagios ~]# echo -e "我注意你很久了。" | gnokii --sendsms 1365139XXXX

很快你就收到了,如果有什么问题,可以留言,也可以发送问题到我的邮箱:guoli0813@163.com