{"id":11515,"date":"2019-03-14T10:26:50","date_gmt":"2019-03-14T10:26:50","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=11515"},"modified":"2019-03-14T10:26:50","modified_gmt":"2019-03-14T10:26:50","slug":"how-to-add-windows-host-to-nagios-monitoring-server","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/14\/how-to-add-windows-host-to-nagios-monitoring-server\/","title":{"rendered":"How to Add Windows Host to Nagios Monitoring Server"},"content":{"rendered":"<p>This article describes how to monitor\u00a0<strong>Windows<\/strong>\u00a0machines \u201c<strong>private<\/strong>\u201d services such as\u00a0<strong>CPU load<\/strong>,\u00a0<strong>Disk usage<\/strong>,\u00a0<strong>Memory usage,<\/strong>\u00a0<strong>Services<\/strong>, etc. For this, we required to install an\u00a0<strong>NSClient++<\/strong>\u00a0addon on the\u00a0<strong>Windows<\/strong>\u00a0machine. The addon acts a proxy between the\u00a0<strong>Windows<\/strong>\u00a0machine and\u00a0<strong>Nagios<\/strong>\u00a0and monitors actual services by communicating with the\u00a0<strong>check_nt<\/strong>\u00a0plugin. The\u00a0<strong>check_nt<\/strong>\u00a0plugin already installed on the\u00a0<strong>Nagios Monitoring Server<\/strong>, if you followed our\u00a0<strong>Nagios<\/strong>\u00a0installation guide.<\/p>\n<p>We assume that you\u2019ve already installed and configured\u00a0<strong>Nagios<\/strong>\u00a0server according to our following guides.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/install-nagios-in-linux\/\" target=\"_blank\" rel=\"noopener\">How to Install Nagios 4.0.1 on RHEL\/CentOS 6.x\/5.x and Fedora 19\/18\/17<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/how-to-add-linux-host-to-nagios-monitoring-server\/\" target=\"_blank\" rel=\"noopener\">Add Linux Host to Nagios Monitoring Server<\/a><\/li>\n<\/ol>\n<p>To monitor\u00a0<strong>Windows Machines<\/strong>\u00a0you will need to follow several steps and they are:<\/p>\n<ol>\n<li>Install NSClient++ addon on the Windows Machine.<\/li>\n<li>Configure Nagios Server for monitoring Windows Machine.<\/li>\n<li>Add new host and service definitions for Windows machine monitoring.<\/li>\n<li>Restart the Nagios Service.<\/li>\n<\/ol>\n<p>To make this guide simple and easier, a few of configuration already done for you in the\u00a0<strong>Nagios<\/strong>\u00a0installation.<\/p>\n<ol>\n<li>A\u00a0<strong>check_nt<\/strong>\u00a0command definition already added to the\u00a0<strong>command.cfg<\/strong>\u00a0file. This definition command is used by\u00a0<strong>check_nt<\/strong>\u00a0plugin to monitor Windows services.<\/li>\n<li>A windows-server host\u00a0<strong>template<\/strong>\u00a0already created in the\u00a0<strong>templates.cfg<\/strong>\u00a0file. This template allows you to add new Windows host definitions.<\/li>\n<\/ol>\n<p>The above two files \u201c<strong>command.cfg<\/strong>\u201d and \u201c<strong>templates.cfg<\/strong>\u201d files can be found at\u00a0<strong>\/usr\/local\/nagios\/etc\/objects\/<\/strong>directory. You can modify and add your own definitions that suits your requirement. But, I\u2019d recommend you to follow the instructions described in this article and you will be successfully monitoring your windows host in less than\u00a0<strong>20 minutes<\/strong>.<\/p>\n<h3>Step 1: Installing NSClient++ Agent on Windows Machine<\/h3>\n<p>Please use the below instructions to install\u00a0<strong>NSClient++ Agent<\/strong>\u00a0on the\u00a0<strong>Remote Windows Host<\/strong>. First download the latest stable version\u00a0<strong>NSClient++ 0.3.1<\/strong>\u00a0addon source files, which can be found at below link.<\/p>\n<ol>\n<li><a href=\"https:\/\/sourceforge.net\/projects\/nscplus\/\" target=\"_blank\" rel=\"nofollow noopener\">http:\/\/sourceforge.net\/projects\/nscplus\/<\/a><\/li>\n<\/ol>\n<p>Once you\u2019ve downloaded latest stable version, unzip the\u00a0<strong>NSClient++<\/strong>\u00a0files into a new\u00a0<strong>C:\\NSClient++<\/strong>\u00a0directory.<\/p>\n<p>Now open a\u00a0<strong>MS-DOS<\/strong>\u00a0command prompt from the\u00a0<strong>Start Screen<\/strong>\u00a0\u2013&gt;\u00a0<strong>Run<\/strong>\u00a0\u2013&gt; type \u2018<strong>cmd<\/strong>\u2018 and press enter and change to the\u00a0<strong>C:\\NSClient++<\/strong>\u00a0directory.<\/p>\n<pre>C:\\NSClient++<\/pre>\n<p>Next, register the\u00a0<strong>NSClient++<\/strong>\u00a0service on the system with the following command.<\/p>\n<pre>nsclient++ \/install<\/pre>\n<p>Finally, install the\u00a0<strong>NSClient++ systray<\/strong>\u00a0with the following command.<\/p>\n<pre>nsclient++ SysTray<\/pre>\n<p>Open the\u00a0<strong>Windows Services Manager<\/strong>\u00a0and right click on\u00a0<strong>NSClient<\/strong>\u00a0go to\u00a0<strong>Properties<\/strong>\u00a0and then \u2018<strong>Log On<\/strong>\u2018 tab and click the check box that says \u201c<strong>Allow service to interact with the desktop<\/strong>\u201c. If it isn\u2019t already allowed, please check the box to allow it to.<\/p>\n<div id=\"attachment_4815\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Install-NSClient++.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4815\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Install-NSClient++-620x413.png\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Install-NSClient++-620x413.png 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Install-NSClient++.png 1017w\" alt=\"Install NSClient++\" width=\"620\" height=\"413\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Install NSClient++<\/p>\n<\/div>\n<p>Open\u00a0<strong>NSC.INI<\/strong>\u00a0file located at\u00a0<strong>C:\\NSClient++<\/strong>\u00a0directory and uncomment all the modules defined in the \u201c<strong>modules<\/strong>\u201d section, except for\u00a0<strong>CheckWMI.dll<\/strong>\u00a0and\u00a0<strong>RemoteConfiguration.dll<\/strong>.<\/p>\n<pre>[modules]\r\n;# NSCLIENT++ MODULES\r\n;# A list with DLLs to load at startup.\r\n;  You will need to enable some of these for NSClient++ to work.\r\n; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !\r\n; *                                                               *\r\n; * N O T I C E ! ! ! - Y O U   H A V E   T O   E D I T   T H I S *\r\n; *                                                               *\r\n; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !\r\n<strong>FileLogger.dll\r\nCheckSystem.dll\r\nCheckDisk.dll\r\nNSClientListener.dll\r\nNRPEListener.dll\r\nSysTray.dll\r\nCheckEventLog.dll\r\nCheckHelpers.dll<\/strong>\r\n;CheckWMI.dll\r\n;\r\n; RemoteConfiguration IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS!\r\n;RemoteConfiguration.dll\r\n; NSCA Agent is a new beta module use with care!\r\n;NSCAAgent.dll\r\n; LUA script module used to write your own \"check deamon\" (sort of) early beta.\r\n;LUAScript.dll\r\n; Script to check external scripts and\/or internal aliases, early beta.\r\n;CheckExternalScripts.dll\r\n; Check other hosts through NRPE extreme beta and probably a bit dangerous! :)\r\n;NRPEClient.dll<\/pre>\n<p>Uncomment the \u201c<strong>allowed_hosts<\/strong>\u201d in the \u201c<strong>Settings<\/strong>\u201d section and define the\u00a0<strong>IP address<\/strong>\u00a0of your\u00a0<strong>Nagios Monitoring Server<\/strong>\u00a0or leave it blank to allow any hosts to connect.<\/p>\n<pre>[Settings]\r\n;# ALLOWED HOST ADDRESSES\r\n;  This is a comma-delimited list of IP address of hosts that are allowed to talk to the all daemons.\r\n;  If leave this blank anyone can access the deamon remotly (NSClient still requires a valid password).\r\n;  The syntax is host or ip\/mask so 192.168.0.0\/24 will allow anyone on that subnet access\r\nallowed_hosts=<strong>172.16.27.41\r\n<\/strong><\/pre>\n<p>Uncomment the \u201c<strong>port<\/strong>\u201d in the \u201c<strong>NSClient<\/strong>\u201d section and set to default port \u2018<strong>12489<\/strong>\u2018. Make sure to open \u2018<strong>12489<\/strong>\u2018 port on\u00a0<strong>Windows Firewall<\/strong>.<\/p>\n<pre>[NSClient]\r\n;# NSCLIENT PORT NUMBER\r\n;  This is the port the NSClientListener.dll will listen to.\r\nport=<strong>12489\r\n<\/strong><\/pre>\n<p>Finally start the\u00a0<strong>NSClient++<\/strong>\u00a0service with the following command.<\/p>\n<pre>nsclient++ \/start<\/pre>\n<p>If your properly installed and configured, you should see a new icon in the system tray in yellow circle with a black \u2018<strong>M<\/strong>\u2018 inside.<\/p>\n<h3>Step 2: Configuring Nagios Server and Add Windows Hosts<\/h3>\n<p>Now Login into\u00a0<strong>Nagios Server<\/strong>\u00a0and add some\u00a0<strong>object definitions<\/strong>\u00a0in\u00a0<strong>Nagios<\/strong>\u00a0configuration files to monitor new\u00a0<strong>Windows<\/strong>\u00a0machine. Open\u00a0<strong>windows.cfg<\/strong>\u00a0file for editing with\u00a0<strong>Vi<\/strong>\u00a0editor.<\/p>\n<pre>[root@tecmint]# vi \/usr\/local\/nagios\/etc\/objects\/windows.cfg<\/pre>\n<p>A sample Windows host definition already defined for the Windows machine, you can simply change the host definition like\u00a0<strong>host_name<\/strong>,\u00a0<strong>alias<\/strong>, and\u00a0<strong>address<\/strong>\u00a0fields to appropriate values of your\u00a0<strong>Windows<\/strong>\u00a0machine.<\/p>\n<pre>###############################################################################\r\n###############################################################################\r\n#\r\n# HOST DEFINITIONS\r\n#\r\n###############################################################################\r\n###############################################################################\r\n\r\n# Define a host for the Windows machine we'll be monitoring\r\n# Change the host_name, alias, and address to fit your situation\r\n\r\ndefine host{\r\n        use             windows-server  ; Inherit default values from a template\r\n        host_name       winserver       ; The name we're giving to this host\r\n        alias           My Windows Server       ; A longer name associated with the host\r\n        address         172.31.41.53    ; IP address of the host\r\n        }<\/pre>\n<p>Following services are already added and enabled in\u00a0<strong>windows.cfg<\/strong>\u00a0file. If you wish to add some more other service definitions that needs to be monitored, you can simple add those definitions to same configuration file. Make sure to change the\u00a0<strong>host_name<\/strong>\u00a0for these all services with\u00a0<strong>host_name<\/strong>\u00a0defined in the above step.<\/p>\n<pre>define service{\r\n\tuse\t\t\tgeneric-service\r\n\thost_name\t\twinserver\r\n\tservice_description\tNSClient++ Version\r\n\tcheck_command\t\tcheck_nt!CLIENTVERSION\r\n\t}\r\n\r\nAdd the following service definition to monitor the uptime of the Windows server.\r\n\r\ndefine service{\r\n\tuse\t\t\tgeneric-service\r\n\thost_name\t\twinserver\r\n\tservice_description\tUptime\r\n\tcheck_command\t\tcheck_nt!UPTIME\r\n\t}\r\n\r\nAdd the following service definition to monitor the CPU utilization on the Windows server and generate a CRITICAL alert if the 5-minute CPU load is 90% or more or a WARNING alert if the 5-minute load is 80% or greater.\r\n\r\ndefine service{\r\n\tuse\t\t\tgeneric-service\r\n\thost_name\t\twinserver\r\n\tservice_description\tCPU Load\r\n\tcheck_command\t\tcheck_nt!CPULOAD!-l 5,80,90\r\n\t}\r\n\r\nAdd the following service definition to monitor memory usage on the Windows server and generate a CRITICAL alert if memory usage is 90% or more or a WARNING alert if memory usage is 80% or greater.\r\n\r\ndefine service{\r\n\tuse\t\t\tgeneric-service\r\n\thost_name\t\twinserver\r\n\tservice_description\tMemory Usage\r\n\tcheck_command\t\tcheck_nt!MEMUSE!-w 80 -c 90\r\n\t}\r\n\r\nAdd the following service definition to monitor usage of the C:\\ drive on the Windows server and generate a CRITICAL alert if disk usage is 90% or more or a WARNING alert if disk usage is 80% or greater.\r\n\r\ndefine service{\r\n\tuse\t\t\tgeneric-service\r\n\thost_name\t\twinserver\r\n\tservice_description\tC:\\ Drive Space\r\n\tcheck_command\t\tcheck_nt!USEDDISKSPACE!-l c -w 80 -c 90\r\n\t}\r\n\r\nAdd the following service definition to monitor the W3SVC service state on the Windows machine and generate a CRITICAL alert if the service is stopped.\r\n\r\ndefine service{\r\n\tuse\t\t\tgeneric-service\r\n\thost_name\t\twinserver\r\n\tservice_description\tW3SVC\r\n\tcheck_command\t\tcheck_nt!SERVICESTATE!-d SHOWALL -l W3SVC\r\n\t}\r\n\r\nAdd the following service definition to monitor the Explorer.exe process on the Windows machine and generate a CRITICAL alert if the process is not running.\r\n\r\ndefine service{\r\n\tuse\t\t\tgeneric-service\r\n\thost_name\t\twinserver\r\n\tservice_description\tExplorer\r\n\tcheck_command\t\tcheck_nt!PROCSTATE!-d SHOWALL -l Explorer.exe\r\n\t}<\/pre>\n<p>Lastly, uncomment the\u00a0<strong>windows.cfg<\/strong>\u00a0file in<strong>\u00a0\/usr\/local\/nagios\/etc\/nagios.cfg<\/strong>.<\/p>\n<pre>[root@tecmint]# vi \/usr\/local\/nagios\/etc\/nagios.cfg<\/pre>\n<pre># Definitions for monitoring a Windows machine\r\n<strong>cfg_file=\/usr\/local\/nagios\/etc\/objects\/windows.cfg\r\n<\/strong><\/pre>\n<p>Finally, verify the\u00a0<strong>Nagios<\/strong>\u00a0configuration files for any erros.<\/p>\n<pre>[root@tecmint]# \/usr\/local\/nagios\/bin\/nagios -v \/usr\/local\/nagios\/etc\/nagios.cfg<\/pre>\n<pre>Total Warnings: 0\r\nTotal Errors:   0\r\n\r\nThings look okay - No serious problems were detected during the pre-flight check<\/pre>\n<p>If the verification process throws any error messages, fix those errors until the verification process completes without any error messages. Once\u2019 you fix those errors, restart the Nagios service.<\/p>\n<pre>[root@tecmint]# service nagios restart\r\n\r\nRunning configuration check...done.\r\nStopping nagios: done.\r\nStarting nagios: done.<\/pre>\n<p>That\u2019s it. Now go to Nagios Monitoring Web interface at \u201c<strong>http:\/\/Your-server-IP-address\/nagios<\/strong>\u201d or \u201c<strong>http:\/\/FQDN\/nagios<\/strong>\u201d and Provide the username \u201c<strong>nagiosadmin<\/strong>\u201d and password. Check that the\u00a0<strong>Remote Windows Host<\/strong>\u00a0was added and is being monitored.<\/p>\n<div id=\"attachment_4816\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Windows-Host.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4816\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Windows-Host-620x387.png\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Windows-Host-620x387.png 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Windows-Host.png 1024w\" alt=\"Nagios Monitor Windows Host\" width=\"620\" height=\"387\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Nagios Monitor Windows Host<\/p>\n<\/div>\n<p>That\u2019s it! for now, in my up-coming article I will show you how to add\u00a0<strong>Printer<\/strong>\u00a0and\u00a0<strong>Switches<\/strong>\u00a0to\u00a0<strong>Nagios Monitoring Server<\/strong>. If you\u2019re having any difficulties while adding\u00a0<strong>Windows<\/strong>\u00a0host to\u00a0<strong>Nagios<\/strong>. Please do comment your queries via comment section, till then stay tuned to\u00a0<strong>Tecmint.com<\/strong>\u00a0for more such kind of valuable articles.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/how-to-add-windows-host-to-nagios-monitoring-server\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article describes how to monitor\u00a0Windows\u00a0machines \u201cprivate\u201d services such as\u00a0CPU load,\u00a0Disk usage,\u00a0Memory usage,\u00a0Services, etc. For this, we required to install an\u00a0NSClient++\u00a0addon on the\u00a0Windows\u00a0machine. The addon acts a proxy between the\u00a0Windows\u00a0machine and\u00a0Nagios\u00a0and monitors actual services by communicating with the\u00a0check_nt\u00a0plugin. The\u00a0check_nt\u00a0plugin already installed on the\u00a0Nagios Monitoring Server, if you followed our\u00a0Nagios\u00a0installation guide. We assume that you\u2019ve already &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/14\/how-to-add-windows-host-to-nagios-monitoring-server\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Add Windows Host to Nagios Monitoring Server&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11515","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=11515"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11515\/revisions"}],"predecessor-version":[{"id":11516,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/11515\/revisions\/11516"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=11515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=11515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=11515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}