shinken - 監控報警系統

jopen 11年前發布 | 28K 次閱讀 shinken
Shinken系統是一個nagios like 系統,作者使用python重新設計/編寫的兼容nagios的,可以直接使用nagios-plugins,
官方網站上提供了大量的插件可供下載  http://www.shinken-monitoring.org/download/
由于是重新設計、編寫的系統,其在架構和配置的便利性上要優于nagios,目錄結構非常清晰。
系統安裝完成后及自帶了很多常用的模板,使用和配置非常簡單。
其他為nagios設計的周邊系統都可以工作在是shinken下面,如:nagvis、pnp4nagios、check_mem等。

1、etc/packs  已經定義好的包,可自定義各種模板,供主機直接應用
command.cfg 定義監控命令
template.cfg   給不同的主機模板定義監控命令參數的值    
    參數名稱的特別說明:
    command.cfg 中使用                  $_HOSTMYSQLUSER$
    則template.cfg 中對應的名稱為: _MYSQLUSER   少了HOST,奇怪的設置。
    同樣  macros.cfg  的名稱與template.cfg 中一致
    template.cfg 中也可應用  macros.cfg 中定義的參數
macros.cfg      定義全局監控命令參數
mysql.pack     模板及參數說明文件
discovery.cfg  自動發現策略,用途不明
services           各種服務定義目錄
            簡單明了,每個服務一個文件,通過host_name 自動關聯到主機模板上

實例:
#cat macros.cfg 
### Mysql credentials
$MYSQLUSER$=shinken
$MYSQLPASSWORD$=passworddb

#cat template.cfg
define host{
   name           mysql-slave
   use            generic-host
   register       0
   _MYSQLUSER            $MYSQLUSER$
   _MYSQLPASSWORD    $MYSQLPASSWORD$
   _SLAVELAG_WARN 10
   _SLAVELAG_CRIT 20
}

#cat command.cfg
define command {
       command_name     check_mysql_keycache_hitrate
       command_line     $PLUGINSDIR$/check_mysql_health --hostname $HOSTADDRESS$ --username $_HOSTMYSQLUSER$ --password $_HOSTMYSQLPASSWORD$ --mode keycache-hitrate --warning $_HOSTKEYCACHEHITRATE_WARN$ --critical $_HOSTKEYCACHEHITRATE_CRIT$
}

define command {
       command_name     check_mysql_bufferpool_hitrate
       command_line     $PLUGINSDIR$/check_mysql_health --hostname $HOSTADDRESS$ --username $_HOSTMYSQLUSER$ --password $_HOSTMYSQLPASSWORD$ --mode bufferpool-hitrate --warning $_HOSTBUFFERPOOLHITRATE_WARN$ --critical $_HOSTBUFFERPOOLHITRATE_CRIT$
}


2、引用模板方法
在定義host時,使用use 將模板名稱疊加即可
define host{
        use                     linux, mysql, mysql-slave
        contact_groups          admins
        host_name               DB-141
        address                 192.168.0.141
        icon_set                server
        hostgroups              DB-MYSQL
        }
3、監控腳本與 nagios 兼容,

4、安裝
shinken 的安裝非常簡單,具體參考官方安裝文檔。
http://www.shinken-monitoring.org/wiki/shinken_10min_start
shinken自帶WEBUI,不需要其他的WebServer,當然你也可以將其掛在apache或nginx下面。

> Found installation parameters
 --> ETC=/usr/local/shinken/etc
 --> VAR=/usr/local/shinken/var
 --> LIBEXEC=/usr/local/shinken/libexec
 --> TARGET=/usr/local/shinken
 > Do you want to reuse those parameters?y

yum install python-pyro pymongo 

__ http://pypi.python.org/pypi/simplejson/
__ http://pypi.python.org/pypi/ujson/
__ http://code.google.com/p/pysqlite/
__ http://pypi.python.org/pypi/kombu/2.4.5
__ http://pypi.python.org/pypi/python-ldap/

+--------------------------------------------------------------------------------
 > Starting shinken
+------------------------------------------------------------------------------
| Shinken is now installed on your server 
| The install location is: /usr/local/shinken
| The configuration folder is: /usr/local/shinken/etc
| The Web Interface is available at: http://localhost:7767
| The default credentials for the webui are admin/admin
| You can now learn how to configure shinken at: http://www.shinken-monitoring.org/wiki
+------------------------------------------------------------------------------
 > updated configuration of module[3] passwd=/usr/local/shinken/etc/htpasswd.users updated configuration of module[3] passwd=/usr/local/shinken/etc/htpasswd.users

./install -i &&\
./install -p nagios-plugins &&\
./install -p check_mem &&\
./install -p manubulon &&\
./install -a multisite &&\
./install -a pnp4nagios &&\
./install -a nagvis &&\
./install -a mongodb

Error : you didn't defined a WebUI module for saving user preference like the Mongodb one. You won't be able to use this page!
1、vi shinken-specific.cfg
define module {
 modules Apache_passwd, ActiveDir_UI, Cfg_password, PNP_UI, Mongodb
...
module_name WebUI
...
}

2、yum install pymongo
 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!