close

之前設定 nagios 時,如果有多台主機都是在同一個群組,也要使用同樣的服務時,就要一台一台加。

但現在發現了以下的功能

nagios.cfg

 

# "TRUE" REGULAR EXPRESSION MATCHING

# This option controls whether or not "true" regular expression

# matching takes place in the object config files.  This option

# only has an effect if regular expression matching is enabled

# (see above).  If this option is DISABLED, regular expression

# matching only occurs if a string contains wildcard characters

# (* and ?).  If the option is ENABLED, regexp matching occurs

# all the time (which can be annoying).

# Values: 1 = enable true matching, 0 = disable true matching

use_true_regexp_matching=1

 

之後在host.cfg檔案中就可以使用正規表示法來設定

 

define hostgroup{

        hostgroup_name  dev-servers ; The name of the hostgroup

        alias           dev Servers ; Long name of the group

        members         dev-*  ; Comma separated list of hosts that belong to this group

        }

 

define service{

        use                             dev-service         ; Name of service template to use

        host_name                       dev-*

        service_description             PING

        check_command                   check_ping!100.0,20%!500.0,60%

        }

 

這樣一來就省下不少設定的時間了。

arrow
arrow
    文章標籤
    nagios
    全站熱搜

    johnchen6927 發表在 痞客邦 留言(0) 人氣()