{"id":1686,"date":"2011-08-09T17:01:14","date_gmt":"2011-08-09T17:01:14","guid":{"rendered":"https:\/\/supportex.net\/?p=1686"},"modified":"2019-05-10T20:04:34","modified_gmt":"2019-05-10T18:04:34","slug":"nagios-monitoring-virtual-windows-servers","status":"publish","type":"post","link":"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/","title":{"rendered":"Nagios: monitoring virtual Windows servers"},"content":{"rendered":"<p>I would like to propose one of the ways of monitoring of OS Windows server, which is installed on a Linux server as a virtual one. For this purpose, we will use Nagios and the program for Windows &#8211; <strong>NSClient++<\/strong>.<\/p>\n<p>First of all we need to install program <strong>NSClient++<\/strong> on the virtual machine. During the installation you have to set a password for access to data which the program provides on demand. This is a good idea not to set any allowed hosts to access. It will allow to avoid the problem when you do not know what a server will have Nagios to monitor . And, secondly, if you change Nagios server address you won&#8217;t need to make changes on all virtual Windows. Anyway, you can change it in the configuration file <strong>NSC.ini<\/strong>.<\/p>\n<p>After program installation you will need to check the file <strong>C:Program FilesNSClient++NSC.ini<\/strong> and make sure that the following modules are uncommented:<\/p>\n<blockquote><p>[Modules]<br \/>\nFileLogger.dll &#8211; logs events in the log<br \/>\nCheckSystem.dll &#8211; allows you to check system settings, CPU, memory etc.<br \/>\nCheckDisk.dll &#8211; test drive for free space<br \/>\nNSClientListener.dll &#8211; allows the utility to listen on port<\/p><\/blockquote>\n<p>All necessary shortcuts are stored under the system menu. Now you can run a check and if everything is fine and no errors appeared, you can run the service <strong>NSClient++<\/strong>. You need to restart the service after modifying program configuration file.<\/p>\n<p>And now you can configure the firewall of the host-server. Add a rule to forward packets to the internal network on port <strong>12489<\/strong>. This port is used by program NSClient++ by default. Pay attention to the used protocol, it should be <strong>TCP<\/strong>. Also, the following rules should be inserted into the top of the table, because if you add the rules as usually they will be at the bottom of the table and other rules can overlap it. It is very important in the case of virtual machines, since the implementation of any of the schemes of virtualization will always have enough large number of rules added to the firewall of the host-server.<\/p>\n<p>EXT_IP &#8211; IP of the host server on which Nagios will make requests<br \/>\nINT_IP &#8211; IP virtual Windows, which is located on the internal network<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">iptables -t nat -I PREROUTING 1 -d EXT_IP -p tcp --dport 12489 -j DNAT --to-destination INT_IP:12489\niptables -t nat -I POSTROUTING 1 -s INT_IP -p tcp --sport 12489 -j SNAT --to-source EXT_IP:12489\niptables -I FORWARD 1-p tcp --dport 12489 -j ACCEPT<\/pre>\n<p>Do not forget to run iptables-save to save rules, otherwise they will be lost after the first restart.<\/p>\n<p>Now you can proceed to configure the service in Nagios.<br \/>\nFirst, setup the plugin for Nagios <strong>nagios-plugins-nt<\/strong> on the host-server, if it was not done before.<br \/>\nSecond, before setting up the service in Nagios, make sure that everything works correctly. To do it you can run from the command line:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">[Root @ host-server ~] # \/usr\/lib64\/nagios\/plugins\/check_nt -H EXT_IP -p 12489 -s pass -v USEDDISKSPACE -w 30 -c 40 -d SHOWALL -l c\nc: - total: 49.90 Gb - used: 29.63 Gb (59%) - free 20.27 Gb (41%) | 'c: Used Space' = 29.63Gb; 14.97; 19.96; 0.00; 49.90<\/pre>\n<p>It&#8217;s an example of free space check on disk C:. If everything goes well, you can proceed configuring services in Nagios.<\/p>\n<p>In Nagios has quite a lot of pre-configured services to work with NSClient++. The configuration file <strong>windows.cfg<\/strong> contains many entries like:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">define service {\nuse generic-service\nhost_name winserver\nservice_description NSClient + + Version\ncheck_command check_nt! CLIENTVERSION\n}<\/pre>\n<p>As you can see here we use <strong>check_nt<\/strong>, which we ran from the command line earlier. In the configuration file <strong>commands.cfg<\/strong> command check_nt is defined as follows:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\"># 'Check_nt' command definition<\/code><br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">define command {<\/code><br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">command_name check_nt<\/code><br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">command_line $ USER1 $ \/ check_nt-H $ HOSTADDRESS $-p 12 489-v $ ARG1 $ $ ARG2 $<\/code><br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">}<\/code><\/p>\n<p>Thus, pre-configured services will be enough to cover most of the parameters on the virtual Windows. More complex tests that can get some parameters look as follows:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">define service {<\/code><br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">use generic-service<\/code><br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">host_name winserver<\/code><br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">service_description CPU Load<\/code><br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">check_command check_nt! CPULOAD!-l 5,80,90<\/code><br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">}<\/code><\/p>\n<p>So that&#8217;s all you need to setup a convenient monitoring of virtual machines based on Windows.<\/p>\n<p><strong>Didn&#8217;t find the answer to your question? <a href=\"\/contacts\/\">Ask it<\/a> our administrators to reply we will publish on website.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I would like to propose one of the ways of monitoring of OS Windows server, which is installed on a Linux server as a virtual one. For this purpose, we will use Nagios and the program for Windows &#8211; NSClient++. First of all we need to install program NSClient++ on the virtual machine. During the&hellip; <\/p>\n<div class=\"readmore-wrapper\"><a href=\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/\" class=\"more-link\">Read <\/a><\/div>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[152],"tags":[275,161,201,235],"class_list":["post-1686","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux","tag-monitoring","tag-nagios-en","tag-windows"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Nagios: monitoring virtual Windows servers &#8211; Supportex.NET blog<\/title>\n<meta name=\"description\" content=\"How to monitoring virtual Windows server with Nagios at Linux host.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Nagios: monitoring virtual Windows servers &#8211; Supportex.NET blog\" \/>\n<meta property=\"og:description\" content=\"How to monitoring virtual Windows server with Nagios at Linux host.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/\" \/>\n<meta property=\"og:site_name\" content=\"Supportex.NET blog\" \/>\n<meta property=\"article:published_time\" content=\"2011-08-09T17:01:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-10T18:04:34+00:00\" \/>\n<meta name=\"author\" content=\"naum\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"naum\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/\"},\"author\":{\"name\":\"naum\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/ab7a0bf7efe46e9dc010c1e1fd28daf1\"},\"headline\":\"Nagios: monitoring virtual Windows servers\",\"datePublished\":\"2011-08-09T17:01:14+00:00\",\"dateModified\":\"2019-05-10T18:04:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/\"},\"wordCount\":588,\"commentCount\":0,\"keywords\":[\"linux\",\"monitoring\",\"nagios\",\"windows\"],\"articleSection\":[\"linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/\",\"url\":\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/\",\"name\":\"Nagios: monitoring virtual Windows servers &#8211; Supportex.NET blog\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\"},\"datePublished\":\"2011-08-09T17:01:14+00:00\",\"dateModified\":\"2019-05-10T18:04:34+00:00\",\"author\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/ab7a0bf7efe46e9dc010c1e1fd28daf1\"},\"description\":\"How to monitoring virtual Windows server with Nagios at Linux host.\",\"breadcrumb\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/supportex.net\/blog\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Nagios: monitoring virtual Windows servers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\",\"url\":\"https:\/\/supportex.net\/blog\/en\/\",\"name\":\"Supportex.NET blog\",\"description\":\"Server and network management company\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/ab7a0bf7efe46e9dc010c1e1fd28daf1\",\"name\":\"naum\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b709913054e259673da785d4982cd4ae?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b709913054e259673da785d4982cd4ae?s=96&d=mm&r=g\",\"caption\":\"naum\"},\"url\":\"https:\/\/supportex.net\/blog\/author\/naum\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Nagios: monitoring virtual Windows servers &#8211; Supportex.NET blog","description":"How to monitoring virtual Windows server with Nagios at Linux host.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/","og_locale":"en_US","og_type":"article","og_title":"Nagios: monitoring virtual Windows servers &#8211; Supportex.NET blog","og_description":"How to monitoring virtual Windows server with Nagios at Linux host.","og_url":"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/","og_site_name":"Supportex.NET blog","article_published_time":"2011-08-09T17:01:14+00:00","article_modified_time":"2019-05-10T18:04:34+00:00","author":"naum","twitter_misc":{"Written by":"naum","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/#article","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/"},"author":{"name":"naum","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/ab7a0bf7efe46e9dc010c1e1fd28daf1"},"headline":"Nagios: monitoring virtual Windows servers","datePublished":"2011-08-09T17:01:14+00:00","dateModified":"2019-05-10T18:04:34+00:00","mainEntityOfPage":{"@id":"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/"},"wordCount":588,"commentCount":0,"keywords":["linux","monitoring","nagios","windows"],"articleSection":["linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/","url":"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/","name":"Nagios: monitoring virtual Windows servers &#8211; Supportex.NET blog","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/en\/#website"},"datePublished":"2011-08-09T17:01:14+00:00","dateModified":"2019-05-10T18:04:34+00:00","author":{"@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/ab7a0bf7efe46e9dc010c1e1fd28daf1"},"description":"How to monitoring virtual Windows server with Nagios at Linux host.","breadcrumb":{"@id":"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/supportex.net\/blog\/2011\/08\/nagios-monitoring-virtual-windows-servers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/supportex.net\/blog\/en\/"},{"@type":"ListItem","position":2,"name":"Nagios: monitoring virtual Windows servers"}]},{"@type":"WebSite","@id":"https:\/\/supportex.net\/blog\/en\/#website","url":"https:\/\/supportex.net\/blog\/en\/","name":"Supportex.NET blog","description":"Server and network management company","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/ab7a0bf7efe46e9dc010c1e1fd28daf1","name":"naum","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b709913054e259673da785d4982cd4ae?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b709913054e259673da785d4982cd4ae?s=96&d=mm&r=g","caption":"naum"},"url":"https:\/\/supportex.net\/blog\/author\/naum\/"}]}},"_links":{"self":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/1686","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/comments?post=1686"}],"version-history":[{"count":2,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/1686\/revisions"}],"predecessor-version":[{"id":3219,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/1686\/revisions\/3219"}],"wp:attachment":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/media?parent=1686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/categories?post=1686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/tags?post=1686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}