Sponsored Content
Top Forums Shell Programming and Scripting Shell script for logging cpu and memory usage of a Linux process Post 302805987 by jlliagre on Sunday 12th of May 2013 03:12:09 AM
Old 05-12-2013
This should do the job:
Code:
top -b | awk -v logfile=/tmp/log.txt '
{
	if($1 == "PID")
	{
		command="date +%T";
		command | getline ts
		close(command);
	}
	if($12 == "redis" || $12 == "logstash" || $12 == "elasticsearch" || $12 == "kibana")
	{
		printf "%s,%s,%s,%s,%s\n",ts,$1,$9,$10,$12 > logfile
	}
}'

 

10 More Discussions You Might Find Interesting

1. Programming

Monitor CPU usage and Memory Usage

how can i monitor usages of CPU, Memory, Hard disk etc. under SUN Solaries through a c program or java program i want to store that data into database so i can show it graphically thanks in advance (2 Replies)
Discussion started by: Gajanad Bihani
2 Replies

2. UNIX for Dummies Questions & Answers

cpu, memory and virtual memory usage

Hi All, Does anyone know what the best commands in the UNIX command line are for obtaining this info: current CPU usage memory usage virtual memory usage preferably with date and time parameters too? thanks ocelot (4 Replies)
Discussion started by: ocelot
4 Replies

3. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

4. Solaris

current CPU usage, memory usage, disk I/O oid(snmp)

Hi, I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP. I want the oids for above tasks. can you please tell me that Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies

5. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

6. UNIX for Advanced & Expert Users

How to find out memory & cpu usage of a process

Hi, By using time command we can determine the execution time of a process or command. bash-2.04$ time ls -l total 0 -rw-r--r-- 1 admin tac 0 Oct 6 04:46 file1 -rw-r--r-- 1 admin tac 0 Oct 6 04:46 file2 real 0m0.002s user 0m0.000s sys 0m0.001s... (5 Replies)
Discussion started by: learn more
5 Replies

7. AIX

How to trace cpu/memory usage for a process

I don't know when the process will start and end, I need write a script to trace it's cpu/memory usage when it is runing. How to write this script? (2 Replies)
Discussion started by: rainbow_bean
2 Replies

8. Shell Programming and Scripting

shell script to alert cpu memory and disk usage help please

Hi all can any one help me to script monitoring CPU load avg when reaches threshold value and disk usage if it exceeds some % tried using awk but when df -h out put is in two different lines awk doesnt work for the particular output in two different line ( output for df -h is in two... (7 Replies)
Discussion started by: robo
7 Replies

9. Shell Programming and Scripting

Script for CPU usage -Linux

Hi all I was wondering if its possible to write a script to keep CPU usage at 90%-95%? for a single cpu linux server? I have a perl script I run on servers with multple cpu's and all I do is max all but one cpu to get into the 90'% utilised area. I now need a script that raises the CPU to... (4 Replies)
Discussion started by: sudobash
4 Replies

10. Shell Programming and Scripting

Help with Shell script that monitors CPU Usage

I'm a newbie to shell scripting, I was given this script to modify. This script that monitors when CPU Usage is too high based off the top command. The comparison is not working as it should. Its comparing a decimal to a regualar interger. When it send me an email, it send an email and ignores the... (21 Replies)
Discussion started by: mhannor
21 Replies
condor_wait(1)						      General Commands Manual						    condor_wait(1)

Name
       condor_wait Wait - for jobs to finish

Synopsis
       condor_wait [-help -version]

       condor_wait[-debug] [-wait seconds] [-num number-of-jobs] log-file[job ID]

Description
       condor_waitwatches  a  user  log file (created with the logcommand within a submit description file) and returns when one or more jobs from
       the log have completed or aborted.

       Because condor_waitexpects to find at least one job submitted event in the log file, at least one job must have been successfully submitted
       with condor_submitbefore condor_waitis executed.

       condor_waitwill wait forever for jobs to finish, unless a shorter wait time is specified.

Options
       -help

	  Display usage information

       -version

	  Display version information

       -debug

	  Show extra debugging information.

       -wait seconds

	  Wait no more than the integer number of seconds. The default is unlimited time.

       -num number-of-jobs

	  Wait for the integer number-of-jobsjobs to end. The default is all jobs in the log file.

       log file

	  The name of the log file to watch for information about the job.

       job ID

	  A  specific job or set of jobs to watch. If the job IDis only the job ClassAd attribute  ClusterId , then condor_wait waits for all jobs
	  with the given  ClusterId . If the job IDis a pair of the job ClassAd attributes, given by  ClusterId . ProcId , then condor_wait  waits
	  for  the specific job with this job ID. If this option is not specified, all jobs that exist in the log file when condor_wait is invoked
	  will be watched.

General Remarks
       condor_waitis an inexpensive way to test or wait for the completion of a job or a whole cluster, if you are trying to get a process outside
       of Condor to synchronize with a job or set of jobs.

       It can also be used to wait for the completion of a limited subset of jobs, via the -numoption.

Examples
       condor_wait  logfile

       This command waits for all jobs that exist in  logfile to complete.

       condor_wait  logfile 40

       This command waits for all jobs that exist in  logfile with a job ClassAd attribute  ClusterId of 40 to complete.

       condor_wait  -num 2 logfile

       This command waits for any two jobs that exist in  logfile to complete.

       condor_wait  logfile 40.1

       This command waits for job 40.1 that exists in  logfile to complete.

       condor_wait  -wait 3600 logfile 40.1

       This waits for job 40.1 to complete by watching	logfile , but it will not wait more than one hour (3600 seconds).

Exit Status
       condor_waitexits  with  0  if and only if the specified job or jobs have completed or aborted. condor_waitreturns 1 if unrecoverable errors
       occur, such as a missing log file, if the job does not exist in the log file, or the user-specified waiting time has expired.

Author
       Condor Team, University of Wisconsin-Madison

Copyright
       Copyright (C) 1990-2012 Condor Team, Computer Sciences Department, University of  Wisconsin-Madison,  Madison,  WI.  All  Rights  Reserved.
       Licensed under the Apache License, Version 2.0.

       See the Condor Version 7.8.2 Manualor http://www.condorproject.org/licensefor additional notices. condor-admin@cs.wisc.edu

								  September 2012						    condor_wait(1)
All times are GMT -4. The time now is 06:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy