Creating a SAS Management
Console alert that results in an SNMP trap notification is a process
that can be difficult to troubleshoot. There are many potential problem
areas, such as routing and filtering, that can mask any configuration
errors. If you are using SAS Environment Manager with an enterprise
monitoring application, SNMP alerts enable you to receive real-time
notifications for critical alerts, while using event exporting for
the audit tracking of all alerts.
In order to eliminate
external issues with SNMP alerts, the best practice is to configure
a local SNMP trap receiver on the SAS Environment Manager server,
test everything locally by sending a trap from SAS Environment Manager
to a trap receiver that is also configured on the SAS Environment
Manager server. After testing is complete, you can then change the
configuration to use the production settings. The following steps
provide an example of this testing process:
-
Configure a local SNMP
trap receiver for testing.
-
Verify that the trap
receiver works correctly by using an operating system-based trap sender.
-
In SAS Environment Manager,
enable SNMP trap sending and specify the SNMP configuration parameters.
-
Create a sample SAS
Environment Manager alert that causes an SNMP trap notification to
be sent.
-
Verify that the alert
caused an SNMP trap notification to be sent.
-
Change the settings
to point to the production trap receiver instead of the local test
trap receiver.
To configure the alert,
follow these steps:
Step1: Configure a Local SNMP Trap Receiver for Testing
Perform these steps
as the root user ID.
-
Set the Security Enhanced
Linux to permissive so that the trap messages can be redirected. To
change the state only for the currently session, issue the command
setenforce
0
.
To change the state
permanently, modify the file /etc/selinux/config
as
root, change the value for the SELINUX=
parameter
to permissive
, save the file, and reboot
the machine.
-
Edit the snmptrapd.conf
file, located in the
/etc
directory.
-
Add these two lines
to the file:
authCommunity log,execute,net public
logOption f /tmp/snmptraps.log
The logOption line specifies
that snmptrapd should write trap messages to the external file /tmp/smptraps.log.
-
Create a file named
UCD-TRAP-TEST-MIB.txt in the directory
/usr/share/snmp/mibs
.
Enter the following as the contents of the file:
UCD-TRAP-TEST-MIB DEFINITIONS ::= BEGIN
IMPORTS ucdExperimental FROM UCD-SNMP-MIB;
demotraps OBJECT IDENTIFIER ::= { ucdExperimental 990 }
demoTrap TRAP-TYPE
ENTERPRISE demotraps
VARIABLES { sysLocation }
DESCRIPTION "An example of an SMIv1 trap"
::= 17
END
-
Restart the snmptrapd
server by issuing this command:
# service snmptrapd restart
Verify that you receive
a response of OK
from the server restart
command.
-
Restart the SNMP server
by issuing this command:
# service snmpd restart
Verify that you receive
a response of OK
from the server restart
command.
Step 2: Verify the SNMP Trap Receiver
After you configure
the test configuration, verify that the trap is working as expected.
If you are using Windows, you can verify the operation using an snmptrap
receiver tool.
-
Verify that the snmpd
server is operating correctly by issuing these commands:
snmptest –v 2c –c public <host>
Variable: system.sysDescr.0
Variable:<blank>
The value for host is
the FQDN name or IP address of the SAS Environment Manager server.
Verify that the system
responds by returning the MIB system description, for example:
SNMPv2-MIB::sysDescr.0 = STRING: Linux <host> 2.6.32-220.17.1.el6.x86_64 #1 SMP Thu Apr 26 13:37:13 EDT 2012 x86_64
-
Issue a simple and local
snmptrap command. For example:
snmptrap -v 1 -c public <host> UCD-TRAP-TEST-MIB::demotraps "" 6 17 "" \
SNMPv2-MIB::sysLocation.0 s "snmp test string"
The value of host is
the is the FQDN name or IP address of the SAS Environment Manager
server. Use a value of localhost
if you execute
the command on the SAS Environment Manager server.
-
Verify that the following
log entry has been written to your /tmp/snmptraps.log:
2015-03-13 11:03:04 192.193.194.195(via UDP: [10.122.32.74]:43576->[10.122.32.74]) TRAP, SNMP v1, community public
iso.2.3.4.5.6 Enterprise Specific Trap (99) Uptime: 0:00:00.55
iso.11.12.13.14.15 = STRING: "SNMP trap test string"
Step 3: Enable SNMP Trap Sending in SAS Environment Manager
Before you can create
an alert in SAS Environment Manager that uses SNMP, you must enable
SNMP trap sending. At this point in the process, you are configuring
SAS Environment Manager to send SNMP traps to the local test receiver.
-
In SAS Environment Manager,
select
ManageServer
Settings to display the
Edit
Server Settings page.
-
In the
Edit
Server Settings page, locate the
SNMP Server
Configuration Properties area and select
1 in
the
SNMP Protocol Version field.
-
Specify these values
for the
SNMP Server Configuration Properties:
SNMP Trap OID
The selected OID value
for the test (for example, 1.3.6.1.2.1.11.0.6). This value is the
OID of the local test trap receiver.
Community
public (the
default value).
Enterprise OID
The selected OID value
for the test (for example, 1.3.6.1.2.1.11.0.6). This value is the
OID of the local test trap receiver.
Default Notification Mechanism
Agent Address
Specify the IP address
of the SAS Environment Manager server.
Step 4: Create a Test Alert in SAS Environment Manager
After you have verified
that the SNMP trap works as expected, use SAS Environment Manager
to create a test alert that causes an SNMP trap to be sent. This example
creates an alert that will trigger when the File System Reads/Writes
per Minute metric is greater than 10. Because this alert will be triggered
every time SAS Environment Manager scans for new alerts, it will test
the SNMP trap configuration relatively quickly.
-
In SAS Environment Manager,
select
ResourcesBrowsePlatform. Locate the entry
in the platform table for the SAS Environment Manager platform and
select the
Alert icon to the left of the
platform entry to display the
Alerts page
-
On the
Alerts page,
select
New to display the
New
Alert Definition page.
-
In the
New
Alert Definition page, specify the following information
to define the alert:
If Condition Metric
Select File
System Reads/Writes per Minute
If Condition comparison
Select Greater
than and specify 10 for the
comparison value.
Enable Action
Select Each
time conditions are met.
-
Click
OK to
define the alert and display the
Alert Definition page.
Select
SNMP Notification.
-
Specify these values:
IP Address
Specify the IP address
of the SAS Environment Manager server, followed by a slash and the
SNMP trap port (typically 162). An example entry might be 10.122.32.74/162.
OID
Specify the OID value
for the local test trap receiver (for example, 1.3.6.1.2.1.11.0.6).
This value should match the value of the SNMP Trap OID field
on the SNMP Server Configuration Properties page.
Click Save
Changes to save the alert.
Step 5: Verify That the Alert Sent an SNMP Trap
After you define the
alert, verify that an occurrence of the alert writes a record to the
SNMP trap log, which verifies that the SNMP trap was successfully
sent from SAS Environment Manager to the local test trap receiver.
-
Wait until the alert
triggers. Be default, alerts are scanned every five minutes, and the
alert should be triggered whenever the alerts are scanned. When the
alert triggers, a trap should be written to the location specified
in step 2 (in this example, /tmp/snmptrap.log). Because the trap is
sent to the local test receiver, this location is on the SAS Environment
Manager Server machine.
-
Verify that snmptrapd
on the received the trap. The trap should be similar to the following:
2015-03-13 11:00:23 ptnode24.ptest.sas.com [10.122.32.74] (via UDP: [10.122.32.74]:60162->[10.122.32.74]) TRAP, SNMP v1, community public
SNMPv2-MIB::snmp.0.6 Cold Start Trap (0) Uptime: 0:00:00.00
SNMPv2-MIB::snmp.0.6 = STRING: "SNMP trap example:SNMP trap example <host> File System Reads/Writes per Minute (433.0)
Step 6: Change the Alert Settings to Send Traps to the
Production Receiver
-
After you verify that
the alert works properly with the local trap receiver, you must change
the settings in SAS Environment Manager to send traps to the production
trap receiver. Contact your IT staff to determine the values for your
organization’s production SNMP trap receiver. You will need
to know the IP address and port for the receiver, as well as the OID
value.
-
In SAS Environment Manager,
select
ManageServer
Settings to edit the SNMP server configuration
properties. Replace the test OID values with your production OID values.
-
Edit the alert definition
in SAS Environment Manager. Change the alert conditions to specify
the alert that you want to cause an SNMP notification. Specify your
organization’s values for
IP Address and
OID and
save the alert.
-
If you want to create
more alerts with SNMP notification, create the alert normally and
specify the values for the production SNMP trap receiver.