Automation

IMPORTANT MODERATION NOTICE

This community is currently under full moderation, meaning  all posts will be reviewed before appearing in the community. Please expect a brief delay—there is no need to post multiple times. If your post is rejected, you'll receive an email outlining the reason(s). We've implemented full moderation to control spam. Thank you for your patience and participation.



  • 1.  Multiple attributes-match for only one trigger event !

    Posted 06-07-2020 20:01

    Hi, 

    i try to setup the automation to disable the fpc when the event is trigger, but it require the within statement if i use multiple attributes-match. Because i just want to use only one event trigger so the within statement does not make sence. Is there anyway to do that ? 

    Thank for any idea 😄 !

     

    [edit event-options policy test_fpc]
    lab@BNG-1-ACTIVE# show
    Jun 08 09:43:37
    events chassisd_snmp_trap10;
    attributes-match {
    chassisd_snmp_trap10.value5 matches "^FPC*";
    ##
    ## Warning: within clause must be configured
    ##
    chassisd_snmp_trap10.argument8 equals jnxFruOfflineReason;
    ##
    ## Warning: within clause must be configured
    ##
    chassisd_snmp_trap10.value8 equals 23;
    }
    then {
    change-configuration {
    commands {
    "command to disable here";
    }
    commit-options {
    log anh_vt_test;
    }
    }
    }

     

     


  • 2.  RE: Multiple attributes-match for only one trigger event !
    Best Answer

    Posted 06-07-2020 21:05

    Hi TuanAnhVu,

     

    Greetings,

     

    As per my understanding you want to trigger a single policy when it matches the event which has multiple attributes.

     

    As per our documentation, If the attributes-match statement includes the equals or starts-with options, or if it includes a matches option that includes a clause for an event that is not specified at the [edit event-options policy policy-name events] hierarchy level, you must include one or more within statements in the same policy configuration.

     

    attributes-match {
    chassisd_snmp_trap10.value5 matches "^FPC*"; 
    chassisd_snmp_trap10.argument8 equals jnxFruOfflineReason; >> Has the equals option
    chassisd_snmp_trap10.value8 equals 23; >> Has the equals option
    }
    For these equals options we need the within clause as per documentation.

     

     

    Refer Link for more details: https://www.juniper.net/documentation/en_US/junos/topics/reference/configuration-statement/attributes-match-edit-event-options.html

     

     

    Hope this helps. Smiley Happy

    Please mark "Accept as solution" if this answers your query. 

     

    Kudos are appreciated too! 

     

    Regards, 

    Sharat Ainapur

     



  • 3.  RE: Multiple attributes-match for only one trigger event !

    Posted 06-07-2020 21:28

    Hi, 

    Thanks for your response. It work for me now, but i have another issue. The event and attributes-match are working now, but do you know anyway to put the slot of the fpc to the change-configuration commands. I tried with statement "set chassis fpc chassisd_snmp_trap10.value7 power off" but it did not work (chassisd_snmp_trap10.value7 is the slot of FPC, https://kb.juniper.net/InfoCenter/index?page=content&id=KB22868&cat=JUNOS_PLATFORM&actp=LIST). i tried with simple commands without variable for testing, it works.

     

    lab@MX960-CCH-UPE-01_RE0# show event-options
    Jun 08 11:21:03
    policy test {
    events chassisd_snmp_trap10;
    attributes-match {
    chassisd_snmp_trap10.trap matches "^Fru Offline$";
    chassisd_snmp_trap10.value5 matches "^FPC*";
    chassisd_snmp_trap10.argument8 matches "^jnxFruOfflineReason$";
    chassisd_snmp_trap10.value8 matches "^7$";
    }
    then {
    change-configuration {
    commands {
    "set chassis fpc chassisd_snmp_trap10.value7 power off";
    }
    commit-options {
    log down_fpc_script;
    }
    }
    }
    }