Automation

 View Only
last person joined: 6 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Script to reboot SRX at 95% CPU and above

    Posted 02-22-2017 07:14

    Can somebody guide me how to write a script to issue a "request system reboot" at specific time, lets say 2 AM when CPU is constantly spiking and staying at 95% and above for more than 24 hours.

     

     

    I tried creating event-options and policy based on that but there is no event for high cpu utilization. 

     

    Thank you for your time.


    #Automation
    #script


  • 2.  RE: Script to reboot SRX at 95% CPU and above

    Posted 02-24-2017 10:38

    Hello Ankitvora,


    You can mix RMON & event script: 

    create RMON event trigger ---- > create event srcipt to match on the generated rmon alarm. 

     

    I found an old discussion regarding this, please find the link below


    http://forums.juniper.net/t5/Junos-Automation-Scripting/event-script-for-CPU-utilization/td-p/135063

     

    Thank you, 

    Mahdy 



  • 3.  RE: Script to reboot SRX at 95% CPU and above

    Posted 02-27-2017 07:09

    Thank you this is a good discussion i think i can connect the dots now and move forward. I ll post my script once I am done with it.



  • 4.  RE: Script to reboot SRX at 95% CPU and above
    Best Answer

    Posted 02-11-2019 11:32

    Attaching the script I was talking about,

     

    rmon {
    alarm 1 {
    interval 10;
    variable jnxOperatingCPU.9.1.0.0;
    sample-type absolute-value;
    rising-threshold 70;
    rising-event-index 1;
    }
    event 1 {
    type log;
    }
    }

     

    policy test {
    events snmpd_rmon_eventlog;
    then {
    execute-commands {
    commands {
    "set cli timestamp";
    "set task accounting on";
    "show task accounting detail";
    "show krt queue";
    "show krt state";
    "show chassis routing-engine |no-more";
    "show system uptime |no-more";
    "show system connections | no-more";
    "show system processes extensive no-forwarding | no-more";
    "show system statistics | no-more";
    "show system virtual-memory no-forwarding | no-more";
    "show task memory detail | no-more";
    "show task memory summary | no-more";
    "show task io";
    "show task statistics";
    "show task jobs";
    "set task accounting off";
    }
    output-filename CPU-GET-HIGH.txt;
    destination log-for-CPU-GET-HIGH;
    output-format text;
    }
    }
    }



  • 5.  RE: Script to reboot SRX at 95% CPU and above

     
    Posted 02-11-2019 14:46

    One year development cycle?