⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isag

📁 linux下查看系统工具原码,如IOSTAT等
💻
📖 第 1 页 / 共 3 页
字号:
#!/bin/sh# the next line restarts using wish and correctly pass the arguments to this\exec wish "$0" -- "$@"################################################################################# Copyright (c) 2000, 2001 David Doubrava (linux_monitor(at)volny(dot)cz)## Primary-site:	http://www.volny.cz:/linux_monitor/isag## This program/module is free software; you can redistribute it# and/or modify it under the terms of the GNU General Public License# as published by Free Software Foundation; either version 2 of the# License, or (at your option) any later version#  # This program is distributed in the hope that it will be usefull,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY of FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.################################################################################## 2006/04/14 : Sebastien GODARD# isag v1.3# Updated to current sysstat version (6.1.2).## $Id: isag.m4,v 1.26 2004/03/22 19:39:14 david Exp $# $State: Exp $## $Log: isag.m4,v $# Revision 1.26  2004/03/22 19:39:14  david# fully avoided shell script, i hope the temp file issue is fixed## Revision 1.25  2004/03/22 19:13:18  david# eliminated shell script, security issue## Revision 1.24  2004/03/02 20:28:00  david# replaced <> by () in mangled e-mails## Revision 1.23  2004/02/24 07:40:14  david# replaced (at) and (dot) in most e-mail addresses## Revision 1.22  2003/02/26 18:19:09  david# realized new layout of files## Revision 1.21  2003/02/23 21:07:35  david# first prototype of sag## Revision 1.20  2003/01/26 20:41:48  david# partially renamed variables, 1st implementation of "Save Graph"## Revision 1.19  2002/03/04 20:23:26  david# fixed whole day functionality## Revision 1.17  2001/07/30 18:05:41  sarrep# fix: bug2001060501; set LC_ALL to sane value; see Debian bug #101545## Revision 1.16  2001/04/22 14:19:34  sarrep# Added GPL related text# remove notes about solving R switch problems## Revision 1.15  2001/03/17 17:30:15  sarrep# CVSizing, unified headers of each element file## Revision 1.14  2001/03/17 16:55:26  sarrep# LINUX RESTART zeroes all counters.## Revision 1.13  2001/03/11 20:15:19  sarrep# First step after CVSizing## Revision 1.12  2001/02/20 19:06:10  sarrep# added q switch and actialize B switch to version 3.3.6## Revision 1.11  2001/02/10 10:42:03  sarrep# finally renamed from sarrep to isag# added additional commnts in header# added patching## Revision 1.10  2001/02/03 11:02:17  sarrep# removed many same (for family) parts to different files.# improved generationg of cmd array.## Revision 1.9  2001/01/27 19:28:43  root# added secondary Y axes functionality# added -c cfg_file cmdln option# writting of selected config data to cfg_file# renamed chart lines to names used in sar# parametrized creating of cmd() array# added generic var __M4_TIMELEN__ for proc_line_generic## Revision 1.8  2001/01/20 19:02:53  root# added version check due to bug.2312200001# added secondary Y label## Revision 1.7  2000/12/30 18:35:06  root# split into few parts. main idea next extensibility for other platforms## Revision 1.6  2000/12/30 11:30:20  root# command line argument(s) functionality was added# preparation for config file was done# and few small changes## Revision 1.5  2000/12/23 21:22:10  root# fixed situation if LINUX RESTART is in data file# fixed if no more than one line in data file.# try to fix wrong graph size after resizing appl. window## Revision 1.4  2000/12/23 20:48:31  root# function rescale_graph was renamed to redraw_graph# and one menu item was added.## Revision 1.3  2000/12/16 13:37:12  root# resize window related functions## Revision 1.2  2000/12/11 18:54:17  root# behavior will be parametrized## Revision 1.1  2000/12/11 15:01:07  root# Initial revision################################################################################## specific for sebastien's sar################################################################################# $Id: version.m4,v 1.4 2002/03/04 20:20:27 david Rel $# $State: Rel $# $Log: version.m4,v $# Revision 1.4  2002/03/04 20:20:27  david# make new end line## Revision 1.3  2001/03/17 17:43:07  sarrep# About dialog modify## Revision 1.2  2001/03/17 17:30:26  sarrep# CVSizing, unified headers of each element file#################################################################################set ident "/usr/bin/ident"set version ""# This can be set only if small interactive change in result code was occuredset patchlevel ""if {[catch {set fp [open "| $ident $argv0" "r"]}] == 0} {	set n 0	while {[gets $fp line] != -1} {		if {$n != 0 && -1 != [string first "Id:" $line]} {			set version "$version\n[string trim $line]"		} else {			set n 1		}	}} else {	set version "Unknown! $ident is missing"}if {"" != $patchlevel} {	set version "$version\nPatch level: $patchlevel"}# $Source: /var/CVSROOT/cvs/i-sag/common/version.m4,v $############################################################################### Tcl/Tk: version check## $Id: ver_check.m4,v 1.6 2003/03/03 20:11:16 david Exp $# $State: Exp $# $Log: ver_check.m4,v $# Revision 1.6  2003/03/03 20:11:16  david# fixed tools name## Revision 1.5  2002/03/24 15:18:26  david# added## Revision 1.4  2002/03/04 20:20:27  david# make new end line## Revision 1.3  2001/03/17 17:30:25  sarrep# CVSizing, unified headers of each element file##################################################################################set needed_version 8.0if {$tcl_version < $needed_version} {	out_msg "Warning Version check" "sag needs $needed_version, but this is version $tcl_version of Tcl.\nSome features can fail"#	exit}# $Source: /var/CVSROOT/cvs/i-sag/common/ver_check.m4,v $################################################################################ default paths, programs and other variables## $Id: variables.m4,v 1.5 2003/01/26 20:41:49 david Rel $# $State: Rel $# $Log: variables.m4,v $# Revision 1.5  2003/01/26 20:41:49  david# partially renamed variables, 1st implementation of "Save Graph"## Revision 1.4  2002/03/04 20:20:27  david# make new end line## Revision 1.3  2001/03/17 17:30:24  sarrep# CVSizing, unified headers of each element file##################################################################################set gnuplot	"/usr/bin/gnuplot"set grep	"/bin/grep"set sh		"/bin/sh"set gunzip	"/usr/bin/gunzip"set sed		"/bin/sed"# default placement of config fileset isag_cfg_file	"$env(HOME)/.isag.cfg"set sag_graph_wd	720set sag_graph_ht	400# $Source: /var/CVSROOT/cvs/i-sag/common/variables.m4,v $################################################################################ Message box functionality## $Id: msg_box.m4,v 1.6 2002/03/24 15:18:26 david Exp $# $State: Exp $# $Log: msg_box.m4,v $# Revision 1.6  2002/03/24 15:18:26  david# added## Revision 1.5  2002/03/04 20:21:08  david# make new end line## Revision 1.4  2001/06/03 19:58:04  sarrep# improved behaviour, added grab capability# removed (softly) Cancel button## Revision 1.3  2001/03/17 17:30:22  sarrep# CVSizing, unified headers of each element file##################################################################################proc msg_box_btn {w} {	destroy $w}proc out_msg {title text} {	toplevel .msg_box		wm title .msg_box $title	label .msg_box.l -text $text -justify left	pack .msg_box.l -side top	frame .msg_box.b	pack .msg_box.b -side top	button .msg_box.b.ok -text OK -command {msg_box_btn .msg_box}	pack .msg_box.b.ok -side left#	button .msg_box.b.cancel -text cancel -command {msg_box_btn .msg_box}#	pack .msg_box.b.cancel -side left	grab .msg_box	tkwait window .msg_box}# $Source: /var/CVSROOT/cvs/i-sag/isag/msg_box.m4,v $# specific paths and programsset sar_data_path "/var/log/sa"set sar_data_mask "sa\[0-9\]\[0-9\]"set sar "/usr/bin/sar"# following check added: Thu Mar 18 21:44:52 GMT+1 2004if { 1 != [file executable $sar]} {	out_msg "Error" "File: $sar does not exist"	exit }#fix: bug2001060501; set LC_ALL to sane value; see Debian bug #101545 set env(LC_ALL) "C"################################################################################ $Id: isag_common_options.m4,v 1.6 2003/01/26 20:41:48 david Rel $# $State: Rel $# $Log: isag_common_options.m4,v $# Revision 1.6  2003/01/26 20:41:48  david# partially renamed variables, 1st implementation of "Save Graph"## Revision 1.5  2002/03/24 15:18:26  david# added## Revision 1.4  2002/03/04 20:21:51  david# make new end line## Revision 1.3  2001/03/17 17:30:20  sarrep# CVSizing, unified headers of each element file##################################################################################proc Usage {} {	global sar_data_path sar_data_mask isag_cfg_file sag_graph_wd sag_graph_ht	out_msg "Usage" \"isag \[options\]Options:\t-p data_path (default: $sar_data_path)\t-m data_file_mask (default: $sar_data_mask)\t-c cfg_file (default: $isag_cfg_file) \t-gwd graph_width (default: $sag_graph_wd)\t-ght graph_height (default: $sag_graph_ht) "        exit}proc getopt {argv opt} {	set rv ""	if {-1 != [set t [lsearch -exact $argv "-$opt"]]} {        	set rv [lindex $argv [expr $t + 1]]	}	return $rv}if {-1 != [set t [lsearch -exact $argv "-h"]]} {	        Usage}if {-1 != [set t [lsearch -exact $argv "-?"]]} {	        Usage}if {[set t [getopt $argv c]] != ""} {	# check for path	if {1 == ([file exist $t] && [file isfile $t])} {		set isag_cfg_file $t	} else {		out_msg "Error" "<$t> is not regular file, using default <$isag_cfg_file>"	}}if {[set t [getopt $argv p]] != ""} {	# check for path	if {1 == ([file exist $t] && [file isdirectory $t])} {		set sar_data_path $t	} else {		out_msg "Error" "<$t> is not directory, using default <$sar_data_path>"	}}if {[set t [getopt $argv m]] != ""} {		set sar_data_mask $t}if {[set t [getopt $argv ght]] != ""} {	if {1 == [string is digit $t]} {		set sag_graph_ht $t	} else {		out_msg "Error" "<$t> is not decimal number, using default <$sag_graph_ht>"	}}if {[set t [getopt $argv gwd]] != ""} {	if {1 == [string is digit $t]} {		set sag_graph_wd $t	} else {		out_msg "Error" "<$t> is not decimal number, using default <$sag_graph_wd>"	}}unset t# $Source: /var/CVSROOT/cvs/i-sag/isag/isag_common_options.m4,v $################################################################################# Variables connected to graphs and their default values## selected archive file for sa data, typically saNN# this variable is set thru: data Chooser (see: Concept Guide)set sag_if_archive ""# last_graph contains last drawing function as letterset last_graph ""# sar switches as names for object-instances (final and curent)#set prog_swtch [list b B c n q r R u v w W y]set  prog_swtch [list b B c   q r R u v w W]# maximal and current values for each graph indexed by sar switch i.e. for cpu # is index u not -uforeach l $prog_swtch {	set val_max($l) 0	set val_cur($l) 0	set has_negative($l) 0}unset l# exceptionsset val_max(u) 100set has_negative(R) 1set val_max(W) 1set val_cur(W) 1# graph/view names this is shoved in menu-view and as name of the graph# and other functional parameters#	xlabel - label for x-axis#	ylabel - label for y-axis#	y2label - label for secondary y-axis#	plotstr - string plot for gnuplot, describes a graph## view_n(ame) arrayset view_n(b) "I/O Transfer Rate"set view_n(B) "Paging Statistics"set view_n(c) "Process Creation"set view_n(q) "Run Queue"set view_n(r) "Memory and Swap"set view_n(R) "Memory Statistics"set view_n(u) "CPU Utilization"set view_n(v) "Inode Status"set view_n(w) "System Switching"set view_n(W) "System Swapping"# xlabel is not an array - all values are sameset xlabel "Time"# ylabel arrayset ylabel(b) "ops/sec"set ylabel(B) "pages/sec"set ylabel(c) "procs/sec"set ylabel(q) ""set ylabel(r) "kB"set ylabel(R) "ops/sec"set ylabel(u) "Percent"set ylabel(v) ""set ylabel(w) "cswch/sec"set ylabel(W) "swp/sec"set y2label(b) ""set y2label(B) ""set y2label(c) ""set y2label(q) ""set y2label(r) ""set y2label(R) ""set y2label(u) ""set y2label(v) ""set y2label(w) ""set y2label(W) ""# sag_if_out_tokens describes how is input file covered# if no list specified the proc_line_$l() is called# Note: first element has index 0 (zero)!# SGo 2006-04-14: update fields taken for options -B, -q, -r, -R, -v.set sag_if_out_tokens(b) [list 1 2 3 4]set sag_if_out_tokens2(b) ""set sag_if_out_tokens(B) [list 0 1 2 3]set sag_if_out_tokens2(B) ""set sag_if_out_tokens(c) [list 0]set sag_if_out_tokens2(c) ""set sag_if_out_tokens(q) [list 0 1 2 3 4]set sag_if_out_tokens2(q) ""set sag_if_out_tokens(r) [list 0 1 3 4 5 6 8]set sag_if_out_tokens2(r) ""set sag_if_out_tokens(R) [list 0 1 2]set sag_if_out_tokens2(R) ""# CPU needs special computation, following list must be empty# if no list is entered then following functions must be defined# __output_zero_metrics_$l & proc_line_$l (see: proc_line_u())set sag_if_out_tokens(u) ""set sag_if_out_tokens2(u) ""set sag_if_out_tokens(v) [list 0 1 2 3 5 7]set sag_if_out_tokens2(v) ""set sag_if_out_tokens(w) [list 0]set sag_if_out_tokens2(w) ""set sag_if_out_tokens(W) [list 0 1]set sag_if_out_tokens2(W) ""## The sar_elim() array contains string which have to be eliminated from sar's output

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -