Archive for the ‘nagios’ Category

 

subprocess check_output , check kyototycoon

2月 8th, 2013

http://docs.python.org/2/library/subprocess.html#replacing-older-functions-with-the-subprocess-module nagios用のスクリプト pythonからktremotemgrを呼んで状態を確認する 2.6なのでcheck_outputが使えなかった http://docs.python.org/2.6/library/subprocess.html#module-subprocess popenのところだけ from subprocess import Popen,PIPE # 略 p = Popen(["ktremotemgr","report","-host",options.hostname,"-port",str(options.port),"-tout","2"], stdout=PIPE)  output = p.communicate()[0]  if re.search(r’db_total_count’, output ):    m = re.search(r’db_total_count: ([0-9]*)’, output )    count = m.group(1)    m = re.search(r’db_total_size: ([0-9]*)’, output )    size = m.group(1)    print “OK: %s %s:%d count:%s size:%s” % (service, options.hostname, […]

Read full article | コメントは受け付けていません。

mysql-python mysqldb

2月 8th, 2013

http://mysql-python.sourceforge.net/ http://sourceforge.net/projects/mysql-python/ python 2.6 で 2.7は最新、3.xはこれからのようです。 インストール pip-python install MySQL-python Complete output from command python setup.py egg_info: [localhost] out:     The required version of distribute (>=0.6.28) is not available, こんなメッセージが出たので更新してから再度 easy_install -U distribute Successfully installed MySQL-python Cleaning up… === 参考:fabric に設定して fabric update_python_egg install_python_mysql -R all で10数台1回で更新出来ます。 参考:fabric + cuisineで管理 Fabric, Cuisine and Watchdog […]

Read full article | コメントは受け付けていません。

nagios check_http CRITICAL – Cannot make SSL connection.

12月 7th, 2012

オプションの形式を間違えていると CRITICAL – Cannot make SSL connection. が表示されるようです。 ***嘘でした。ただ-Cを付けていたので、このエラーが出ていただけでした。。。 オプションの値が間違えていると unknown | check_http: Timeout interval must be a positive integer – -s とちゃんとエラーが表示されるようです。

Read full article | コメントは受け付けていません。

nagios check iptables

11月 26th, 2012

ローテクで。 iptables -n -L > /tmp/check_itpabes_list これをrootのcronで実行させておいてnagiosで出力ファイルをチェック policy DROPされてればokを返すpluginを作成しておく。 後は、普通に外部からアクセス出来ないことを確認する。 それだけ。

Read full article | コメントは受け付けていません。

nagios active_checks_enabled

11月 25th, 2012

アクティブチェックをしないとき。 ( 継承しているhostで既に他でやっているので必要ないときなど。 host { active_checks_enabled 0 }

Read full article | コメントは受け付けていません。

nagios nrpe settings

11月 25th, 2012

pdf http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf yumで入れるだけなので サーバー側追加 plugin nagios-plugins-nrpe.x86_64 : Provides nrpe plugin for Nagios クライアント側( nagios と必要な pluginsも入れます。 nrpe.x86_64 : Host/service/network monitoring agent for Nagios クライアント側設定 /etc/nagios/nrpe.cfg server_port=25666 # 待ち受け interface server_address=192.168.0.26 # サーバー ipaddress allowed_hosts=192.168.0.170 ( iptablesでこれを許可します。 起動 $ sudo /etc/init.d/nrpe start Starting nrpe:                         […]

Read full article | コメントは受け付けていません。

nagios plugin API | pythonで書いてみる。

11月 25th, 2012

http://nagiosplug.sourceforge.net/developer-guidelines.html // http://nagios.sourceforge.net/docs/3_0/pluginapi.html 決め事はシンプルかな 基本3点 * 80字以内の1行で出力する * return code 0 OK 1 Warning 2 Critical 3 Unknown * option There are a few reserved options that should not be used for other purposes: -V version (–version) -h help (–help) -t timeout (–timeout) -w warning threshold (–warning) -c critical threshold (–critical) -H hostname (–hostname) -v […]

Read full article | コメントは受け付けていません。