nagios plugins check_proc_runtime

2013年6月3日 评论已被关闭 106 views

A nagios plugin of check proc running time. which can check a specified process running time, If it has been running too long time..

code:
check_proc_runtime

usage on nrpe:

$ cat nrpc.conf
command[check_proc_rsync]=/usr/local/nagios/libexec/check_proc_runtime -k rsync -e inotify -c 360

分类: python 标签: , ,

nginx+lua module直接调用redis实现url跳转

2013年5月24日 评论已被关闭 151 views

需求:想要实现的功能是lua通过id取redis中对应的url然后进行url跳转。

nginx编译用到的模块:
git clone https://github.com/simpl/ngx_devel_kit.git
git clone https://github.com/chaoslawful/lua-nginx-module
git clone https://github.com/agentzh/redis2-nginx-module.git
git clone https://github.com/agentzh/set-misc-nginx-module.git
git clone https://github.com/agentzh/echo-nginx-module.git
git clone https://github.com/catap/ngx_http_upstream_keepalive.git

阅读全文…

分类: nginx 标签: , ,

使Cacti流量图超过80M的解决方法

2013年4月3日 评论已被关闭 113 views

Before:

# /usr/local/rrdtool/bin/rrdtool info /var/www/html/rra/71/2995.rrd
ds[traffic_in].min = 0.0000000000e+00
ds[traffic_in].max = 1.0000000000e+07
ds[traffic_out].min = 0.0000000000e+00
ds[traffic_out].max = 1.0000000000e+07

阅读全文…

分类: linux 标签: ,

MAC上如何使用sed替换命令

2013年1月26日 评论已被关闭 91 views

mac上的sed命令貌似做了些许修改,-i参数不一样啦。。

MacBook-Pro:~ 2hei.net$ cat test.txt
abcd
MacBook-Pro:~ 2hei.net$ sed -i ‘s/abcd/1234/g’ test.txt
sed: 1: “test.txt”: undefined label ‘est.txt’

阅读全文…

分类: others 标签: ,

fastdfs体验

2013年1月21日 评论已被关闭 94 views

download source code

wget http://fastdfs.googlecode.com/files/FastDFS_v4.04.tar.gz

yum install libevent libevent-devel

Setup#step 1. download FastDFS source package and unpack ittar xzf FastDFS_v4.04.tar.gz#for example:tar xzf FastDFS_v4.04.tar.gz

阅读全文…

分类: cloud, dfs 标签:

centos5.4升级网卡驱动

2013年1月4日 评论已被关闭 90 views

机器型号:Dell R710,操作系统Centos5.4,症状:流量大时网卡不通,日志无明显迹象。

解决办法,升级网卡驱动:

升级前:

[root@2hei.net]# ethtool -i eth0
driver: bnx2
version: 1.9.3
firmware-version: 5.2.3 NCSI 2.0.11
bus-info: 0000:01:00.0

步骤如下:

wget http://ftp.us.dell.com/network/Bcom_LAN_16.4.0_Linux_Source_A00.tar.gz

tar -zxvf Bcom_LAN_16.4.0_Linux_Source_A00.tar.gz
cd Bcom_LAN_16.4.0_Linux_Source_A00
cd NetXtremeII/
rpm -ivh netxtreme2-6.4.44-1.src.rpm

cd /usr/src/redhat/
rpmbuild -bb SPECS/netxtreme2.spec
rpm -ivh RPMS/x86_64/netxtreme2-6.4.44-1.x86_64.rpm

screen -R update_driver

vim upgrade.sh

#!/bin/bash

rmmod bnx2
depmod
modprobe bnx2

sh upgrade.sh &

升级后:

[root@2hei.net]#ethtool -i eth0
driver: bnx2
version: 2.1.6b
firmware-version: bc 3.5.12 ipms 1.6.0
bus-info: 0000:03:00.0

[root@2hei.net]#modinfo bnx2
filename: /lib/modules/2.6.18-164.el5/updates/bnx2.ko
version: 2.1.6b
license: GPL
description: Broadcom NetXtreme II BCM5706/5708/5709/5716 Driver

分类: linux 标签: ,

站点被封

2013年1月4日 评论已被关闭 92 views

blog久未更新,今天突然收到邮件,说我的站点影响了服务器的性能(reason: site causing performance problems),经检查,是多年前装着玩的一个discuz站点,mysql表占用了2.8GB空间,吼吼,从未维护过的bbs上面居然注册了很多用户,从log上看,真真不少流量,大伙玩的很happy,各个自娱自乐,宛然成了灌水乐园。。。

于是¥%……&*(%¥%,对不起鸟,数据库直接给drop掉,发布目录也给清空了,这下大家满意了吧!

分类: others 标签:

alexa排名facebook超过了google

2012年9月18日 评论已被关闭 99 views

几天没见, Facebook目前Alexa排名全球第一,美国本土排名第二,Google正好相反。这让我想起了几年前yahoo被google赶超的情形,真是三两年河东,三两年河西啊,难免感慨唏嘘。

从另一侧面也反映了目前社交网络的火爆程度带来的巨大流量,而智能手机及各种应用,api的调用更是功不可没。

Alexa地址: http://www.alexa.com/topsites/global;0

分类: IT 标签: , ,

run or spawn in pexpect

2012年8月10日 评论已被关闭 112 views

Pexpect is a Python module for spawning child applications and controlling
them automatically. Pexpect can be used for automating interactive applications
such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup
scripts for duplicating software package installations on different servers. It
can be used for automated software testing. Pexpect is in the spirit of Don
Libes’ Expect, but Pexpect is pure Python. Other Expect-like modules for Python
require TCL and Expect or require C extensions to be compiled. Pexpect does not
use C, Expect, or TCL extensions. It should work on any platform that supports
the standard Python pty module. The Pexpect interface focuses on ease of use so
that simple tasks are easy.

There are two main interfaces to Pexpect — the function, run() and the class,
spawn. You can call the run() function to execute a command and return the
output. This is a handy replacement for os.system().
I was failed when using spawn() to get output of remote ssh command,

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# filename: pexpect_2hei_spawn.py

import pexpect
if __name__ == ‘__main__’:

child = pexpect.spawn(‘ssh -oStrictHostKeyChecking=no myname@host.example.com’)
child.expect (‘Password:’)
child.sendline (mypassword)
child.expect (‘$’)
child.sendline (‘hostname’)
print child.before
print child.after

Function run() worked for me,that’s great!

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# filename: pexpect_2hei.py

from pexpect import *

if __name__ == ‘__main__’:

User = ‘myuser’
Host = ‘www.2hei.net’
Pwd = ‘mypwd’
print run (“ssh -oStrictHostKeyChecking=no ” +User+”@”+Host+” ‘hostname;uptime’”, events={‘(?i)password’:Pwd+’\n’})

分类: python 标签:

中国移动之”大云” — CHINA MOBILE’S BIGCLOUD

2012年7月30日 评论已被关闭 205 views

中国移动的“大云”弹性计算系统(BC-EC)包括三部分:

1)web portal组件为用户提供自助服务的通道;
2)Front-end管理服务组件提供系统服务,应用,系统操作,用户管理,账单服务及数据库等;
3)Front-end组件提供和Qzone类似的功能来管理OpenNebula的back-ends服务。

中国移动近期准备发布基于BC-EC方案的public的云服务:包含1000+台severs,其中的700台提供服务器的虚拟环境,另外300台服务器为大云提供云存储空间。
相关概念:

  • 移动“大云”:

大云是中国移动研究院集成并扩展了多个云计算相关的开源软件和自主研发的部分功能组件的产品,在大云中主要采用了 Hadoop 分布式计算软件和 OpenNebula 弹性计算管理系统,虚拟机使用的是 Xen。在大云的开发过程中,移动对 Hadoop 进行了一些改进,并集成了一些附加功能,目前这些修改大都在逐步开放源代码。 阅读全文…

分类: cloud, IaaS 标签: