<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1950600071476663674</id><updated>2024-09-12T04:27:17.604+09:00</updated><category term="linux"/><category term="nagios"/><category term="python"/><category term="appengine"/><category term="trouble"/><category term="web.py"/><category term="wordpress"/><category term="xen"/><category term="メモ"/><title type='text'>メモブロ</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://memobg.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://memobg.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>milo</name><uri>http://www.blogger.com/profile/01379230108295084251</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1950600071476663674.post-6959177615075590534</id><published>2009-11-12T00:43:00.004+09:00</published><updated>2009-11-12T00:51:32.561+09:00</updated><title type='text'>Google Goでフィボナッチ数列</title><content type='html'>これにあるGoのフィボナッチ数列を求めるコードを書いてみた&lt;br /&gt;&lt;a href=&quot;http://golang.org/doc/GoCourseDay1.pdf&quot;&gt;http://golang.org/doc/GoCourseDay1.pdf&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;vi fib.go&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;prettyprint&quot;&gt;&lt;br /&gt;package main&lt;br /&gt;&lt;br /&gt;import &quot;fmt&quot;&lt;br /&gt;&lt;br /&gt;func fib(n int) int {&lt;br /&gt; if n &lt; 2 { return n }&lt;br /&gt; return fib(n-2) + fib(n-1)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;func main() {&lt;br /&gt; n := 39;&lt;br /&gt; fmt.Printf(&quot;%d\n&quot;, fib(n))&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;$ 8g fib.go&lt;br /&gt;$ 8l -o fib fib.8&lt;br /&gt;$ ./fib&lt;br /&gt;63245986</content><link rel='replies' type='application/atom+xml' href='http://memobg.blogspot.com/feeds/6959177615075590534/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1950600071476663674/6959177615075590534' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/6959177615075590534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/6959177615075590534'/><link rel='alternate' type='text/html' href='http://memobg.blogspot.com/2009/11/google-go.html' title='Google Goでフィボナッチ数列'/><author><name>milo</name><uri>http://www.blogger.com/profile/01379230108295084251</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1950600071476663674.post-2643657368848603340</id><published>2009-11-11T19:49:00.001+09:00</published><updated>2009-11-11T19:49:32.333+09:00</updated><title type='text'>trackbacktest</title><content type='html'>testtest</content><link rel='replies' type='application/atom+xml' href='http://memobg.blogspot.com/feeds/2643657368848603340/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1950600071476663674/2643657368848603340' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/2643657368848603340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/2643657368848603340'/><link rel='alternate' type='text/html' href='http://memobg.blogspot.com/2009/11/trackbacktest.html' title='trackbacktest'/><author><name>milo</name><uri>http://www.blogger.com/profile/01379230108295084251</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1950600071476663674.post-2591879106278899256</id><published>2009-07-17T10:42:00.002+09:00</published><updated>2009-07-17T10:49:51.665+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="trouble"/><category scheme="http://www.blogger.com/atom/ns#" term="wordpress"/><title type='text'>WordPressのFTP設定が変</title><content type='html'>仕事でWordPressを使っている。&lt;br /&gt;プラグインやWordPressのアップデート時にパーミッションの関係かFTP接続情報を要求される。&lt;br /&gt;その際にFTPホストがおかしなことになっている。&lt;br /&gt;&lt;br /&gt;接続情報にプロバイダからもらったFTPホスト名、ユーザー名、パスワードを入力すると接続に失敗して、FTPホスト名に「hostname:hostname」といった内容が入力されている。&lt;br /&gt;&lt;br /&gt;つまりFTPホストにhostnameポート番号にhostnameという内容で接続しようとしていた。&lt;br /&gt;&lt;br /&gt;原因はわからないが、wp-config.phpに&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;define (&#39;FTP_HOST&#39;, &#39;hostname:21&#39;);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;と追加したことで解決した。</content><link rel='replies' type='application/atom+xml' href='http://memobg.blogspot.com/feeds/2591879106278899256/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1950600071476663674/2591879106278899256' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/2591879106278899256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/2591879106278899256'/><link rel='alternate' type='text/html' href='http://memobg.blogspot.com/2009/07/wordpressftp.html' title='WordPressのFTP設定が変'/><author><name>milo</name><uri>http://www.blogger.com/profile/01379230108295084251</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1950600071476663674.post-5515529396624570205</id><published>2009-07-14T13:22:00.008+09:00</published><updated>2009-07-14T14:03:12.460+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="appengine"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="web.py"/><title type='text'>web.py をGoogle AppEngine上で動かす</title><content type='html'>pythonの練習がてらCRUD風のtodoリストを作成しました。&lt;br /&gt;&lt;br /&gt;参考：&lt;br /&gt;&lt;a href=&quot;http://d.hatena.ne.jp/kinneko/20080409/p5&quot;&gt;http://d.hatena.ne.jp/kinneko/20080409/p5&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://webpy.appspot.com/source&quot;&gt;http://webpy.appspot.com/source&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://code.google.com/intl/ja/appengine/docs/python/datastore/creatinggettinganddeletingdata.html&quot;&gt;http://code.google.com/intl/ja/appengine/docs/python/datastore/creatinggettinganddeletingdata.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;main.py&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;prettyprint&quot;&gt;&lt;br /&gt;import web&lt;br /&gt;import datetime&lt;br /&gt;from google.appengine.ext import db&lt;br /&gt;&lt;br /&gt;urls = (&lt;br /&gt;    &#39;/&#39;, &#39;index&#39;,&lt;br /&gt;    &#39;/add&#39;, &#39;add&#39;,&lt;br /&gt;    &#39;/update&#39;, &#39;update&#39;,&lt;br /&gt;    &#39;/delete&#39;, &#39;delete&#39;,&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;render = web.template.render(&#39;templates/&#39;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;class Todo(db.Model):&lt;br /&gt;    body = db.StringProperty(required=True)&lt;br /&gt;    create_date = db.DateTimeProperty()&lt;br /&gt;    update_date = db.DateTimeProperty()&lt;br /&gt;&lt;br /&gt;class index:&lt;br /&gt;    def GET(self):&lt;br /&gt;        todoes = Todo.all()&lt;br /&gt;        return render.index(todoes)&lt;br /&gt;&lt;br /&gt;class add:&lt;br /&gt;    def POST(self):&lt;br /&gt;        i = web.input(&quot;body&quot;)&lt;br /&gt;        todo = Todo(body=i.body)&lt;br /&gt;        todo.create_date = datetime.datetime.now()&lt;br /&gt;        todo.update_date = datetime.datetime.now()&lt;br /&gt;        todo.put()&lt;br /&gt;        web.seeother(&quot;/&quot;)&lt;br /&gt;&lt;br /&gt;class update:&lt;br /&gt;    def POST(self):&lt;br /&gt;        i = web.input()&lt;br /&gt;        todo = Todo.get(i.key)&lt;br /&gt;        todo.body = i.body&lt;br /&gt;        todo.update_date = datetime.datetime.now()&lt;br /&gt;        todo.put()&lt;br /&gt;        web.seeother(&quot;/&quot;)&lt;br /&gt;&lt;br /&gt;class delete:&lt;br /&gt;    def POST(self):&lt;br /&gt;        i = web.input(&#39;key&#39;)&lt;br /&gt;        q = Todo.get(i.key)&lt;br /&gt;        #q = Todo.get(&#39;agl3ZWJweXRvZG9yCgsSBFRvZG8YBgw&#39;)&lt;br /&gt;        q.delete()&lt;br /&gt;        web.seeother(&quot;/&quot;)&lt;br /&gt;&lt;br /&gt;if __name__ == &#39;__main__&#39;:&lt;br /&gt;    app = web.application(urls, globals())&lt;br /&gt;    main = app.cgirun()&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;app.yaml&lt;br /&gt;&lt;pre class=&quot;prettyprint&quot;&gt;&lt;br /&gt;application: webpytodo&lt;br /&gt;version: 2&lt;br /&gt;runtime: python&lt;br /&gt;api_version: 1&lt;br /&gt;&lt;br /&gt;handlers:&lt;br /&gt;- url: .*&lt;br /&gt;  script: main.py&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;こちらで動作確認できます。&lt;br /&gt;&lt;a href=&quot;http://webpytodo.appspot.com/&quot;&gt;http://webpytodo.appspot.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;以下気づいたこと&lt;br /&gt;&lt;br /&gt;・当然かもしれんが、web.pyのモジュールをappengineに含めないといけない。&lt;br /&gt;&lt;br /&gt;・web.py 0.3ではcgirun()にappengine用のコードが含まれているので&lt;br /&gt;アプリ側で特別な設定は必要ないみたい。&lt;br /&gt;&lt;pre class=&quot;prettyprint&quot;&gt;&lt;br /&gt;    def cgirun(self, *middleware):&lt;br /&gt;        &quot;&quot;&quot;&lt;br /&gt;        Return a CGI handler. This is mostly useful with Google App Engine.&lt;br /&gt;        There you can just do:&lt;br /&gt;        &lt;br /&gt;            main = app.cgirun()&lt;br /&gt;        &quot;&quot;&quot;&lt;br /&gt;        wsgiapp = self.wsgifunc(*middleware)&lt;br /&gt;&lt;br /&gt;        try:&lt;br /&gt;            from google.appengine.ext.webapp.util import run_wsgi_app&lt;br /&gt;            return run_wsgi_app(wsgiapp)&lt;br /&gt;        except ImportError:&lt;br /&gt;            # we&#39;re not running from within Google App Engine&lt;br /&gt;            return wsgiref.handlers.CGIHandler().run(wsgiapp)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;・そのまま実行すると&lt;br /&gt;&lt;pre class=&quot;prettyprint&quot;&gt;&lt;br /&gt;render = web.template.render(&#39;templates/&#39;)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;でエラーになるので、&lt;br /&gt;&lt;pre class=&quot;prettyprint&quot;&gt;&lt;br /&gt;python web/template.py --compile templates/&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;を実行して、appengine用に変換する必要があるらしい&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://webpy.org/cookbook/templates_on_gae&quot;&gt;http://webpy.org/cookbook/templates_on_gae&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://memobg.blogspot.com/feeds/5515529396624570205/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1950600071476663674/5515529396624570205' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/5515529396624570205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/5515529396624570205'/><link rel='alternate' type='text/html' href='http://memobg.blogspot.com/2009/07/webpy-on-google-appengine-wo.html' title='web.py をGoogle AppEngine上で動かす'/><author><name>milo</name><uri>http://www.blogger.com/profile/01379230108295084251</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1950600071476663674.post-9215844068686615791</id><published>2009-07-13T11:10:00.000+09:00</published><updated>2009-07-13T11:11:16.794+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="メモ"/><title type='text'>CSSでiPhone対応Webサイト</title><content type='html'>メモメモ&lt;br /&gt;&lt;iframe src=&#39;http://docs.google.com/present/embed?id=ddsxdst7_601hq9prrd3&#39; frameborder=&#39;0&#39; width=&#39;410&#39; height=&#39;342&#39;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://memobg.blogspot.com/feeds/9215844068686615791/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1950600071476663674/9215844068686615791' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/9215844068686615791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/9215844068686615791'/><link rel='alternate' type='text/html' href='http://memobg.blogspot.com/2009/07/cssiphoneweb.html' title='CSSでiPhone対応Webサイト'/><author><name>milo</name><uri>http://www.blogger.com/profile/01379230108295084251</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1950600071476663674.post-3093949165597888531</id><published>2009-07-10T16:38:00.002+09:00</published><updated>2009-07-10T16:42:56.131+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="nagios"/><title type='text'>MySQLレプリケーションの確認を行うnagiosプラグイン</title><content type='html'>check_mysql_repchk&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;prettyprint&quot;&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt; &lt;br /&gt;while test -n &quot;$1&quot;; do&lt;br /&gt; case &quot;$1&quot; in&lt;br /&gt;  -H)&lt;br /&gt;   HOST=$2&lt;br /&gt;   ;;&lt;br /&gt;  -u)&lt;br /&gt;   USER=$2&lt;br /&gt;   ;;&lt;br /&gt;  -p)&lt;br /&gt;   PASS=$2&lt;br /&gt;   ;;&lt;br /&gt; esac&lt;br /&gt; shift&lt;br /&gt;done&lt;br /&gt; &lt;br /&gt;MYSQL=&quot;/usr/bin/mysql&quot;&lt;br /&gt;QUERY=&quot;show slave status\G&quot;&lt;br /&gt;DIR=&quot;/usr/lib/nagios/plugins&quot;&lt;br /&gt;. $DIR/utils.sh&lt;br /&gt; &lt;br /&gt;IO_CHECK=`echo $QUERY | $MYSQL -u$USER -p$PASS -h $HOST | grep Slave_IO_Running | awk &#39;{print $2}&#39; `&lt;br /&gt;SQL_CHECK=`echo $QUERY | $MYSQL -u$USER -p$PASS -h $HOST | grep Slave_SQL_Running | awk &#39;{print $2}&#39; `&lt;br /&gt;#echo $IO_CHECK&lt;br /&gt;#echo $SQL_CHECK&lt;br /&gt; &lt;br /&gt;if test $IO_CHECK = &quot;Yes&quot; -a $SQL_CHECK = &quot;Yes&quot;; then&lt;br /&gt; exitstatus=$STATE_OK&lt;br /&gt; #exitstatus=$STATE_CRITICAL&lt;br /&gt;else&lt;br /&gt; exitstatus=$STATE_CRITICAL&lt;br /&gt; #exitstatus=$STATE_OK&lt;br /&gt;fi&lt;br /&gt; &lt;br /&gt;$ECHO &quot;IO_STATUS: $IO_CHECK, SQL_STATUS: $SQL_CHECK&quot;&lt;br /&gt;exit $exitstatus&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;nagiosからレプリケーションのスレーブにshow slave status\Gを実行して&lt;br /&gt;Slave_IO_RunningとSlave_SQL_Runningを見る。&lt;br /&gt;どちらもYesならSTATE_OKを返す&lt;br /&gt;どちらかが、またはどちらもNoならSTATE_CRITICALを返す</content><link rel='replies' type='application/atom+xml' href='http://memobg.blogspot.com/feeds/3093949165597888531/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1950600071476663674/3093949165597888531' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/3093949165597888531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/3093949165597888531'/><link rel='alternate' type='text/html' href='http://memobg.blogspot.com/2009/07/mysqlnagios.html' title='MySQLレプリケーションの確認を行うnagiosプラグイン'/><author><name>milo</name><uri>http://www.blogger.com/profile/01379230108295084251</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1950600071476663674.post-2073017569116964073</id><published>2009-07-10T15:56:00.007+09:00</published><updated>2009-07-10T16:36:00.035+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="nagios"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>nagiosでURLが正常に表示できるかをチェックするプラグイン</title><content type='html'>nagiosプラグイン「check_url」&lt;br /&gt;&lt;pre class=&quot;prettyprint&quot;&gt;&lt;br /&gt;#!/usr/bin/python -Wignore::FutureWarning&lt;br /&gt;# -*- encoding: utf-8 -*-&lt;br /&gt;import urllib, re, sys, md5, time&lt;br /&gt;from optparse import OptionParser&lt;br /&gt;&lt;br /&gt;parser = OptionParser()&lt;br /&gt;parser.add_option(&#39;-H&#39;, type=&#39;string&#39;)&lt;br /&gt;parser.add_option(&#39;-u&#39;, type=&#39;string&#39;)&lt;br /&gt;parser.add_option(&#39;-w&#39;, type=&#39;int&#39;)&lt;br /&gt;parser.add_option(&#39;-c&#39;, type=&#39;int&#39;)&lt;br /&gt;(options, args) = parser.parse_args()&lt;br /&gt;&lt;br /&gt;## 定数&lt;br /&gt;STATE_OK=0&lt;br /&gt;STATE_WARNING=1&lt;br /&gt;STATE_CRITICAL=2&lt;br /&gt;STATE_UNKNOWN=3&lt;br /&gt;STATE_DEPENDENT=4&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;comp=re.compile(&quot;&lt;b&gt;(.*)&lt;/b&gt;&quot;)&lt;br /&gt;&lt;br /&gt;def genmd5(str): return md5.new(str).hexdigest()&lt;br /&gt;&lt;br /&gt;def check_url(url, str):&lt;br /&gt;  check = None&lt;br /&gt;  pre = time.time()&lt;br /&gt;  res = urllib.urlopen(url)&lt;br /&gt;  post = time.time()&lt;br /&gt;  exec_time = post-pre&lt;br /&gt;  if options.c &gt; exec_time:   &lt;br /&gt;    for i in res:&lt;br /&gt;      line = i.rstrip(&#39;\n&#39;)&lt;br /&gt;      #print line&lt;br /&gt;      if comp.match(line):&lt;br /&gt;        check = comp.split(line)[1]&lt;br /&gt;        #print check&lt;br /&gt;        if check == str:&lt;br /&gt;          return (&quot;OK&quot;, check, exec_time, STATE_OK)&lt;br /&gt;    #return (&quot;CRITICAL&quot;, check, exec_time, STATE_CRITICAL)&lt;br /&gt;    return (&quot;CRITICAL&quot;, &quot;mismatch&quot;, exec_time, STATE_CRITICAL)&lt;br /&gt;  else: return (&quot;CRITICAL&quot;, &quot;TIMEOUT&quot;, exec_time, STATE_CRITICAL)&lt;br /&gt;&lt;br /&gt;def main():&lt;br /&gt;  scheme = &quot;http://&quot;&lt;br /&gt;  uri = options.u&lt;br /&gt;  host = options.H&lt;br /&gt;  url = scheme + host + uri&lt;br /&gt;  genstr = genmd5(host)&lt;br /&gt;  try:&lt;br /&gt;    (state, str, exec_time, flag) = check_url(url, genstr)&lt;br /&gt;  except:&lt;br /&gt;    state = &quot;HTTP_ERROR&quot;&lt;br /&gt;    exec_time = None&lt;br /&gt;    str = None&lt;br /&gt;    flag = STATE_WARNING&lt;br /&gt;  print &quot;URL %s %s %s %s %s&quot; % (state, exec_time, str, genstr, url)&lt;br /&gt;  sys.exit(flag)&lt;br /&gt;&lt;br /&gt;if __name__ == &#39;__main__&#39;:&lt;br /&gt;  main()&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;監視対処サーバにおくCGI&lt;br /&gt;&lt;pre class=&quot;prettyprint&quot;&gt;&lt;br /&gt;#!/usr/bin/python&lt;br /&gt;import md5, socket&lt;br /&gt;def genmd5(str): return md5.new(str).hexdigest()&lt;br /&gt;host = socket.gethostbyname(socket.gethostname())&lt;br /&gt;print &quot;Content-type: text/html\n\n&quot;;&lt;br /&gt;print &quot;&lt;b&gt;%s&lt;/b&gt;&quot; % genmd5(host)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;-Hオプションでプラグインに渡されたホスト名からMD5値を算出。&lt;br /&gt;CGIが実行されているホストでもMD5値を算出して、合っているかを確認する。&lt;br /&gt;&lt;br /&gt;./check_url -H example.com -u /example.cgi -c 10 -w 5&lt;br /&gt;URL OK 0.0720520019531 5ababd603b22780302dd8d83498e5172 5ababd603b22780302dd8d83498e5172 http://example.com/example.cgi</content><link rel='replies' type='application/atom+xml' href='http://memobg.blogspot.com/feeds/2073017569116964073/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1950600071476663674/2073017569116964073' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/2073017569116964073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/2073017569116964073'/><link rel='alternate' type='text/html' href='http://memobg.blogspot.com/2009/07/nagiosurl.html' title='nagiosでURLが正常に表示できるかをチェックするプラグイン'/><author><name>milo</name><uri>http://www.blogger.com/profile/01379230108295084251</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1950600071476663674.post-1510581471361532287</id><published>2009-06-25T11:55:00.009+09:00</published><updated>2009-06-25T12:05:54.622+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="xen"/><title type='text'>xen の xm console でエラーが出た</title><content type='html'>運用中のXenサーバーで&lt;br /&gt;&lt;br /&gt;/usr/sbin/xm console　&lt;dom-u&gt;&lt;pre style=&quot;margin: 0em;&quot;&gt;&lt;br /&gt;&lt;/pre&gt;&lt;dom-u&gt;とすると&lt;br /&gt;&lt;blockquote&gt;xenconsole: Could not open tty `/dev/pts/3&#39;: No such file or directory&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;とエラーが出た。&lt;br /&gt;&lt;br /&gt;調べてみると&lt;br /&gt;&lt;a href=&quot;http://lists.xensource.com/archives/html/xen-users/2005-09/msg00672.html&quot;&gt;http://lists.xensource.com/archives/html/xen-users/2005-09/msg00672.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/dom-u&gt;&lt;br /&gt;&lt;pre style=&quot;margin: 0em;&quot;&gt;&lt;/pre&gt;&lt;blockquote&gt;&lt;pre style=&quot;margin: 0em;&quot;&gt;Anyone know how to fix this problem ?&lt;/pre&gt;&lt;pre style=&quot;margin: 0em;&quot;&gt;Make sure that xenconsoled is running&lt;/pre&gt;&lt;/blockquote&gt;&lt;pre style=&quot;margin: 0em;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style=&quot;margin: 0em;&quot;&gt;とあったので&lt;br /&gt;/usr/sbin/xenconsoledを実行するとconsoleできるようになった。&lt;br /&gt;&lt;br /&gt;他の参考&lt;br /&gt;&lt;a href=&quot;http://d.hatena.ne.jp/kgbu/20080523/1211555660&quot;&gt;http://d.hatena.ne.jp/kgbu/20080523/1211555660&lt;/a&gt;&lt;/pre&gt; &lt;dom-u&gt;&lt;span style=&quot;font-family:monospace;&quot;&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;pre style=&quot;margin: 0em;&quot;&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;/dom-u&gt;&lt;/dom-u&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/1510581471361532287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1950600071476663674/posts/default/1510581471361532287'/><link rel='alternate' type='text/html' href='http://memobg.blogspot.com/2009/06/xen-xm-console.html' title='xen の xm console でエラーが出た'/><author><name>milo</name><uri>http://www.blogger.com/profile/01379230108295084251</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>