Nagios 添加别名
1. 针对check_mk监控的服务器:
修改文件:/etc/check_mk/main.mk
添加方法:
extra_host_conf["alias"] = [
( "<ALIAS DESCRITPION", ["<HOSTNAME>"] )
]
( "<ALIAS DESCRITPION", ["<HOSTNAME>"] )
]
例如:
extra_host_conf["alias"] = [
( "abc", ["11.11.0.103"])
]
( "abc", ["11.11.0.103"])
]
如果添加的别名中含有中文,需要在文件开头申明:
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
例如:
extra_host_conf["alias"] = [( "地铁一号线/高桥站/设备机房/数据库服务器", ["11.11.0.103"])
]
2. 添加监控机自己的别名:
修改文件:/usr/local/nagios/etc/objects/localhost.cfg
修改内容:
原内容:
define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name localhost
alias localhost
address 127.0.0.1
}
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name localhost
alias localhost
address 127.0.0.1
}
修改后:
define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name localhost
alias monitor address 127.0.0.1
}
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name localhost
alias monitor address 127.0.0.1
}
Comments
Post a Comment