shinken - 监控报警系统
                 jopen
                 13年前
            
                    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