Sar

From ICO wiki
Revision as of 23:06, 3 January 2013 by Mapalm (talk | contribs)
Jump to navigationJump to search

Autor: Matis Palm A21

Sar(system activity monitor) ehk süsteemi aktiivsuse monitor on algselt Solarisega seotud käsk, mida kasutatakse nüüd üldisemalt UNIX-i laadsete süsteemide peal. Linuxi peal saab sar-i kasutada läbi sysstat'i või atsar'i paketi(package).

Kasutamiseks tuleb editida /etc/default/sysstat faili, et lubataks süsteemiinfo kogumine(Kui see ei ole juba lubatud)

Seda võime teha kasutades nano tekstiredaktorit, omades piisavalt õiguseid (näites kasutan sudo't):

sudo nano /etc/default/sysstat
"ENABLED=false" asemel tuleb kirjutada "ENABLED=true"

Läbi selle saab kergesti infot erinevate süsteemijõudluse kohta : näiteks CPU(protsessori) aktiivsus, mälu/pagefile'i suurus, device load, võrgu kasutus.

sar [-flags] [ -e time ] [ -f filename ] [-i sec ] [ -s time ]

Näidisväljund : cpu %usr %sys %nice %idle _cpu_

         all   28    10      0     62
                0    39     8      0     52
                1    26     9      0     66
                2    27     8      0     65
                3    21    14      0     65

NB!tegemist on 4 tuumalise protsessoriga, ehk näidatakse protsessorite tuumade kasutust eraldi igale tuumale


-f filename Uses filename as the data source for sar. The default is the current daily data file /var/adm/sa/sadd. -e time Selects data up to time. The default is 18:00. -i sec Selects data at intervals as close as possible to sec seconds.

Näide:


Lisaks on olemas command sag, mis näitab graafiliselt seda infot binaarfailist, mis tekitati eelmise sar-i commandi jooksutamisega.

Süntaks:

sag [-e time] [-f file] [-i sec] [-s time] [-T term] [-x spec] [-y spec] ]

-e time Select data up to time . Default is 18:00. -f file Use file as the data source for sar . Default is the current daily data file /usr/adm/sa/sadd. -i sec Select data at intervals as close as possible to sec seconds. -s time Select data later than time in the form hh[:mm]. Default is 08:00. -T term Produce output suitable for terminal term. See tplot for known terminals. Default for term is $TERM. -x spec x axis specification with spec in the form:

name[op name]...[lo hi]

name is either a string that will match a column header in the sar report, with an optional device name in square brackets, for example, r+w/s[dsk-1], or an integer value. op is + - * or / surrounded by blank spaces. Up to five names may be specified. Parentheses are not recognized. Contrary to custom, + and - have precedence over * and /. Evaluation is left to right. Thus, A/A+B*100 is evaluated as (A/(A+B))*100, and A+B/C+D is (A+B)/(C+D). lo and hi are optional numeric scale limits. If unspecified, they are deduced from the data.

Enclose spec in double-quotes ("") if it includes white space.

A single spec is permitted for the x axis. If unspecified, time is used. -y spec y axis specification with spec in the same form as for -x. Up to 5 spec arguments separated by a semi-colon (;) may be given for -y. The -y default is:

-y"%usr0100;%usr+%sys0100;%usr+%sys+%wio0100"

Kasutatud materjalid // Edasi uurimiseks, kellel soovi