2. Installing the SNMP Agent#
This chapter explains how to install the SNMP agent and configure Altibase to use SNMP.
Installing the SNMP Agent#
This section describes how to install the SNMP agent and integrate it with Altibase. Altibase can be configured in two ways to run net-snmp.
-
Configure with the NET-SNMP package.
-
Configure with the NET-SNMP in a preinstalled environment.
The Altibase SNMP agent complies with the open source net-snmp. For further information about how to configure the NET-SNMP binary and environment configuration files, please refer to the net-snmp homepage.
Downloading the Package#
Visit the Altibase homepage, download the Altibase package, and install it.
If altibase-snmp-xxx.tar.gz is unzipped, the user will see the following:
$ gzip -d altibase-snmp-xxx.tar.gz
$ tar xvf altibase-snmp-xxx.tar
...
...
...
== bin
= snmp manger (snmpget, snmpset, snmpwak)
== sbin
= snmpd : snmp Master/Sub agent daemon
= snmptrapd : snmp trap daemon
= altisnmpd : Altibase snmp sub agent daemon
== share/snmp/mibs
= ALTIBASE-MIB.txt : Altibase MIB
== etc/snmp
= snmpd.conf : snmpd environment configuration file
= altisnmpd.conf : altisnmpd environment configuration file
= altisnmp.env : set environment variable
Apart from three files (altisnmpd, altisnmpd.conf, and ALTIBASE-MIB.txt), the files are binaries compiled with net-snmp source.
Only the above three files need to be configured if snmp is used for net-snmp on a customer's server
Setting Altibase Properties#
To use the SNMP feature in Altibase, the properties file must be changed accordingly. The Altibase properties file is located at $ALTIBASE_HOME/conf.
The following are SNMP related properties. For more detailed information about each property, please refer to the General Reference > Chapter 2. Altibase Properties.
-
SNMP_ENABLE
-
SNMP_PORT_NO
-
SNMP_TRAP_PORT_NO
-
SNMP_RECV_TIMEOUT
-
SNMP_SEND_TIMEOUT
-
SNMP_MSGLOG_FLAG
-
SNMP_ALARM_QUERY_TIMEOUT
-
SNMP_ALARM_FETCH_TIMEOUT
-
SNMP_ALARM_UTRANS_TIMEOUT
-
SNMP_ALARM_SESSION_FAILURE_COUNT
Installing and Running the Altibase NET-SNMP Package#
This section discusses how to configure and run the Altibase NET-SNMP package.
Note: Please set the default port number to (existing value + 1000) so as to prevent it crashing with the snmp running on the system.
Setting Environment Variables#
Environment variables can be set with the source command to easily execute binaries. In the following examples, this manual assumes that altisnmp.env is the set environment.
$ source altisnmp.env
ALTISNMP=/home/donlet/work/altibase-snmp-1.0.1.release
ALTISNMPCONF=/home/donlet/work/altibase-snmp-1.0.1.release/etc/snmp
ALTISNMPBIN=/home/donlet/work/altibase-snmp-1.0.1.release/bin
ALTISNMPSBIN=/home/donlet/work/altibase-snmp-1.0.1.release/sbin
SNMP_PERSISTENT_FILE=/home/donlet/work/altibase-snmp-1.0.1.release/var/net-snmp/snmpd.conf
SNMP_PERSISTENT_DIR=/home/donlet/work/altibase-snmp-1.0.1.release/var/net-snmp
MIBDIRS=/home/donlet/work/altibase-snmp-1.0.1.release/share/snmp/mibs
MIBS=ALL
Configuring and Executing snmpd#
snmpd is the master agent daemon of SNMP. This section explains the necessary environment configuration for snmpd and how to execute it.
Setting the Environment Configuration File#
The port number and snmpd must be set to use SNMP.
Set the port number 1162 for snmpd and snmptrapd, and set snmpd as the master agent.
$ cat $ALTISNMPCONF/snmpd.conf
rocommunity public
rwcommunity private
syslocation mysystem
syscontact [email protected]
sysservices 0
trap2sink localhost public 1162
master agentx
Execution#
The execution options for the SNMP agent are [-f], [-l], [-s], and [-P]. [-f] allows the user to view snmpd execution in the foreground. [-l] writes logs into files, [-s] writes logs in syslogs, and [-P] creates pid files
The user can check whether snmpd is being executed in the foreground as below.
$ $ALTISNMPSBIN/snmpd -f -L -c $ALTISNMPCONF/snmpd.conf -C -x localhost:1705 udp:localhost:1161
Turning on AgentX master support.
NET-SNMP version 5.0.8
In this example, snmpd and the altibase snmp subagent are communicating on TCP port 1705. snmpd and snmpmanager (snmpget, snmpset, snmpwalk, etc.) are communicating on UDP port 1161.
The user can terminate snmpd execution in the foreground and execute it in the background with "Ctrl+C". The [-f] and [-l] options have been removed to execute snmpd in the background.
$ $ALTISNMPSBIN/snmpd -c $ALTISNMPCONF/snmpd.conf -C -x localhost:1705 -l /tmp/snmpd.log -s -P /tmp/snmpd.pid udp:localhost:1161
Terminating snmpd#
The SNMP agent can be terminated with the kill command.
$ kill `cat /tmp/snmpd.pid`
Executing snmptrapd#
snmptrapd is a daemon for SNMP traps. This section explains how to use snmptrapd.
The execution options [-f], [-o], [-s], and [-u] are available for snmptrapd. [-f]allows the user to view snmpdtrapd execution in the foreground. [-o] writes logs into files, [-s] writes logs in syslogs, and [-u] creates pid files.
The user can check whether snmptrapd is being executed in the foreground as below. Since trap2sink is set to port 1162 for snmpd.conf, the option must be set to udp:localhost:1162.
$ $ALTISNMPSBIN/snmptrapd -f -P udp:localhost:1162
2014-10-28 14:46:32 NET-SNMP version 5.0.8 Started.
The user can terminate snmptrapd execution in the foreground and execute it in the background with "Ctrl+C". The [-f] option has been removed to execute snmpd in the background.
$ $ALTISNMPSBIN/snmptrapd -s -o /tmp/snmptrapd.log -u /tmp/snmptrapd.pid udp:localhost:1162
Start snmpd while snmptrapd is running. A trap that notifies that snmpd has restarted is written in syslog and the /tmp/snmptrapd.log file.
The user is able to check that snmpd and snmptrapd are communicating properly.
$ cat /tmp/snmptrapd.log
Starting snmptrapd 5.0.8
2014-10-28 14:57:40 NET-SNMP version 5.0.8 Started.
2014-10-28 14:58:12 localhost [127.0.0.1]:
SNMPv2-MIB::sysUpTime.0 = Timeticks: (2) 0:00:00.02 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::coldStart SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-TC::linux
localhost [127.0.0.1]: Trap SNMPv2-MIB::sysUpTime.0 = Timeticks: (2) 0:00:00.02, SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::coldStart, SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-TC::linux
2014-10-28 14:58:14 localhost [127.0.0.1]:
SNMPv2-MIB::sysUpTime.0 = Timeticks: (143) 0:00:01.43 SNMPv2-MIB::snmpTrapOID.0 = OID: NET-SNMP-AGENT-MIB::nsNotifyShutdown
localhost [127.0.0.1]: Trap SNMPv2-MIB::sysUpTime.0 = Timeticks: (143) 0:00:01.43, SNMPv2-MIB::snmpTrapOID.0 = OID: NET-SNMP-AGENT-MIB::nsNotifyShutdown
Terminating snmptrapd#
The SNMP agent can be terminated with the kill command.
$ kill `cat /tmp/snmptrapd.pid`
Executing snmptrapd#
altisnmpd is an SNMP subagent daemon installed in the Altibase server. This section explains how to set the environment configuration file and execute altisnmpd.
Setting the Environment Configuration File#
For altisnmpd to communicate with the Altibase server, SNMP_PORT_NO must be set identically as it was set for the Altibase environment configuration file.
altibase_trap must also be set identically as SNMP_TRAP_PORT_NO for Altibase.
$ cat $ALTISNMPCONF/altisnmpd.conf
# ALTIBASE PORT_NO SNMP_PORT_NO
altibase 52473 20400
# ALTIBASE_TRAP SNMP_TRAP_PORT_NO
altibase_trap 20500
To communicate with multiple Altibase servers, indicate the servers in the environment configuration file as below.
altibase 52473 20400
altibase 20300 20800
...
Executing altisnmpd#
The execution options [-f], [-l], [-s], and [-P] are available for altisnmpd. [-f] allows the user to view snmpd execution in the foreground. [-l] writes logs into files, [-s] writes logs in syslogs, and [-P] creates pid files.
Execute altisnmpd in the foreground to check whether it is running.
$ $ALTISNMPSBIN/altisnmpd -f -L -c $ALTISNMPCONF/altisnmpd.conf -x localhost:1705
AgentX subagent for Altibase
NET-SNMP version 5.0.8
Altibase[0] : 52473 20400
Trap : 20500
Since snmpd and altisnmpd communicate on TCP port 1705, the user can see that -x localhost is set to 1705. The[-f] option is removed for background execution.
$ $ALTISNMPSBIN/altisnmpd -c $ALTISNMPCONF/altisnmpd.conf -l /tmp/altisnmpd.log -s -P /tmp/altisnmpd.pid -x localhost:1705
Terminating altisnmpd#
altisnmpd can be terminated with the kill command.
$ kill `cat /tmp/altisnmpd pid`
If altisnmpd is executed or terminated, a trap is raised and this can be checked with snmptrapd.
2014-10-28 15:39:57 localhost [127.0.0.1]:
SNMPv2-MIB::sysUpTime.0 = Timeticks: (1987) 0:00:19.87 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::private ALTIBASE-MIB::altiTrapAddress = STRING: 12944 ALTIBASE-MIB::altiTrapLevel = STRING: 3 ALTIBASE-MIB::altiTra
pCode = STRING: 10000003 ALTIBASE-MIB::altiTrapMessage = STRING: /home/donlet/work/altibase-snmp-1.0.1.release/sbin/altisnmpd is running. ALTIBASE-MIB::altiTrapMoreInfo = STRING: coldstart
2014-10-28 15:41:29 localhost [127.0.0.1]:
SNMPv2-MIB::sysUpTime.0 = Timeticks: (11225) 0:01:52.25 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::private ALTIBASE-MIB::altiTrapAddress = STRING: 12961 ALTIBASE-MIB::altiTrapLevel = STRING: 3 ALTIBASE-MIB::altiTra
pCode = STRING: 10000003 ALTIBASE-MIB::altiTrapMessage = STRING: /home/donlet/work/altibase-snmp-1.0.1.release/sbin/altisnmpd is running. ALTIBASE-MIB::altiTrapMoreInfo = STRING: coldstart
Executing Altibase#
In order execute Altibase, the following properties must be set according to the client environment. For more detailed information about properties, please refer to Setting Altibase Properties.
-
SNMP_ENABLE
-
SNMP_PORT_NO
-
SNMP_TRAP_PORT_NO
Run Altibase and execute the following command:
$ $ALTISNMPBIN/snmpwalk -v 2c -c private udp:localhost:1161 altibase
ALTIBASE-MIB::altiPropertyIndex.1 = INTEGER: 1
ALTIBASE-MIB::altiPropertyAlarmQueryTimeout.1 = STRING: 1
ALTIBASE-MIB::altiPropertyAlarmUtransTimeout.1 = STRING: 1
ALTIBASE-MIB::altiPropertyAlarmFetchTimeout.1 = STRING: 1
ALTIBASE-MIB::altiPropertyAlarmSessionFailureCount.1 = STRING: 3
ALTIBASE-MIB::altiStatusIndex.1 = INTEGER: 1
ALTIBASE-MIB::altiStatusDBName.1 = STRING: mydb
ALTIBASE-MIB::altiStatusDBVersion.1 = STRING: 7.1.0.0.0
ALTIBASE-MIB::altiStatusRunningTime.1 = STRING: 00:00:02
ALTIBASE-MIB::altiStatusProcessID.1 = STRING: 12973
ALTIBASE-MIB::altiStatusSessionCount.1 = STRING: 0
If SNMP is running properly, ALTIBASE-MID information will be output properly.
Configuration for a Previously Installed NET-SNMP#
This section explains how to link net-snmp altisnmpd (the altibase snmp subagent) and net-snmp, when net-snmp is already installed on a customer's server.
This section provides examples assuming that an snmpd package is already installed in /usr on the customer's server.
-
Setting Altibase Properties
-
Registering ALTIBASE-MIB.txt
-
Configuring altisnmpd
-
altisnmpd.conf
Setting Altibase Properties#
The following Altibase properties must be set according to the customer's environment.
-
SNMP_ENABLE
-
SNMP_PORT_NO
-
SNMP_TRAP_PORT_NO
Registering ALTIBASE-MIB.txt#
Copy ALTIBASE-MIB.txt and add it to the SNMP environment configuration file, snmp.conf. In this case, it is unnecessary to restart snmpd.
sudo cp $ALTISNMP/share/snmp/mibs/ALTIBASE-MIB.txt /usr/share/snmp/mibs
# vi /etc/snmp/snmp.conf
mibs +ALTIBASE-MIB
Configuring and Running altisnmpd#
For more detailed information about altisnmpd configuration, please refer to Executing altisnmpd.
The port used by snmpd must be specified. By default, it is set to localhost: 705. Otherwise, contact the system administrator.
$ $ALTISNMPSBIN/altisnmpd -c $ALTISNMPCONF/altisnmpd.conf -l /tmp/altisnmpd.log -s -P /tmp/altisnmpd.pid -x localhost:705
After running Altibase, execute the snmpwalk command.
$ /usr/bin/snmpwalk -v 2c -c private localhost:161 altibase
ALTIBASE-MIB::altiPropertyIndex.1 = INTEGER: 1
ALTIBASE-MIB::altiPropertyAlarmQueryTimeout.1 = STRING: 1
ALTIBASE-MIB::altiPropertyAlarmUtransTimeout.1 = STRING: 1
ALTIBASE-MIB::altiPropertyAlarmFetchTimeout.1 = STRING: 1
ALTIBASE-MIB::altiPropertyAlarmSessionFailureCount.1 = STRING: 3
ALTIBASE-MIB::altiStatusIndex.1 = INTEGER: 1
ALTIBASE-MIB::altiStatusDBName.1 = STRING: mydb
ALTIBASE-MIB::altiStatusDBVersion.1 = STRING: 7.1.0.0.0
ALTIBASE-MIB::altiStatusRunningTime.1 = STRING: 00:38:00
ALTIBASE-MIB::altiStatusProcessID.1 = STRING: 12973
ALTIBASE-MIB::altiStatusSessionCount.1 = STRING: 0
If the snmpwalk command is executed and the following is output, the user should check the ACL setting in /etc/snmp/snmpd.conf.
$ /usr/bin/snmpwalk -v 2c -c private localhost:161 altibase
Timeout: No Response from localhost:161
/etc/snmp/snmpd.conf
# Full access from the local host
#rocommunity public localhost
#rwcommunity private localhost
For the full access, the system administrator must remove the comment.