Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nagios uses NSCient to monitor remote window hosts

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Abstract: 1. NSCient principle

2. The difference between NSClient++ and NRPE NSClient++

3. The monitoring of window host by Nagios

1 introduction

There are three main ways for Nagios to monitor Windows hosts: the first is NSclient++, the second is NRPE, and the third is SNMP (not very commonly used).

1.1 how NSClient works

NSClient++ is a component installed on a Windows host when it is used to monitor the Windows host. NSClient, is installed on the monitored machine when the monitoring host sends the monitoring request to NSClient, NSClient directly completes the monitoring, and all monitoring is completed by NSClient. No additional plug-ins are required.

NSClient++ official website: http://www.nsclient.org/

How 1.2NRPE works

1.3 the biggest difference between NSclient++ and nrpe

A big problem with NSclient++ is its inflexibility and lack of extensibility. It can only complete its own monitoring operations and cannot be extended by some plug-ins. Fortunately, NSclient++ has done a good job, basically can fully meet our monitoring needs.

2 NSClient++ installation 2.1 software version: NSCP-0.5.2.35-x64.msi

Download address: http://www.nsclient.org/download/

2.2 install the plug-in

2.3 View NSClient++ profile

By default, it is installed in the C:\ Program Files\ NSClient++ directory. NSC.ini is the configuration file of the NSClient service. Generally, we do not need to modify it, but when the IP address of our monitor is changed, or the password is forgotten, we can modify it here.

2.4 check the listening port

3 introduction to the syntax of configuring nagios server 3.1 plug-ins

NSClient++ monitors your host window through the check_nt plugin. Let's first understand the check_nt syntax.

Syntax: check_nt-H host-v variable [- p port] [- w warning] [- c critical] [- l params] [- d SHOWALL] [- u] [- t timeout] option:-h,-help display help

-V,-- version displays version information

-H,-- hostname=HOST monitored host name or IP

-p,-- port=INTEGER monitoring port (default is 1248, but my nagios installation port is 12489)

-s,-- password required by secret=

-w,-- the threshold of the alarm state caused by warning=INTEGER

-c,-- threshold for critical=INTEGER causing critical error state

-t,-- timeout=INTEGER connection attempt timeout seconds (default-l,-- params= parameter passed to the specified monitor item (see below)

-d,-- display= {SHOWALL} display options (currently only SHOWALL is supported)

-u,-- how long will it take for unknown-timeout to return UNKNOWN)

-v,-- variable=STRING monitoring parameters monitoring parameters: CLIENTVERSION = Get the NSClient version if the version number is specified with-l, the alarm will be given when the version is different

CPULOAD = average load of CPU in the last X minutes.

-l format is:-l,. The time range cannot exceed 24 minutes or 60 minutes.

The threshold is a percentage, and you can monitor up to 10 thresholds at a time, for example: ie:-l 60pr 90men95ju 120je 90jen 95

UPTIME = get the mainframe boot time. There are no specified parameters, no alarm and error threshold.

USEDDISKSPACE = specifies the utilization of the disk. Only-l is required to specify the drive letter of the disk. Specify the alarm threshold with-w and specify the wrong threshold with-c

MEMUSE = memory usage. Specify the alarm threshold with-w and specify the wrong threshold with-c

SERVICESTATE = monitors the status of one or more services. The format of-l is:-l,. You can use-d SHOWALL to specify that the status of a service is returned.

PROCSTATE = monitors whether one or more processes are running. The format of the command is similar to SERVICESTAT

The format of-l is:-l "\\ counter". The "" description parameter is optional and is only used for counters that require floating point numbers to be output.

[root@nagios ~] # cd / usr/local/nagios/libexec/

[root@nagios libexec] #. / check_nt-H 192.168.4.56-p 12489-v UPTIME

System Uptime-0 day (s) 0 hour (s) 0 minute (s) | uptime=0

Average over the past 5 minutes, 80% of warnings and 90% of emergencies

[root@nagios libexec] #. / check_nt-H 192.168.4.56-p 12489-v CPULOAD-w 80-c 90-l 5Jing 80J 90

CPU Load 0% (5 min average) |'5 min avg Load'=0%;80;90;0;100

3.2 define commands, hosts, services

(1) define commands

'check_nt' command definition

Define command {

Command_name check_nt

Command_line $USER1 $/ check_nt-H $HOSTADDRESS$-p 12489-v $ARG1 $$ARG2 $

}

Note: $.. $represents the system's built-in macros, so-called variables

$USER1 $indicates the directory where the plug-in is located-

H specify host address

The address of the host to which the $HOSTADDRESS$ is applied

The parameter passed by $ARG1 $. The parameter-s specifies that the password is empty by default.

(2) define hosts and services

[root@nagios etc] # cd / usr/local/nagios/etc/objects/

[root@nagios objects] # cp windows.cfg win10.cfg

[root@nagios objects] # sed-I's win10.cfg Window10 server win10.cfg

[root@nagios objects] # sed-I's win10.cfg 192.168.1.2 to 192.168.4.56

3.3 add host information to the nagios main configuration file

[root@nagios etc] # vim / usr/local/nagios/etc/nagios.cfg

Cfg_file=/usr/local/nagios/etc/objects/win10.cfg

3.4 check profile syntax

[root@nagios objects] # service nagios configtest

Total Warnings: 0

Total Errors: 0

Things look okay-No serious problems were detected during the pre-flight check

Object precache file created:

/ usr/local/nagios/var/objects.precache

3.4 restart the nagios service

[root@nagios objects] # service nagios restart

Running configuration check...

Stopping nagios: done.

Starting nagios: done.

4 browsers to view monitoring results

4.1 Click Current Status-> Hosts on the left

4.2 Click Current Status-> Services to view service monitoring

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report