System Administration Performance Monitoring For a server, it is crucial to monitor the health of the machine You need not only real time data collection.

Slides:



Advertisements
Similar presentations
Syslog and log files1-1 Syslog and Log Files  From logfiles, you can find m important information m History m Errors/warnings  Logging policies m Reset.
Advertisements

CIS 193A – Lesson3 Vigilance! Logging & Monitoring Syslog Logrotate Logwatch Accounting.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux+ Guide to Linux Certification, Second Edition
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
Linux+ Guide to Linux Certification, Second Edition
5 UNIX Processes. Introduction  Processes  How to list them  How to terminate them  Process priorities  Scheduling jobs  Signals.
UNIX System Administration Handbook Chapter 4. Controlling Processes 3 rd Edition Evi Nemeth et al. Li Song CMSC691X Summer 2002.
Offline Performance Monitoring for Linux Abhishek Shukla.
Guide to Linux Installation and Administration, 2e1 Chapter 3 Installing Linux.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
Fall 2011 Nassau Community College ITE153 – Operating Systems 1 Session 4 More Hands-on Commands.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
Managing Processes CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
System Monitoring and Automation. 2 Section Overview Automation of Periodic Tasks Scheduling and Cron Syslog Accounting.
TELE 301 Lecture 10: Scheduled … 1 Overview Last Lecture –Post installation This Lecture –Scheduled tasks and log management Next Lecture –DNS –Readings:
Linux+ Guide to Linux Certification, Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 10 Managing System Resources.
1 Interface Two most common types of interfaces –SCSI: Small Computer Systems Interface (servers and high-performance desktops) –IDE/ATA: Integrated Drive.
1 Objectives Manage and install new file systems.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 6 Manage Linux Processes and Services.
Managing processes and services. 1. How Linux handles processes 2. Managing running processes 3. Scheduling processes.
Linux+ Guide to Linux Certification, Second Edition Chapter 10 Managing Linux Processes.
RH030 Linux Computing Essentials
Lecture – Performance Performance management on UNIX.
A Practical Guide to Fedora and Red Hat Enterprise Linux Unit 9: Linux Network Services Chapter 16: Administration Tasks By Fred R. McClurg Linux Operating.
Guide To UNIX Using Linux Third Edition Chapter 8: Exploring the UNIX/Linux Utilities.
 Advanced programming for the unix environment (chapters 7,8,9 of both editions + chapter 13(2 nd edition))
Nezer J. Zaidenberg.  Advanced programming for the unix environment (chapters about processes)
1 Periodic Processes and the cron Daemon The cron daemon is where all timed events are initiated. The cron system is serviced by the cron daemon. What.
Chapter 10 Chapter 10: Managing the Distributed File System, Disk Quotas, and Software Installation.
Guide to Linux Installation and Administration, 2e1 Chapter 11 Using Advanced Administration Techniques.
Linux+ Guide to Linux Certification Chapter Eleven Managing Linux Processes.
Cosc 4750 Log files Logging policies Throw away all data immediately Reset log files at periodic intervals Rotate logs files, keeping data for a fixed.
Lab 3 + Using the Terminal 1. "Under Linux there are GUIs (graphical user interfaces). where you can point and click and drag, and hopefully get work.
System Administration – Part 2. Devices in UNIX are files: A device can be accessed with different file names All device files are stored in /dev or its.
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 9 Working.
System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:
CS 390 Unix Programming Environment
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Linux Processes Last Update Copyright Kenneth M. Chipps Ph.D. 1.
CSC414 “Introduction to UNIX/ Linux” Lecture 3
Processes Todd Kelley CST8207 – Todd Kelley1.
Guide to Parallel Operating Systems with Windows 7 and Linux Chapter 10 Operating System Management.
OPERATING SYSTEMS STRUCTURES Jerry Breecher 2: Operating System Structures 1.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 7: Advanced File System Management.
Advanced Computing Facility Introduction
Linux203Training Module System Mgmt.
Process Management Process Concept Why only the global variables?
Cosc 4750 Log files.
Proc File System Sadi Evren SEKER.
MCTS Guide to Microsoft Windows 7
Chapter 2: System Structures
Linux 202 Training Module Program and Process.
Operating Systems Lecture 11.
Using the Terminal Lab 3+.
Structure of Processes
Exploring the UNIX File System and File Security
SUSE Linux Enterprise Desktop Administration
CHAPTER 8 ( , ) John Carelli, Instructor Kutztown University
Accounting Accounting collects information about users and processes
Chapter 2: Operating-System Structures
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Periodic Processes Chapter 9.
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
File System Management
Linux Filesystem Management
Chapter 2: Operating-System Structures
Presentation transcript:

System Administration Performance Monitoring For a server, it is crucial to monitor the health of the machine You need not only real time data collection and presentation but “offline” statistical analysis as well Characteristics of a computer's health: ● Load ● Disk usage ● Process accounting

System Administration Load Load average measures the number of processes in the run queue, i.e. the number of processes waiting to use the CPU Ideally, load should be 1 or less Several ways to obtain load averages: ● uptime, w, ps, top all report load averages ● cat /proc/load ● tload, xload present graphical displays of load

System Administration Performance Monitoring Load Exercise Run xload and start an intensive process # xload -update 1 -scale 2 & # ooimpress &

System Administration Performance Monitoring Disk Usage Disks do no good if they are full This is especially true for server processes. If a log file cannot be written, some daemons may crash ● du gives a report of disk usage. It will descend all directories unless the -s option is given ● df gives a report of disk usage and the amount of free space available df [file or file system]

System Administration Process Accounting THE most important thing to monitor is what is running on your computer Processes are tasks being executed by your CPU Each process is allocated space in the process table which tracks information the CPU needs to schedule and swap a task for CPU and memory usage Information for processes currently in the process table can be retrieved with the ps and top commands pstree is also very useful for following the process ownership

System Administration Process Accounting ps gives a variety of output depending on the options selected. Most useful options ● A – show all processes ● a – show only processes connected with a tty ● x – show only processes disconnected from a tty ● u – display the effective user name ● o – user defined format

System Administration Process Accounting Example ps output: ps xua root ? S Jan13 0:04 init edsall pts/8 S 14:03 0:00 sleep 300 edsall pts/10 R 14:07 0:00 ps xua giving the following information ● Username ● Process ID (PID) ● Percent CPU being used ● Percent memory being used ● Virtual memory size ● Resident memory usage ● Associated TTY ● Current process status ● Date/time the process was started ● System tme used by the process ● Name of the command

System Administration State codes First letter: R – running S – interruptible sleep D – uninterruptible sleep T – stopped Z -- “zombie” Second letter: + -- foreground process s – session leader N – low priority (“nice”) < -- high priority (not nice) l -- multithreaded

System Administration Performance Monitoring Process Accounting ps only gives a one-time snapshot of the processes in the process table top gives process information which updates at regular intervals. top also allows you to interactively sort the information being displayed top presents other useful system information including the system load average and memory usage

System Administration Performance Monitoring Process Accounting Example top output: 8:05pm up 8 days, 2:31, 1 user, load average: 0.54, 0.55, processes: 56 sleeping, 1 running, 0 zombie, 0 stopped CPU states: 1.9% user, 2.3% system, 0.0% nice, 95.6% idle Mem: K av, K used, K free, 46804K shrd, K buff Swap: K av, 4124K used, K free K cached PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND root R :00 top nobody M 4492 S :06 httpd nobody M 4532 S :03 httpd nobody M 4512 S :03 httpd nobody M 4500 S :06 httpd nobody M 4532 S :06 httpd nobody M 4496 S :03 httpd nobody M 4504 S :03 httpd root S :00 in.rlogind

System Administration Performance Monitoring Process Accounting Exercises Run ps aux # ps aux Run top # top

System Administration /proc File System On Linux systems (and many other operating systems), ps and top actually read their data from the /proc file system /proc is a mirror of the kernel configuration and what is currently memory resident As a result we can not only read the state of the system but modify its configuration in real time Information in /proc is stored in files in a hierarchical manner based on the aspect of the system they describe

System Administration /proc File System Examples: ● loadavg- file containing System load average ● meminfo – file containing the number of total, used and free bytes of memory and swap area ● cpuinfo – file containing recognized processor parameters ● net – Directory containing descriptions about the network layer(s)

System Administration /proc File System Information on current processes is stored in directories corresponding to the PID of the process. Example: The init command, corresponding to PID = 1 has the following subdirectories in /proc/1: cmdline cwd environ exe fd maps mem mounts root stat statm status # cat /proc/1/environ HOME=/ TERM=linux

System Administration Monitoring the health of your computer can be enhanced by collecting data and analyzing later to look for trends. There are many ways to do this: ● Write your own packages ● Use an Open Source package ● Use a commercial package Examples: Tivoli Ecotools Candle

System Administration Before writing your own package, look to see if someone else has already done the work for you. Many Open Source packages available ● psacct ● sysstat ● Hobbit

System Administration psacct The psacct package provides simple process accounting and process summary information. Data collection is initiated with the command accton These data can later be analyzed with the commands ac, lastcomm and sa, the most useful of which is sa

System Administration Performance Analysis sysstat The sysstat package, which comes by default with most recent Red Hat Linux distributions, collects an enormous amount of data on system resources including ● paging activity ● interrupts ● network activity ● memory

System Administration Performance Analysis sysstat Several times a day, cron runs the commands in the /etc/cron.d/sysstat crontab to collects the data. The same crontab analyzes the collected data once a day. Results can be found in /var/log/sa/ and reports can be generated with the sar command.

System Administration Performance Analysis sysstat Exercise Look at the contents of /var/log/sa # ls -l /var/log/sa Run the sar command to get a report # /usr/bin/sar -A | more

System Administration Hobbit Hobbit is an open source pacakge available to most non-profit groups for free. Hobbit not only generates history graphs, it also, and most prominently, is used as a real-time performance monitor IT Services uses Hobbit: More information can be found at

System Administration Log Files Many processes running on the system generate log files Linux stores all of its system log files in a special directory - /var Log files can quickly fill the partition on which they are stored Tip – create a separate partition for /var

System Administration Log Files One important system logging process – syslogd. Many processes make a syslog call to write information to the system log void openlog(char *ident, int option, int facility); void syslog(int priority, char *format,...); void closelog(void); The processes are always writing. Whether you wish to see it depends on how you configure syslogd

System Administration Log Files syslogd is configured with the file /etc/syslog.conf Each line consists of a selector and an action for that selector # Log anything (except mail) of level info or higher. # Don't log private authentication messages! *.info;mail.none;cron.none /var/log/messages

System Administration Log Files # Log anything (except mail) of level info or higher. # Don't log private authentication messages! *.info;mail.none;cron.none /var/log/messages The selector identifies the facility which may request logging and the priority level at which it may want logging. See the correlation? void openlog(char *ident, int option, int facility); void syslog(int priority, char *format,...); For each selector an action is specified. In most cases, the action is the name of a file to which the messages will be logged

System Administration Remote Log Files syslogd can log its information to a remote server: In this case, syslogd will send everything to the syslog daemon on the remote servers remotelog1 and remotelog2 If the bad guys tamper with log files on your server, you have a pristine copy elsewhere that might show their break-in

System Administration Monitoring Your Log Files logwatch ● Daily analysis of logfiles – can be e- mailed to you ● Global and local configuration ● Can analyze on a per-service basis In /etc/log.d: Scripts for services and filters they use Config files for services

System Administration Monitoring Your Log Files logwatch ######## LogWatch (02/18/03)######## Processing Initiated: Mon Mar 26 11:33: Date Range Processed: yesterday Detail Level of Output: 0 Logfiles for Host: webmail-1.iastate.edu ####################################### Connections (secure-log) Begin Connections: Service shell: : 4 Time(s) Connections (secure-log) End

System Administration Reining in Your Log Files logrotate Wouldn't it be nice if we could delete old log files or move them elsewhere? Otherwise, our disks may fill. logrotate can: ● Back-up ● Compress ● Mail logfiles subject to a variety of constraints you specify

System Administration Reining in Your Log Files logrotate logrotate is configured via a set of configuration files Generally one main config file (/etc/logrotate.conf) is used to “include” other config files in /etc/logrotate.d The config files contain the name of the file to be acted on and directives which specify the actions to be taken, how often to take these actions, etc

System Administration Reining in Your Log Files logrotate # Logrotate file for psacct RPM /var/account/pacct { prerotate /usr/sbin/accton endscript compress notifempty daily rotate 31 create 0600 root root postrotate /usr/sbin/accton /var/account/pacct endscript }