LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Application utilization command (http://www.linuxquestions.org/questions/linux-software-2/application-utilization-command-947622/)

bhargava_y 05-30-2012 12:57 PM

Application utilization command
 
I am looking for a command (if available) in linux which can report the usage of a particular application that is installed on the machine.

If a particular application "x" is installed, I would like to know in a period of say past 24 hrs, for how long it has been used.

Regards,
Bhargava

pan64 05-31-2012 07:46 AM

in general there is no such command, but in special cases it may exist.

bhargava_y 05-31-2012 07:52 AM

through 'ps' or some other command is it possible to know for how long a process or application has been running?

MensaWater 05-31-2012 08:06 AM

HP sells products for this called Glance (for real time monitoring) Measureware (for historical gathering) and OpenView Performance Monitor which lets you graph the historical information from Measureware. I've not used it on Linux but I believe they have it available. It allows you to group things by application and/or user so you can quickly drill down to those groups. I highly recommend it if you have the money.

Looking for an open source equivalent I ran across Systemtap. I haven't used it but based on what I see on its site I suspect it would be the tool I'd investigate (especially since we use RHEL heavily here and RedHat is one of the supporters of it and it is avaialable in RHEL repositories).

http://sourceware.org/systemtap/wiki/HomePage

Failing that you could do something like get your own data points via a script (e.g. "ps -ef |grep <processname>") that gets key metrics from the output such as cpu time, resident memory etc... and putting that into a data file at regular intervals then you could use that data in a spreadsheet to graph it (or use something like MRTG). You'd probably be better using ps -o and specifying the exact metrics.

Another one that looks interesting is collectl:
http://collectl.sourceforge.net/

pan64 05-31-2012 08:11 AM

on solaris ps has a format option "etime" to display elapsed time (and stime for starting time), but I cannot find it on linux.

MensaWater 05-31-2012 12:58 PM

Quote:

Originally Posted by pan64 (Post 4691997)
on solaris ps has a format option "etime" to display elapsed time (and stime for starting time), but I cannot find it on linux.

Interesting. There are various time factors you can get with "ps -o". Even more interesting is that the man page for ps on my CentOS5 box shows the following that specifically mentions etime:

Quote:

AIX FORMAT DESCRIPTORS
This ps supports AIX format descriptors, which work somewhat like the
formatting codes of printf(1) and printf(3). For example, the normal default
output can be produced with this: ps -eo "%p %y %x %c". The NORMAL codes are
described in the next section.

CODE NORMAL HEADER
%C pcpu %CPU
%G group GROUP
%P ppid PPID
%U user USER
%a args COMMAND
%c comm COMMAND
%g rgroup RGROUP
%n nice NI
%p pid PID
%r pgid PGID
%t etime ELAPSED
%u ruser RUSER
%x time TIME
%y tty TTY
%z vsz VSZ
I ran
Code:

ps -eo "%p %y %x %c %t"
and it output (truncated output shown):
PID TTY TIME COMMAND ELAPSED
1 ? 00:00:01 init 43-00:58:13
2 ? 00:00:05 migration/0 43-00:58:13
3 ? 00:00:00 ksoftirqd/0 43-00:58:13
4 ? 00:00:00 watchdog/0 43-00:58:13
5 ? 00:00:05 migration/1 43-00:58:13
6 ? 00:00:00 ksoftirqd/1 43-00:58:13
7 ? 00:00:00 watchdog/1 43-00:58:13

markseger 06-03-2012 07:19 AM

Turn on collectl and let it run for awhile (though once you turn it on there's no reason to ever turn it off ;)).

You can then play back the recorded data and look at how much time a process had used 24 hours ago and then again right now and the difference will tell you what you want to know.

-mark


All times are GMT -5. The time now is 03:23 AM.