nagios core是免费版,目前最新已到4.3.4版。

Nagios core4.3.4 安装配置_第1张图片

nagios对windows主机active主动监控(监控机负载较大)

Nagios core4.3.4 安装配置_第2张图片

Installing the check_ncpa.py plugin
Run the following commands from the command line on your Nagios server:

cd /tmp
wget https://assets.nagios.com/downloads/ncpa/check_ncpa.tar.gz
tar xvf check_ncpa.tar.gz
chown nagios:nagios check_ncpa.py
chmod 775 check_ncpa.py
mv check_ncpa.py /usr/local/nagios/libexec
Note: If you have a different path to the nagios plugins directory, you will need to modify the last command.

To verify the version of the check_ncpa.py plugin, run the following command from the command line:

/usr/local/nagios/libexec/check_ncpa.py -V
Create the check command definition
Create the check_ncpa command in your configuration files for Nagios Core, normally they are located in /usr/local/nagios/etc - you may have a commands.cfg file you will want to put this command in. The command below will allow us to pass most of the arguments in with $ARG1$, allowing it to be more dynamic.

define command {
    command_name    check_ncpa
    command_line    $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}

Create Nagios checks
You can create the checks in a config file in /usr/local/nagios/etc. For this example we will create a config file called ncpa.cfg with the following defined:

define host {
    host_name               NCPA 2 Host
    address                 192.168.1.10
    check_command           check_ncpa!-t 'mytoken' -P 5693 -M system/agent_version
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    contacts                nagiosadmin
    notification_interval   60
    notification_period     24x7
    notifications_enabled   1
    icon_image              ncpa.png
    statusmap_image         ncpa.png
    register                1
}

nagios对windows主机passive被动监控(被监控机主动发送数据包)

Passive Checks (NRDP)
In order for passive checks to work, you have to configure your passive service to actually send the checks. By default in new installs of NCPA 2, no passive handler is configured. If you installed on Windows and set up NRDP during the install process then you will already have a configuration set up. However, it would be a good idea to take a closer look at your configuration just in case.

Add checks to your ncpa configuration
Add a new NCPA configuration file to the ncpa.cfg.d directory located in the base NCPA installation directory. Use the following outline for passive checks to send to the NRDP server of your choice.

[passive checks]
%HOSTNAME%|__HOST__ = system/agent_version
%HOSTNAME%|CPU Usage = cpu/percent --warning 60 --critical 80 --aggregate avg
%HOSTNAME%|Memory Usage = memory/virtual --warning 80 --critical 90 --units Gi
%HOSTNAME%|Process Count = processes --warning 300 --critical 400

By default, passive checks are ran on 5 minute intervals, however with
NCPA 2 you can now define a check interval in seconds by appending 
|interval to the left side of the passive check definition. An example of
a CPU check that would be performed every 30 seconds is below:
%HOSTNAME%|CPU Usage|30 = cpu/percent --warning 60 --critical 80 --aggregate avg

Configure your NRDP settings
In Nagios Core, you would need to install and configure NRDP manually.
Follow the steps, outlined in the "NRDP In Nagios Core" section of 
the NRDP - Overview document.
Once you have your settings. Edit your ncpa.cfg file to look 
something like the following:

[nrdp]
parent = http://nrdp/
token = nrdptoken
hostname = NCPA 2 Host

Enable the nrdp handler in the [passive] section of your config:

[passive]
handle = nrdp

待完善