Juniper JunOS SNMP v3 and Syslog
SNMPv3 with authentication and privacy, SNMP client lists for source restriction, structured syslog to remote collectors, and NTP - the monitoring baseline for any JunOS device.
What is it?
SNMP and syslog are the two halves of knowing what a device is doing. SNMP is pull-based: a monitoring system polls the device for counters like interface utilisation, CPU and temperature. Syslog is push-based: the device sends events as they happen - a link going down, someone logging in, a configuration being committed. JunOS configures both under the `system` and `snmp` hierarchies. SNMPv3 is the only version worth deploying, because v1 and v2c send their community string in cleartext, which makes it a password anyone on the path can read.
When to use
- ·Every production device, without exception - this is day-one configuration alongside the base config
- ·Capacity planning: interface counters polled over time are what tell you when a link needs upgrading
- ·Incident response: `interactive-commands` logging is the record of who typed what and when
- ·Compliance: most frameworks require centralised logging with a defined retention period
- ·Alerting on link state and BGP transitions via traps, which arrive faster than the next poll cycle would
When NOT to use
- ·SNMPv1 or v2c on anything reachable from an untrusted network - the community string is cleartext on the wire
- ·SNMP write access. There is almost never a good reason to let an NMS modify device configuration over SNMP, and it is a well-worn attack path
- ·As the only telemetry on a modern platform. For sub-minute resolution, streaming telemetry (gRPC/gNMI) is better suited than polling - SNMP polls every 5 minutes typically, and a microburst lasts milliseconds
- ·Logging everything at `any any` to a remote host. The volume is large, most of it is noise, and it costs real money in a licensed SIEM
- ·Relying on local log files alone. They are lost when the device is replaced, and an attacker with access can clear them
How it compares
Prerequisites
- →Management reachability already working - if the device cannot reach the NMS, nothing here will help
- →NTP configured and synchronised. SNMPv3 authentication is time-sensitive, and log timestamps are useless for correlation without it
- →The NMS poller addresses known in advance, for the client list
- →SNMPv3 credentials generated and stored in a secrets manager, not in the repository
- →The management routing instance name, if the device uses one
Config Generator
Shown in the NMS inventory - be specific enough to find the device physically
SHA authentication. Minimum 8 characters. Never commit the real value
AES-128 encryption of the payload. Use a different value from the auth password
Only these sources may poll. Everything else is rejected
Every address here gets both halves of a v3 trap destination: its own `target-address` block under `snmp v3`, and an entry in the `trap-group` that selects which categories are sent. Leave empty to configure polling only
Without correct time, every log timestamp is useless for correlation
Queried once at boot to set time immediately. Usually your primary NTP server
UTC is strongly recommended - local time across sites makes correlation painful
Leave blank if management traffic uses the default instance
Usually a loopback. Collectors often key on source address, so a varying one breaks dashboards
Verification commands
show snmp v3Show the configured USM users, groups and access rules
ExpectedThe user appears with authentication sha and privacy aes128, mapped to a group that has a read view. A user with no group mapping can authenticate but will read nothing.
show snmp statisticsShow SNMP packet counters
ExpectedInput packets rising as the NMS polls. Zero input means the poll is not arriving - check reachability and the client list. Rising 'unknown user names' or 'unsupported security levels' means the NMS is configured with mismatched credentials.
show system ntp statusConfirm time is synchronised before trusting any timestamp
ExpectedA server marked with an asterisk and a small offset. Unsynchronised time undermines both log correlation and SNMPv3 authentication.
show log messages | last 20Confirm local logging is working at all
ExpectedRecent events with full timestamps including the year. If the year is missing, `time-format year` has not been applied.
Debug commands
monitor start messagesWatch syslog live while reproducing an event
WarningOn a busy device this scrolls quickly. Stop it with `monitor stop` - leaving it running consumes RE cycles.
show snmp mib walk systemWalk the system MIB locally to confirm SNMP responds at all
WarningThis runs as the local user and bypasses the client list, so it proves the agent works but says nothing about whether a remote poller is permitted. Test from the NMS as well.
set system syslog host 10.0.0.60 any anyTemporarily raise remote logging to everything while chasing an issue
Warning`any any` is extremely verbose and will flood both the link and the collector. Set it, reproduce, then roll back immediately - and never commit it as a permanent configuration.
Common mistakes & fixes
Further learning
Recommended books to go deeper on this topic.
CCNP Enterprise Core ENCOR 350-401 Official Cert Guide
Brad Edgeworth et al. · Cisco Press · Network management: SNMP v1/v2c/v3, syslog levels, NTP, NetFlow