Hi TuanAnhVu,
Greetings,
I believe the below output and the configuration statement will help you understand the steps in achieving this.
For our reference considering the below trap output:
CHASSISD_SNMP_TRAP10: SNMP trap generated: FRU power off (jnxFruContentsIndex 8, jnxFruL1Index 1,
jnxFruL2Index 1, jnxFruL3Index 0, jnxFruName node0 PIC: 8x 1GE-TX 4x 1GE-SFP @ 0/0/*, jnxFruType 11, jnxFruSlot 0,
jnxFruOfflineReason 8, jnxFruLastPowerOff 2519258, jnxFruLastPowerOn 89379)
>> The highlight value is value7 as per trap
The command can be referenced as follows:
then {
change-configuration {
commands {
"set chassis fpc {$$.value7} power off";
}
Here the value to be used is FRUSLOT which can be referenced based on the event i.e. CHASSISD_SNMP_TRAP10's value 7 and hence we need to use $$ > represents the event that triggered policy and value 7 references the variable FPC# to use.
For more details , the reference link that explains the event variable usage: https://www.juniper.net/documentation/en_US/junos/topics/reference/configuration-statement/commands-edit-event-options.html
Hope this helps.
Please mark "Accept as solution" if this answers your query.
Kudos are appreciated too!
Regards,
Sharat Ainapur