Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Configure a Check via NSClient

Here we will need to configure NSClient to work with Nagios so that we can monitor resource consumption on a windows machine. You might have noticed that most of the work thus far has has been done on Linux. Nagios is a versatile tool that can monitor pretty much anything with a network card, so let us not exclude windows machines of which there usually are a lot in an office environment.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 30m
Published
Clock icon Jul 19, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Install NSClient on the Windows Server

    1. You first need to log in via RDP to the windows server and download the NSClient++. Use the IP address from the hands-on lab page and connect through port 3389.

    2. Open Server Manager.

    3. Click Configure this local server.

    4. Click the link next to IE Enhanced Security Configuration.

    5. Turn the enhanced security off for both Administrators and Users by selecting the Off option in the pop-up window.

    6. Click OK.

    7. Close Server Manager.

    8. Open a browser and navigate to https://sourceforge.net/projects/nscplus/

    9. Click Download.

    10. Click Run to run the file. If a warning pops up, click Run again.

    11. Once the installer has started, close the browser.

    12. In the installer window, click Next.

    13. Click the checkbox to accept the license agreement and click Next.

    14. Click Complete.

    15. Click Next.

    16. Select the checkboxes for the options Enable common check plugins and Enable NRPE server. The other checkboxes should remain unchecked.

    17. Under Allowed hosts, enter the public IP address for the Nagios server provided on the hands-on lab page.

    18. Click Next.

    19. Click Install. If Windows presents any warnings about the installation, select the option to continue the install.

    20. Run Windows Firewall with Advanced Security.

    21. Click Inbound RuleS in the left window.

    22. Click New Rule... in the right window.

    23. Select the Port option and then click Next.

    24. In the Specific local ports box, enter "5666, 12489" without quotes.

    25. Click Next.

    26. Click Next.

    27. Click Next.

    28. In the Name box, enter "MyPortRules".

    29. Click Finish.

    30. Close Windows Firewall.

    31. Click Finish in the NSC++ installer.

  2. Challenge

    Run a Manual CPU Check on the Windows Machine

    1. Log in to the lab server using the credentials provided on the hands-on lab page.

      ssh cloud_user@PUBLIC_IP_ADDRESS
      
    2. Install nrpe.

      sudo yum install nagios-plugins-nrpe nrpe
      
    3. Check to see if you can reach the Windows machine.

      sudo /usr/lib64/nagios/plugins/check_nrpe -H WINDOWS_IP_ADDRESS
      
    4. Check the CPU load of the Windows machine.

      sudo /usr/lib64/nagios/plugins/check_nrpe -H WINDOWS_IP_ADDRESS -c alias_cpu
      
  3. Challenge

    Configure the Nagios Server

    1. Open the commands.cfg file.

      sudo vim /usr/local/nagios/etc/objects/commands.cfg
      
    2. Add the following text to the file.

      define command {
      
          command_name        check_cpu
          command_line        /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
      
      }
      
      
    3. Save your changes and exit the editor.

    4. Create a windows-server.cfg file.

      sudo touch /usr/local/nagios/etc/objects/windows-server.cfg
      
    5. Edit the windows-server.cfg file from the previous step.

      sudo vim /usr/local/nagios/etc/objects/windows-server.cfg
      
    6. Add the following lines to the file. Remember to replace WINDOWS_IP_ADDRESS with the IP address provided in the hands-on lab page.

      define host {
      
          use             windows-server
          host_name       windowsSrv
          alias           winSrv
          address         WINDOWS_IP_ADDRESS
      }
      
      define hostgroup {
      
          hostgroup_name  windows-servers
          alias           win-srvs
          members         windowsSrv
      }
      
      define service {
      
          use                     generic-service
          host_name               windowsSrv
          service_description     check CPU usage
          check_command           check_cpu!alias_cpu
      }
      
    7. Save your changes and exit the editor.

    8. Open the Nagios configuration file.

      sudo vim /usr/local/nagios/etc/nagios.cfg
      
    9. Under the section for Windows machine definitions, enter the following text.

      cfg_file=/usr/local/nagios/etc/objects/windows-server.cfg
      
    10. Save your changes and exit the editor.

    11. Restart the Nagios service.

      sudo systemctl restart nagios
      
  4. Challenge

    Verify the Service is Running

    1. Open a browser window and navigate to http://PUBLIC_IP_FIRST_SERVER/nagios.

    2. Log in with the username "nagiosadmin" and the password "BlaBla321", without quotes.

    3. Click Services from the left-hand menu.

    4. Click Check CPU usage.

    5. Under Service Commands, click Re-schedule the next check of this service.

    6. In the Check Time box, enter a date and time in the near future.

    7. Click Commit.

    8. Click Services to return to the Service Status Details For All Hosts page.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans