Nagios 3 to 4 - How to monitor a Windows host and its services
Вставка
- Опубліковано 27 лип 2024
- This is my third video of my nagios series. This video talk about hot to monitor a Windows host by Nagios. You can monitor the CPU usage, the memory usage and the disk space.
We will install the NCPA agent on the Windows host and we will configure the nagios server to monitor this Windows host.
------------------------------------
00:00 Intro
00:33 Install the NCPA agent on the Windows host
03:11 Install and configure the check_ncpa plugin on the nagios server
06:43 Test the check_ncpa command check_ncpa before adding it to the nagios server
09:25 add the configuration on the nagios server
19:28 Restart the nagios service
19:58 Nagios console verification
21:28 How to monitor the disk space.
25:17 The final word
------------------------------------
To download the NCPA agent for Windows
www.nagios.org/ncpa/
------------------------------------
If you would like to pay me a coffee to support my work.
ko-fi.com/benlinux
------------------------------------
##### Here all commands I used in this video on the monitored host
wget raw.githubusercontent.com/Nag...
cd /usr/lib/nagios/plugins
sudo chmod a+x check_ncpa.py
sudo chown nagios check_ncpa.py
sudo chgrp nagios check_ncpa.py
ls -l check_ncpa.py
sudo vi check_ncpa.py
Remove this line
#!/usr/bin/env python
Add this line
#!/usr/bin/python3
/usr/lib/nagios/plugins/check_ncpa.py -H 10.0.0.124 -t 'mot_de_passe' -P 5693 -M system/agent_version
/usr/lib/nagios/plugins/check_ncpa.py -H 10.0.0.124 -t 'mot_de_passe' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
/usr/lib/nagios/plugins/check_ncpa.py -H 10.0.0.124 -t mot_de_passe -P 5693 -M memory/virtual -w 50 -c 80 -u G
sudo vi /etc/nagios4/objects/commands.cfg
#### An excerpt from my config file: ####
define command {
command_name check_ncpa
command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
ls -l /etc/nagios4/objects/
sudo vi /etc/nagios4/objects/windowshosts.cfg
#### An excerpt from my config file: ####
define host {
name Windows-hosts-template
check_period 24x7
check_interval 10
retry_interval 1
max_check_attempts 3
notification_period workhours
notification_interval 120
notification_options d,u,r
notifications_enabled 1
contact_groups admins
contacts nagiosadmin
icon_image ncpa.png
statusmap_image ncpa.png
use generic-host
register 0
}
define host {
host_name win01
address 10.0.0.124
check_command check_ncpa!-t 'mot_de_passe' -P 5693 -M system/agent_version
hostgroups windows-hosts
use Windows-hosts-template
}
define hostgroup {
hostgroup_name windows-hosts
alias Windows Linux host
}
sudo vi /etc/nagios4/objects/windowsservices.cfg
#### An excerpt from my config file: ####
define service {
name win-services-template
max_check_attempts 5
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
use generic-service
register 0
}
define service {
service_description CPU Usage
check_command check_ncpa!-t 'sdswq233FGFG' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg'
hostgroup_name windows-hosts
use win-services-template
}
define service {
service_description Memory Usage
check_command check_ncpa!-t 'sdswq233FGFG' -P 5693 -M memory/virtual -w 50 -c 80 -u G
hostgroup_name windows-hosts
use win-services-template
}
define service {
service_description Process Count
check_command check_ncpa!-t 'sdswq233FGFG' -P 5693 -M processes -w 150 -c 200
hostgroup_name windows-hosts
use win-services-template
}
define service {
service_description Espace lecteur c
check_command check_ncpa!-t 'sdswq233FGFG' -P 5693 -M 'disk/logical/C:|' -w 90 -c 95
hostgroup_name windows-hosts
use win-services-template
}
sudo vi /etc/nagios4/nagios.cfg
add theses two lines
cfg_file=/etc/nagios4/objects/windowshosts.cfg
cfg_file=/etc/nagios4/objects/windowsservices.cfg
sudo nagios4 -v /etc/nagios4/nagios.cfg
sudo systemctl reload nagios4
------------------------------------
If you would like to pay me a coffee to support my work.
ko-fi.com/benlinux - Наука та технологія