SNMP Get - snmpgetd

Introduction

The snmpgetd daemon is our approach to sending and processing snmp calls (get and set) in the Site Controller. The daemon will have snmp gets scheduled, and also will respond to the action controller

Related Articles

Flow diagram

Here we can see a flow diagram of how the daemon works.

Basically, there will be scheduled SNMP GET calls that will retrieve data from the systems, using OIDs (we do not use MIB files inside SC to reduce load of the system). 

There will also be configured actions that will perform a SNMP SET operation upon request.

Configuration of the module

 

  • For sending SNMP GET requests, there must be a device and gateway configuration (in sensor_config.xml) , that will include the destination, the community, the protocol and the OIDs to be requested, together with the time scheduling. This information will be used to schedule jobs that will perform the calls.There must be also a sensor configuration that will evaluate the output of the jobs once they are processed.
  • The action configuration will be a SNMP SET on an specific OID. It must include the name of the device on which the action will be performed, as well as a tuple with the OID, data type (see rfc1902) and value that will be written.

 

The following sections will show examples of configuration for this modules.

Device and Gateway Configuration

 

	<device device_id="Zyxel_switch_device">
			<snmp_device>
				<ip_settings>
					<address>192.168.97.94</address>
					<port>161</port>
				</ip_settings>
				<snmp_settings>
					<community>public</community>
					<protocol_version>2c</protocol_version>
				</snmp_settings>
			</snmp_device>
			<sensor_gateways>
				<sensor_gateway sensor_gateway_id="zyxel_ports">
					<snmp>
					   <OIDs>
                            <OID>1.3.6.1.2.1.2.2.1.8.1</OID>
        					<OID>1.3.6.1.2.1.2.2.1.8.2</OID>
        					<OID>1.3.6.1.2.1.2.2.1.8.3</OID>
        					<OID>1.3.6.1.2.1.2.2.1.8.4</OID>
        					<OID>1.3.6.1.2.1.2.2.1.8.5</OID>
        					<OID>1.3.6.1.2.1.2.2.1.8.6</OID>
        					<OID>1.3.6.1.2.1.2.2.1.8.7</OID>
        					<OID>1.3.6.1.2.1.2.2.1.8.8</OID>
					   </OIDs>
						<scheduling>
							<polling_interval>60</polling_interval>
							<error_handling>
								<retry retry_algorithm="linear"  retry_interval_before_alert="15"/>
								<timeout_handling>
									<fixed_timeout>5</fixed_timeout>
								</timeout_handling>
							</error_handling>
						</scheduling>
					</snmp>
				</sensor_gateway>
			</sensor_gateways>
		</device>
 

 

Sensor Configuration for snmp get

	 <sensor sensor_id="snmpgetzyxel_port1">
            <sensor_class>unknown</sensor_class>
            <state_evaluation_expressions>
                <state_evaluation_expression>
                    <expression><![CDATA[value==1]]></expression>
                    <true>LINK UP</true>
                </state_evaluation_expression>
                <state_evaluation_expression>
                    <expression><![CDATA[value==2]]></expression>
                    <true>LINK DOWN</true>
                </state_evaluation_expression>
            </state_evaluation_expressions>
            <sensor_gateway sensor_gateway_id="zyxel_ports">
                <demux>
                	<keys>
                    	<key>1.3.6.1.2.1.2.2.1.8.1</key>
                    </keys>
                </demux>
            </sensor_gateway>
        </sensor>
        <sensor sensor_id="snmpgetzyxel_port2">
            <sensor_class>unknown</sensor_class>
            <state_evaluation_expressions>
                <state_evaluation_expression>
                    <expression><![CDATA[value==1]]></expression>
                    <true>LINK UP</true>
                </state_evaluation_expression>
                <state_evaluation_expression>
                    <expression><![CDATA[value==2]]></expression>
                    <true>LINK DOWN</true>
                </state_evaluation_expression>
            </state_evaluation_expressions>
            <sensor_gateway sensor_gateway_id="zyxel_ports">
                <demux>
                	<keys>
                    	<key>1.3.6.1.2.1.2.2.1.8.2</key>
                    </keys>
                </demux>
            </sensor_gateway>
        </sensor>

 

Action configuration

The example below switches on and of a zyxel router port (can be used for cisco). 

		<!-- snmp actions  -->
		<action action_id="ZyxelAdministerPort3" device_id="Zyxel_switch_device" operation="init">
			<commands>
	            <command command_id="ON">('1.3.6.1.2.1.2.2.1.7.3', rfc1902.Integer32('1'))</command>
	            <command command_id="OFF">('1.3.6.1.2.1.2.2.1.7.3', rfc1902.Integer32('2'))</command>
			</commands>
	    </action>