# SNMP

UPS, switches and the server room over SNMP right in the chat

ИБП, сеть, серверная и датчики климата по SNMP через назначенный шлюз, только чтение

## How the agent works with SNMP

Data is collected on site by the gateway: a service on a computer in the site network that sends data out over an outgoing connection only. One connection is one SNMP agent: it takes an address such as udp://10.0.5.30:161, the version and a community string for v1 and v2c or a user with passwords for v3. The connection is assigned to a gateway on the Gateways tab.

No OID knowledge is needed: without a tag list the gateway reads the standard groups the device answers: system, UPS per RFC 1628 (or APC PowerNet under the same tag names), ENTITY-SENSOR-MIB sensors, host resources and IF-MIB interfaces. A port is named by ifName rather than its number, and after an agent restart, when the numbers may change, the gateway reads the tables again so a tag does not slide onto another port.

The connection only reads. The gateway sends only GET and table walks: it sends no SET, takes no traps and listens on neither port 161 nor 162. So UPS alarms arrive not as traps but as flag tags read on every poll, and the agent cannot change the device's settings.

Polling runs every 30 seconds: agents on UPS and sensor network cards are slow. If a device refuses a batch of objects, the gateway asks for them one at a time, so the refusal lands on its own tag and the neighbours keep being read. Traffic counters go out as read, 64-bit where the agent has them; history is kept in the store and read for any period.

## Integration scenarios

### UPS on battery
The agent reads what feeds the UPS output, the battery charge and remaining runtime, how long the UPS has been on battery and the output load.

### UPS alarms
The agent shows the UPS's active alarms: low battery, output overload, battery replacement, overheating, running on bypass, and how many there are.

### Switch ports
The agent finds ports that are enabled but down, and shows traffic per port under names like Gi1/0/1 rather than numbers.

### Server room climate
The agent reads temperatures and fan speeds from the devices' built-in sensors and shows how they changed over the day.

### Server resources
The agent shows a server's processor load and disk usage from the standard host resources table.

### Threshold task
The agent sets up an event task: for example, the UPS battery charge below a threshold for more than five minutes. The task fires when the condition starts and when it clears.

## How to connect

**Before you connect**

- A device with SNMP v1, v2c or v3: a UPS, switch, server or sensor
- A read-only community string or an SNMPv3 user
- A computer in the site network running the gateway service
- Access from that computer to the device over UDP, port 161

### Turn SNMP on in the device
In the web interface of the UPS, switch or sensor, turn the SNMP agent on. Choose v3 if the device supports it: v1 and v2c send everything in plain text.

### For v1 and v2c: a read-only community
Create a read-only community string. If the device accepts managers only from known addresses, add the gateway computer's address.

### For v3: a user with passwords
Create a v3 user with authentication (SHA-256 or another algorithm from the list) and AES privacy. Without a privacy password values are signed but not encrypted.

### Open UDP 161 to the device
The gateway polls the agent over UDP on port 161 from a free port of its own. It takes no traps on port 162, so they need no setup.

## FAQ

### How do I connect SNMP?
Install the gateway service on a computer in the site network and add it on the Gateways tab. In the connection enter the device address, for example udp://10.0.5.30:161, the version and a community string or a v3 user, and assign the connection to the gateway. The tag list can stay empty.

### What does the agent see over SNMP?
The device's name, location and uptime, the state of the UPS, its battery, input and output and its alarms, temperature and fan sensor readings, host processor and disk load, and port state and traffic. Anything else is read by the OIDs given in the tag list.

### Can the agent change the device's settings?
No. The gateway sends no SET and takes no traps: it only reads values with GET requests and table walks, so the UPS, switch and sensor settings stay as they were.

### The device answers only some objects or goes silent on tables. What should I do?
Small network cards can choke on long requests. In the advanced fields lower the objects per request or the rows per table request: the gateway will ask the device in smaller portions.
