This KB article describes the conditions of generating a cold-start trap with the "request system reboot" CLI command. As with the other traps, this depends on SNMPD, but in this article, we can see how SNMPD determines whether a cold-start or a warm-start trap should be generated.
"request system reboot"
In a Juniper router, a cold-start trap is generated by SNMPD when the system comes up from a power cycle, while a warm-start trap is generated when the system comes up from a software reset. However, under certain conditions, a Juniper router generates a cold-start trap even when the router is restarted with the "request system reboot" CLI command, which causes a router software reset.
Prior to Junos OS 17.2R2, if the SNMPD is restarted within the predefined cut-off time of 300 seconds from system boot time, the SNMPD generates a cold-start trap instead of generating a warm-start trap. You can also see a cold-start trap if you restart SNMPD within 300 seconds after the Routing Engine is booted.
Here's the operation log to see a cold-start trap by restarting SNMPD:
lab@router-re0> request system reboot both-routing-engines Reboot the system ? [yes,no] (no) yes Rebooting re1 *** FINAL System shutdown message from lab@router-re0 *** System going down IMMEDIATELY Shutdown NOW! [pid 2279] *** messages *** Jul 24 14:46:52.170 router-re0 mgd[2252]: UI_CMDLINE_READ_LINE: User 'id', command 'request system reboot both-routing-engines ' Jul 24 14:46:54.362 router-re0 mgd[2252]: UI_REBOOT_EVENT: System rebooted by 'id' Jul 24 14:46:54.625 router-re0 Jul 24 14:46:54.625 rollpanna-re1 mgd[2153]: UI_REBOOT_EVENT: System rebooted by 'root' Jul 24 14:46:54.716 router-re0 mgd[2252]: UI_CHILD_START: Starting child '/sbin/shutdown' Jul 24 14:46:54.745 router-re0 mgd[2252]: UI_CHILD_STATUS: Cleanup child '/sbin/shutdown', PID 2276, status 0 -- snip -- Jul 24 14:52:33.905 router-re0 snmpd[1804]: SNMPD_TRAP_QUEUED: Adding trap to xxx.xxx.xxx.xxx to throttle queue, 1 traps in queue Jul 24 14:52:33.907 router-re0 snmpd[1804]: SNMPD_TRAP_COLD_START: trap_generate_cold: SNMP trap: cold start -- snip -- Jul 24 14:52:47.725 router-re0 snmpd[2001]: SNMPD_TRAP_QUEUED: Adding trap to xxx.xxx.xxx.xxx to throttle queue, 1 traps in queue Jul 24 14:52:47.725 router-re0 snmpd[2001]: SNMPD_TRAP_COLD_START: trap_generate_cold: SNMP trap: cold start router-re0 (ttyp2) login: Password: #################### system uptime << 300 seconds; cold start trap #################### lab@router-re0> show system uptime Current time: 2015-07-24 14:53:03 JST System booted: 2015-07-24 14:48:26 JST (00:04:37 ago) <-- Less than 300 seconds Protocols started: 2015-07-24 14:52:38 JST (00:00:25 ago) Last configured: 2015-07-24 14:28:42 JST (00:24:21 ago) by lab 2:53PM up 5 mins, 2 users, load averages: 2.48, 0.87, 0.36 lab@router-re0> restart snmp Jul 24 14:53:17 Simple Network Management Protocol process started, pid 2047 *** messages *** Jul 24 14:53:12.216 router-re0 mgd[1951]: UI_CMDLINE_READ_LINE: User 'id', command 'restart snmp ' Jul 24 14:53:12.219 router-re0 mgd[1951]: UI_RESTART_EVENT: User 'id' restarting daemon 'Simple Network Management Protocol process' Jul 24 14:53:12.222 router-re0 init: snmp (PID 2001) terminated by signal number 15! Jul 24 14:53:12.222 router-re0 init: snmp (PID 2047) started Jul 24 14:53:12.226 router-re0 mgd[1951]: UI_COMMIT_PROGRESS: Commit operation in progress: signaling 'Init daemon', pid 1, signal 1, status 0 with notification errors enabled Jul 24 14:53:17.272 router-re0 snmpd[2047]: SNMPD_TRAP_QUEUED: Adding trap to xxx.xxx.xxx.xxx to throttle queue, 1 traps in queue Jul 24 14:53:17.272 router-re0 snmpd[2047]: SNMPD_TRAP_COLD_START: trap_generate_cold: SNMP trap: cold start <<<<<<<<<< cold start trap #################### system uptime >> 300 seconds; warm start trap #################### lab@router-re0> show system uptime Jul 24 14:53:42 Current time: 2015-07-24 14:53:42 JST System booted: 2015-07-24 14:48:26 JST (00:05:16 ago) <-- Greater than 300 seconds Protocols started: 2015-07-24 14:52:38 JST (00:01:04 ago) Last configured: 2015-07-24 14:28:42 JST (00:25:00 ago) by lab 2:53PM up 5 mins, 2 users, load averages: 2.86, 1.19, 0.50 lab@router-re0> restart snmp Jul 24 14:53:48 Simple Network Management Protocol process started, pid 2144 Jul 24 14:53:48.284 router-re0 mgd[1951]: UI_CMDLINE_READ_LINE: User 'id', command 'restart snmp ' Jul 24 14:53:48.284 router-re0 mgd[1951]: UI_RESTART_EVENT: User 'id' restarting daemon 'Simple Network Management Protocol process' Jul 24 14:53:48.287 router-re0 init: snmp (PID 2047) terminated by signal number 15! Jul 24 14:53:48.287 router-re0 init: snmp (PID 2071) started Jul 24 14:53:48.293 router-re0 mgd[1951]: UI_COMMIT_PROGRESS: Commit operation in progress: signaling 'Init daemon', pid 1, signal 1, status 0 with notification errors enabled Jul 24 14:53:48.372 router-re0 snmpd[2071]: SNMPD_TRAP_WARM_START: trap_generate_warm: SNMP trap: warm start <--- warm start trap
Prior to Junos OS 17.2R2, a cold-start trap is sent if the SNMP restarts within the predefined cut-off time 300 seconds from the system reboot, and if the SNMP restarts after this cut-off time from the system reboot, it is assumed that the SNMPD is manually restarted and a warm-start trap is sent.
If the system uptime is less than 300 seconds, Junos sends a cold-start trap when the SNMPD process is restarted.
If the system uptime is greater than 300 seconds, Junos sends a warm-start trap when the SNMPD process is restarted.
However, in case the system takes more time to boot, then there is a chance that the SNMPD starts after 300 seconds and a warm-start trap is sent in place of cold-start trap. This behavior is changed from Junos OS 17.2R2. Starting from Junos OS 17.2R2, the SNMPD sends a cold/warm trap based on the actual reason of the SNMPD restart rather than using a cutoff time of 300 seconds, which may not be valid if the boot time varies. A file is implemented to decide whether to send a cold-start trap or warm-start trap. In this code change, the SNMPD maintains a file /var/db/snmp_cold_start.time which maintains the last sent cold-start trap timestamp.
If the system reboot time is older than the time in this file, then the cold-start trap was sent already and now a warm-start trap has to be sent.
If the time in the file is older than the system reboot time, then now we have to send a cold-start trap and update the file with the latest cold-start trap timestamp.
Note that POST (Power On Self Test) is commonly performed upon cold-start. But on a Juniper router, POST is performed regardless of whether it is restarted by a power cycle (cold-start) or software reset (warm-start).
2018-06-28: Minor non-technical edits.2017-05-26: Modified version info from 17.3 to 17.2R22017-05-08: Added details about behavior changes in Junos 17.32025-02-27: Minor formatted