使用mntos来管理多个nagios

将多个nagios接入到mntos中,实现统一的管理

1.背景

在之前的文章( 使用nagios做运维监控 )中介绍nagios的作用,以及如何安装和使用。

如果有一堆机器nagios服务,分别监控了不同的项目。可以将所有的nagios都注册到mntos中,从而可以从整体上监控所有的nagis。

2.安装mntos

  1. 下载mntos的安装包 mntos-1.0.4.tar.gz

  2. 安装

    1
    2
    3
    4
    5
    6
    cd /tmp
    wget https://assets.nagios.com/downloads/nagiosxi/scripts/NagiosXI-MNTOS-install.sh

    chmod +x NagiosXI-MNTOS-install.sh
    ./NagiosXI-MNTOS-install.sh

  3. 根据提示信息,填写配置文件(可以随便填一些,后面可以去改配置文件)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    Now enter some mntos configuration information please

    The next step is to define your contacts. This information will display in the
    sidebar of the MNTOS web interface. The fields available are:
    Name
    Address
    City, State
    Postal Code
    Country
    E-Mail Address
    Work Phone
    Private Phone
    Profession
    You may leave any of these fields blank. None are required for MNTOS operation
    - this is for your own convenience, so the person looking at the overview knows
    who to contact if there is a problem.

    Defining contact #1
    Name: test
    Address:
    City, State:
    Postal/ZIP Code:
    Country:
    E-Mail Address:
    Work Phone:
    Private Phone:
    Profession:
    Confirm: Are all of those answers correct? [Y/n] y
  4. 配置结束后,浏览器访问http://ip/mntos

    image-20230424163619761

  5. 手动去修改配置文件,将需要监控的nagios添加进来

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    [root@zmr-service /]# cd /opt/mntos-1.0.4/
    [root@zmr-service mntos-1.0.4]# vim networks.ini

    [WizardNetwork0001]
    id=1 --这个编号唯一的,有多个的这里不能重复
    location="201nagios" --名字
    network="http://192.168.1.201" --nagios服务的地址
    nagios="http://:@/nagios/cgi-bin/tac.cgi"
    public="http:///nagios/"
    contacts=1
    icon="img/globe.png" --展示的图标,可更改成自己的,放到对应的目录下就行

    ----以上为一个nagios的配置,多个就把上面的再复制遍,改一改。

  6. 再次打开浏览器访问http://ip/mntos

image-20230424163534458

点击图标,可跳转到对应的nagios页面