在apache服务器上监控:为什么monit log“'apache'错误 - 未知资源ID:[5]”on / var / log / monit

问题描述 投票:0回答:1

我们正在使用Monit监控多台服务器。我们使用的是5.25.1版。有些是专用的apache服务器。监控还可以。但是monit(/ var / log / monit)的日志是这样的:

[CET Mar 18 03:12:03] info     : Starting Monit 5.25.1 daemon with http interface at [0.0.0.0]:3353
[CET Mar 18 03:12:03] info     : Monit start delay set to 180s
[CET Mar 18 03:15:03] info     : 'xxxxx.localhost' Monit 5.25.1 started
[CET Mar 18 03:15:03] error    : 'apache' error -- unknown resource ID: [5]
[CET Mar 18 03:16:08] error    : 'apache' error -- unknown resource ID: [5]
[CET Mar 18 03:17:08] error    : 'apache' error -- unknown resource ID: [5]
[CET Mar 18 03:18:08] error    : 'apache' error -- unknown resource ID: [5]

配置文件/etc/monit.conf是这样的:

###############################################################################
## Monit control file
###############################################################################

###############################################################################
## Global section
###############################################################################
##
## Start Monit in the background (run as a daemon):
# 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 daemon 60
      with start delay 180

### 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 the list of mail servers for alert delivery. Multiple servers may be
## specified using a comma separator. By default Monit uses port 25 - it is
## possible to override this with the PORT option.
#
# set mailserver mail.bar.baz,               # primary mailserver
#                backup.bar.baz port 10025,  # backup mailserver on port 10025
#                localhost                   # fallback relay

set mailserver localhost

## 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/monit  # 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/).
#
# set mmonit http://monit:[email protected]:8080/collector
#
#
## Monit by default uses the following alert mail format:
##
##
## You can override this message format or parts of it, such as subject
## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc.
## are expanded at runtime. For example, to override the sender, use:
#
# set mail-format { from: [email protected] }
#
#
## 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] not on { instance }

# receive all alerts
# set alert [email protected] only on { timeout }  # receive just service-
#                                                # timeout alert
#

mail-format {
      from: [email protected]
   subject: $SERVICE => $EVENT
   message:
DESCRIPTION : $DESCRIPTION
ACTION      : $ACTION
DATE        : $DATE
HOST        : $HOST

Sorry for the spam.
Monit
}


## 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 3353 and
use address 0.0.0.0
allow yyyyy:zzzz

###############################################################################
## SeSTART rvices
###############################################################################
##
## Check general system resources such as load average, cpu and memory
## usage. Each test specifies a resource, conditions and the action to be
## performed should a test fail.
#
check system xxxxxx.localhost
    if loadavg (1min) > 8 for 5 cycles then alert
    if loadavg (5min) > 4 for 5 cycles then alert
    if memory usage > 75% for 5 cycles then alert
    if cpu usage (user) > 70% for 5 cycles then alert
    if cpu usage (system) > 50% for 5 cycles then alert
    if cpu usage (wait) > 50% for 5 cycles then alert

check process apache with pidfile /var/run/httpd/httpd.pid
    group www
    start program = "/etc/init.d/httpd start" with timeout 60 seconds
    stop program  = "/etc/init.d/httpd stop"
    if failed host localhost port 80 then restart
    if cpu > 60% for 2 cycles then alert
    if cpu > 80% for 5 cycles then restart
    if loadavg(5min) greater than 10 for 8 cycles then restart
    if 3 restarts within 5 cycles then timeout    
###############################################################################
## Includes
###############################################################################
##
## It is possible to include additional configuration parts from other files or
## directories.
#
#  include /etc/monit.d/*
#
#

# Include all files from /etc/monit.d/
include /etc/monit.d/*

在ui monit,一切都很好。并且监控是100%有用的。我们可以停下来,重新启动我们想要的服务。

所以我不明白句子'错误:'apache'错误 - 未知资源ID:[5]'我们在monit的日志中找到了。

有人对此有所了解吗?

谢谢你的帮助。

apache server monit
1个回答
0
投票

我有同样的问题..

mmonit说loadavg仅用于“检查系统”。它曾经用于apache但不再工作..

“loadavg语句只能用于”检查系统“上下文(加载平均值是系统属性,而不是进程')。请删除以下语句并重新加载monit”

所以通过在第一个上面添加#来禁用此行:

# if loadavg(5min) greater than 10 for 8 cycles then restart

然后重启monit

service monit restart

您将不再收到apache错误。

© www.soinside.com 2019 - 2024. All rights reserved.