MMonit安装

监控机安装M/Monit
1、安装M/Monit
M/Monit是一个管理monit的web-interface,M/Monit解压后就能运行。目前最新为M/Monit 2.4。

cd /root
wget http://mmonit.com/dist/mmonit-2.4-linux-x86.tar.gz
tar -zxvf mmonit-2.4-linux-x86.tar.gz
mv mmonit-2.4 mmonit

2、运行mmonit

cd /root/mmonit
./bin/mmonit


浏览器访问http://监控机IP:8080,默认用户名、密码:admin swordfish登陆。数据库使用自带的sqlite。

这是简单安装,如果你要使用比较高级的配置,例如不用数据库,使用其他数据库等

这个时候可以打开http:监控机(就是安装了M/Monit的那台机器):8080

就出现了登陆界面

默认用户名是:admin 密码是:swordfish

也可以用monit,monit登录,但是这个权限不是管理员权限,主要是用来给客户机使用链接MMonit的

如此登陆之后只有空界面,没有任何机器在被监控,

注意MMonit客户端支持的只有5.2以后的版本,之前的 版本不支持


还需要在客户机设置,打开monitrc配置文件,然后设在set mmonit http://monit:[email protected]:8080/collector

如此MMonit就能够监控这个客户机了




这次出现一个问题,打开客户机,发现配置文件是从/etc/monit/monitrc,而不是从/usr/local/monit/etc/monitrc加载的(我用的是monit 5.3.2版本)

起初是在后者这个配置文件修改的,发现reload之后没有效果,所以察看了一下客户机是从那里加载上来,原因正是如此,然后又把前者的配置文件修改了,reload之后就可以了




配置文件如下:


[plain] view plaincopyprint?
############################################################################### 
## Monit control file 
############################################################################### 
## 
## Comments begin with a '#' and extend through the end of the line. Keywords 
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'. 
## 
## Below you will find examples of some frequently used statements. For  
## information about the control file and a complete list of statements and  
## options, please have a look in the Monit manual. 
## 
## 
############################################################################### 
## Global section 
############################################################################### 
## 
## Start Monit in the background (run as a daemon): 

  set daemon 60            # check services at 2-minute intervals 
#   with start delay 240    # optional: delay the first check by 4-minutes (by  
#                           # default Monit check immediately after Monit start) 


## Set syslog logging with the 'daemon' facility. If the FACILITY option is 
## omitted, Monit will use 'user' facility by default. If you want to log to  
## a standalone log file instead, specify the full path to the log file 

# set logfile syslog facility log_daemon                        
  set logfile /var/log/monit.log 


## Set the location of the Monit id file which stores the unique id for the 
## Monit instance. The id is generated and stored on first Monit start. By  
## default the file is placed in $HOME/.monit.id. 

# set idfile /var/.monit.id 
  set idfile /var/lib/monit/id 

## Set the list of mail servers for alert delivery. Multiple servers may be  
## specified using a comma separator. If the first mail server fails, Monit  
# will use the second mail server in the list and so on. By default Monit uses  
# port 25 - it is possible to override this with the PORT option. 

set mailserver localhost  # primary mailserver 
#                backup.bar.baz port 10025,  # backup mailserver on port 10025 
#               localhost                   # fallback relay 


## By default Monit will drop alert events if no mail servers are available.  
## If you want to keep the alerts for later delivery retry, you can use the  
## EVENTQUEUE statement. The base directory where undelivered alerts will be  
## stored is specified by the BASEDIR option. You can limit the maximal queue 
## size using the SLOTS option (if omitted, the queue is limited by space  
## available in the back end filesystem). 

  set eventqueue 
      basedir /var/lib/monit/events # set the base directory where events will be stored 
      slots 100                     # optionally limit the queue size 


## Send status and events to M/Monit (for more informations about M/Monit  
## see http://mmonit.com/). By default Monit registers credentials with  
## M/Monit so M/Monit can smoothly communicate back to Monit and you don't 
## have to register Monit credentials manually in M/Monit. It is possible to 
## disable credential registration using the commented out option below.  
## Though, if safety is a concern we recommend instead using https when 
## communicating with M/Monit and send credentials encrypted. 

set mmonit http://monit:[email protected]:8080/collector 
#     # and register without credentials     # Don't register credentials 


## You can set alert recipients whom will receive alerts if/when a  
## service defined in this file has errors. Alerts may be restricted on  
## events by using a filter as in the second example below.  
set alert [email protected]                       # receive all alerts 
# set alert [email protected] only on { timeout }  # receive just service- 
#                                                # timeout alert 


## Monit has an embedded web server which can be used to view status of  
## services monitored and manage services from a web interface. See the 
## Monit Wiki if you want to enable SSL for the web server.  

set httpd port 2812 and 
    use address localhost  # only accept connection from localhost 
   allow localhost        # allow localhost to connect to the server andi 
   allow 10.10.17.159 
   allow admin:monit      # require user 'admin' with password 'monit' 
#  allow @monit           # allow users of group 'monit' to connect (rw) 
#  allow @users readonly  # allow users of group 'users' to connect readonly 

你可能感兴趣的:(安装)