How to set up monitoring with SNMP Polling

Version 4 by Bren Eckles
on Oct 19, 2018 11:42.

compared with
Current by Bren Eckles
on Oct 22, 2018 09:58.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (30)

View Page History
h5. Overview

{section}{column:width=68%}This page shows how to apply SNMP polling checks in your GroundWork Monitor system to monitor status and availability of a many different types of IT equipment. The appropriate service profile needs to be made available for use, you can then create a host definition for your managed host and attach the profile to the definition. Make sure you are using the same community string, test your work, and if all is well the monitoring should begin.{column}
{column:width=32%}{column}{section}

h5. Steps

h6. Configuring the GroundWork server
h6. Import the SNMP service profile

In this these first steps you'll configure the GroundWork server side.

# Import the SNMP service profile, go to *Configuration* > *Profiles* > *Profile Importer* > *Import* > *SNMP*.
# Check the box for *Windows 2003 Service Profile 6.1-1*, or other SNMP profiles depending on your needs.
# Select *Import*.
\\
\\ !01_bookshelf_how_to_snmp_polling.png|alt="Importing service profile",title="Importing service profile"!\\
\\
# Next, create a host definition for your the monitored system, go to *Configuration* > *Hosts* > *Host wizard*.
# Provide the Host Vitals (host name, alias, IP address), and select the host profile *host-profile-service-ping*, and for now select *Next>>* three times by passing some directives.
\\
\\ !02_bookshelf_how_to_snmp_polling.png|alt="Creating a host",title="Creating a host"!\\
\\
# You'll then be positioned on the *Host Properties 3* screen.
# From the drop-down box choose the profile for SNMP (e.g., *snmp-win2k3*) and make sure to click *Add Profile*. You should see the profile added under the _Service Profiles_ section.
# Select *Next>>*, then *Continue*, and *Cancel* since you're finished.
\\
\\ !03_bookshelf_how_to_snmp_polling.png|alt="Select host profile",title="Select host profile"!
* Import the SNMP service profile:
** Go to _Configuration_ > _Profiles_ > _Profile Importer_ > _Import_ > _SNMP_, and check the box for _Windows 2003 Service Profile 6.1-1_, or other SNMP profiles depending on your needs, and import.
* Create a new host:
** Add a host definition for your the monitored system providing the host vitals and the {{host-profile-service-ping}} host profile. Make your way to the _Host Properties 3_ screen and select the profile for SNMP (e.g.,{{snmp-win2k3}}) and make sure to click _Add Profile_. You should see the profile added under the _Service Profiles_ section.
** Continue by selecting ;_Next>>_, then _Continue_, and _Cancel_ since you're finished.

h6. Verify the SNMP community string
Now you should check the community string stored in a Nagios Resource Macro. This standard way of configuring depends on the notion that you can have one community string for all SNMP devices to be monitored. If that is not possible there are alternative ways to specify it, but for now lets continue with the steps below.

# Go to *Configuration* > *Control* > *Nagios resource macros*.
# Verify/change the macro *USER7* to the community string, it's set to *public* by default. A change would require selecting the macro, updating, and committing the change. If no change click *Close*.
\\
\\ !04_bookshelf_how_to_snmp_polling.png|alt="SNMP community string",title="SNMP community string"!
* Go to _Configuration_ > _Control_ > _Nagios resource macros_. Verify/change the macro _USER7_ to the community string, it's set to _public_ by default. A change would require selecting the macro, updating, and committing the change. If no change click _Close_.

h6. Test services

The Cconfiguration tool has a feature to do testing of checks before they are committed. If you receive an error you can test the argument from a command line. To test check:
# Let's go back to *Configuration* > *Hosts* > *Hosts* > *unassigned* (unless you have the host in a host group), and open the target host you created for polling.
# Select the *snmp_w2k3_if_1* service.
# Select the *Service Check* tab.
# And then click the *Test* button. If everything is correctly set up, the result will appear as a successful check.
\\
\\ !05_bookshelf_how_to_snmp_polling.png|alt="Testing services",title="Testing services"!
* In _Configuration_ open the target host you created for polling. Select the {{snmp_w2k3_if_1}} service and open the _Service Check_ tab. Then click the _Test_ button. If everything is correctly set up, the result will appear as a successful check.

h6. Debugging from the command line

Suppose you got an error and it's not immediately clear to you what the problem is. Here's a troubleshooting technique you might employ.
# Let's start by copying and executing a command string. From the *Test* area in the user interface highlight the command string and copy it.

# Open a terminal session to your *GroundWork server*, and become *root* and *nagios* user.
{noformat}sudo su -{noformat}
{noformat}su - nagios{noformat}
# Then paste and execute the command in the {{libexec}} subdirectory.
{note}Use the copy from your UI versus what is displayed here as we have breaks in the command due to screen space.{note}
Figure: Copy command to the command line
\\
{noformat}demo@ip-10-30-2-10:~$ sudo su -
root@ip-10-30-2-10:~# su - nagios
* You can start by copying and executing a command string. From the _Test_ area in the user interface highlight the command string and copy it. Then in a terminal session to your GroundWork server, as the _nagios_ user, paste and execute the command in the {{libexec}} subdirectory.
{note}The display below has breaks in the command due to screen space.{note}
nagios@ip-10-30-2-10:~$ {noformat}nagios@ip-10-30-2-10:~$ /usr/local/groundwork/nagios/libexec/check_snmp -H 10.30.2.70 -C public -o "IF-MIB:
:ifInOctets.1,IF-MIB::ifOutOctets.1 ,IF-MIB::ifInDiscards.1,IF-MIB::ifOutDiscards.1,IF-MIB::ifInErrors.1,
IF-MIB::ifOutErrors.1"
:ifOutDiscards.1=0c IF-MIB::ifInErrors.1=0c IF-MIB::ifOutErrors.1=0c
nagios@ip-10-30-2-10:~${noformat}
# * Now, add an argument to the command to turn up some debugging by adding {{\-v}} at the end and run it again.
{note}Again, use the copy from your UI versus what is displayed here as we have breaks in the command due to screen space.{note}
{note}The display below has breaks in the command due to screen space.{note}
# * You should see more details broken out.
# Figure: Adding the \-v command for additional detail
\\ {noformat}nagios@ip-10-30-2-10:~$ /usr/local/groundwork/nagios/libexec/check_snmp -H 10.30.2.70 -C public -o "IF-MIB:
:ifInOctets.1,IF-MIB::ifOutOctets.1 ,IF-MIB::ifInDiscards.1,IF-MIB::ifOutDiscards.1,IF-MIB::ifInErrors.1,
IF-MIB::ifOutErrors.1" -v
:ifOutDiscards.1=0c IF-MIB::ifInErrors.1=0c IF-MIB::ifOutErrors.1=0c
nagios@ip-10-30-2-10:~${noformat}
# * And this time we run the SNMP {{snmpget}} utility, outside the plugin wrapper. You should get the same result but without the formatting that the plugin would return. Other service checks use different plugins than {{check_snmp}} so the debug argument may be different, but the principle is the same.
\\
\\ {note}Don't forget to use the correct IP address for target machine.{note}
IF-MIB::ifInErrors.1 IF-MIB::ifOutErrors.1{noformat}
{note}Code is shown above as multiple lines and is actually one line.{note}
Figure: Run snmpget
\\ {noformat}nagios@ip-10-30-2-10:~$ /usr/local/groundwork/common/bin/snmpget -t 1 -r 5 -m ALL -v 1 -c public 10.30.2.70
IF-MIB::ifInOctets.1 IF-MIB::ifOutOctets.1 IF-MIB::ifInDiscards.1 IF-MIB::ifOutDiscards.1
IF-MIB::ifInErrors.1 IF-MIB::ifOutErrors.1
nagios@ip-10-30-2-10:~${noformat}

h6. Commit new configuration and view status and events

# Now let's put this new configuration into play. In the portal select *Configuration* > *Control* > *Pre flight test* > *Commit* and watch for the status to show that it was successful.

h6. Viewing status and events

# After a little while check in the *Status* view where you will see the services and the host state begin to fill in.
* You can then put the new configuration into play. In the portal select _Configuration_ > _Control_ > _Pre flight test_ > _Commit_ and watch for the status to show that it was successful. After a little while check in the _Status_ view where you will see the services and the host state begin to fill in.
# * Further down you can view the graphs as they start to populate. The performance graphs are automatically built because the profile included a performance configuration table entry for each service check. You can see this by going to _Configuration_ > _Performance_.
# * In the Event Console, you can select the *NAGIOS* _NAGIOS_ application filter to view the polling events. You can see the polling server listed, and In time you will see the status change from *PENDING*. _PENDING_.
{note}Make sure your target machine has the SNMP service installed, configured, and started.{note}
!06_bookshelf_how_to_snmp_polling.png|alt="Viewing Status and events",title="Viewing Status and events"!