Technical Configuration Example Feature Automation Script—cpu-usage-60.slax View a chart of the CPU usage for the last 60 minutes Juniper Networks, Inc. 1194 North Mathilda Avenue Sunnyvale, CA 94089 USA 408-745-2000 www.juniper.net This product includes the Envoy SNMP Engine, developed by Epilogue Technology, an Integrated Systems Company. Copyright © 1986–1997, Epilogue Technology Corporation. All rights reserved. This program and its documentation were developed at private expense, and no part of them is in the public domain. This product includes memory allocation software developed by Mark Moraes, copyright © 1988, 1989, 1993, University of Toronto. This product includes FreeBSD software developed by the University of California, Berkeley, and its contributors. All of the documentation and software included in the 4.4BSD and 4.4BSD-Lite Releases is copyrighted by The Regents of the University of California. Copyright © 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994. The Regents of the University of California. All rights reserved. GateD software copyright © 1995, The Regents of the University. All rights reserved. Gate Daemon was originated and developed through release 3.0 by Cornell University and its collaborators. Gated is based on Kirton’s EGP, UC Berkeley’s routing daemon (routed), and DCN’s HELLO routing protocol. Development of Gated has been supported in part by the National Science Foundation. Portions of the GateD software copyright © 1988, Regents of the University of California. All rights reserved. Portions of the GateD software copyright © 1991, D. L. S. Associates. Juniper Networks, the Juniper Networks logo, NetScreen, and ScreenOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. JUNOS and JUNOSe are trademarks of Juniper Networks, Inc. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners. Juniper Networks assumes no responsibility for any inaccuracies in this document. Juniper Networks reserves the right to change, modify, transfer, or otherwise revise this publication without notice. Products made or sold by Juniper Networks or components thereof might be covered by one or more of the following patents that are owned by or licensed to Juniper Networks: U.S. Patent Nos. 5,473,599, 5,905,725, 5,909,440, 6,192,051, 6,333,650, 6,359,479, 6,406,312, 6,429,706, 6,459,579, 6,493,347, 6,538,518, 6,538,899, 6,552,918, 6,567,902, 6,578,186, and 6,590,785. Copyright © 2009, Juniper Networks, Inc. All rights reserved. Printed in USA. ii : Table of Contents cpu-usage-60.slax 1 Description................................................................................................................... 1 System Requirements .................................................................................................. 1 What it Does ................................................................................................................ 1 Set Up .......................................................................................................................... 1 How to Run .................................................................................................................. 3 iii cpu-usage-60.slax Description Easily see the CPU processes usage over the last 60 minutes for any router configured with this script. Graphical format makes visual analysis quick and easy. Advanced users can customize the script to view other information in chart format, also, such as router temperature or memory usage. System Requirements All platforms; JUNOS Software 9.1 and above. What it Does This script uses get-accounting-record-information to collect routing engine CPU usage for the last 60 minutes and displays it in a chart format. It can also be modified to display other information, such as router temperature, round trip time (RTT) details, memory usage, and so on. Set Up 1. Copy the file cpu-usage-60.slax to /var/db/scripts/ops directory on the router. 2. Use a text editor to create the configuration below and copy it to the clipboard: accounting-options { file router.prf { files 3; } routing-engine-profile router-profile { file router.prf; interval 1; fields { time-of-day; total-cpu-usage; } } } Description 1 Juniper Networks Technical Configuration Example 3. On the device, enter configuration mode: user@host% cli user@host> configure Entering configuration mode [edit] user@host# 4. Use the load merge terminal command to load the configuration and merge it with the current configuration: user@host# load merge terminal [Type ^D at a new line to end input] > Paste the contentsof the clipboard here < 5. At the prompt, paste the contents of the clipboard 6. Press Enter. 7. Press Ctrl+D. 8. Enable the script by using the file statement and script filename to the [edit system scripts op] hierarchy level in the configuration, as shown below. Only superusers can enable scripts in the configuration. [edit system scripts op] user@host# set file cpu-usage-60.slax 9. Commit the configuration: [edit] user@host# commit and-quit 10. Commit the configuration: [edit] user@host# commit and-quit 2 Set Up : cpu-usage-60.slax How to Run 1. Make sure at least 10 minutes have passed before executing this script for the first time, to allow enough time for data to be collected. 2. Enter the command op cpu-usage-60 from the operational mode of CLI: user@host> op cpu-usage-60 The CPU usage for the last 60 minutes will be displayed in a graph similar to this: 1 1 1 999998999989998818889899888299989998999898989789907888889999 100| 90| 80| 70| 60| 50| 40| 30| 20| * * 10| **************** ********** ******************************** +-----------------------------------------------------------------------------------------0 5 1 1 2 2 3 3 4 4 5 5 6 0 5 0 5 0 5 0 5 0 5 0 x-axis => Mins, y-axis => CPU% (CPU Usage for the last 60 minutes) * show the CPU usage for the last 60 minutes * the top 2 rows vertically display the CPU % of that minute * the CPU % for the last minute is 9% How to Run 3
© Copyright 2024