Sponsored Content
Full Discussion: check cpu usage
Top Forums Shell Programming and Scripting check cpu usage Post 302178275 by nua7 on Tuesday 25th of March 2008 06:51:08 AM
Old 03-25-2008
Hammer & Screwdriver

Hi!
This might be useful. It would give you procedure to send a mail thru perl.Extracting cpu usage shouldn't be a big deal.

Code:
sub _send_email($$$) {
	my $recipient = shift;
	my $full_name = shift;
	my $result_file = shift;
	my $res_file = basename($result_file);
	my $res_dir = dirname($result_file);
	chomp(my $hostname = qx/uname -n/);

	my $msg = MIME::Lite->new(
		From => '"Manager Usage" <MGR@"Server name">',
		To => "\"$full_name\" <$recipient>",
		Subject => "Results of usage for $input_dir on $hostname",
		Type => 'multipart/mixed',
		Data => "The results of your usage run are attached."
	);

	$msg->attach(
		Type => 'TEXT',
		Data => "Hello,\n$full_name\n\nPlease DO NOT reply to this email!\n\nIt was generated by a non-user account.  Attached is a file\ncontaining the results of your requested deck_check.upl run.\n\nThank You,\nThe HP Issuance Team"
	);

	$msg->attach(
		Type => 'TEXT',
		Path => "$result_file",
		Filename => "$res_file",
		Disposition => 'attachment'
	);

	$msg->send("sendmail");
}

 

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. Programming

CPU usage and memory usage

Please tell me solaris functions/api for getting following information 1- Function that tells how much memory used by current process 2- Function that tells how much memory used by all running processes 3- Function that tells how much CPU is used by current process 4- Function that tells how... (1 Reply)
Discussion started by: mansoorulhaq
1 Replies

3. UNIX for Dummies Questions & Answers

How check the overall CPU usage of the unix server

Hi All, Can anyone help me.. I want to know the command to check the overall CPU usage of the server. Note: I don't want the CPU usge of each and every process. I just want to know thw aggregate CPU utilization of the server. (2 Replies)
Discussion started by: Selva_Kumar
2 Replies

4. Programming

Cpu usage

Hi all, When I have a below while loop in my code (This observation is same for C and Perl) i= 0; while(1) { i++; } for above the CPU uses goes beyond 49% on hp-ux machine, why cpu usage increase at this level for just a simple while loop? and if I have a single print statement... (2 Replies)
Discussion started by: zing_foru
2 Replies

5. 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

6. 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

7. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

8. 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

9. Shell Programming and Scripting

Command to check the CPU usage for particular user

Hi All, Can anybody knows, how to check the CPU usage in percentage for a particular process along with its user and PID? Thanks in advance!! (3 Replies)
Discussion started by: AB10
3 Replies

10. AIX

Overall CPU Usage

Hi Guys, I am a newbie on the forum. This is my first post, so first of all I would like to introduce myself. I am a SAS Analyst programmer working for an Health Insurance client. SAS is installed on a 16 CPU AIX Server with partitions running with shared processor. I have couple of... (2 Replies)
Discussion started by: saurabhiim2003
2 Replies
sa(8)							      System Manager's Manual							     sa(8)

Name
       sa, accton - print process accounting statistics

Syntax
       /etc/sa [ options ] [ file ]

       /etc/accton [ file ]

Arguments
       file    With  an  argument naming an existing file, causes system accounting information for every process executed to be placed at the end
	       of the file.  If no argument is given, accounting is turned off.

Description
       The command reports on, cleans up, and generally maintains accounting files.

       The is able to condense the information in into a summary file which contains a count of the number of times each command  was  called  and
       the time resources consumed.  This condensation is desirable because on a large system can grow by 100 blocks per day.  The summary file is
       normally read before the accounting file, so the reports include all available information.

       If a file name is given as the last argument, that file will be treated as the accounting file.	The file is the default.

       Output fields are labeled: "cpu" for the sum of user+system time (in cpu seconds), "re" for real time (also in cpu seconds), "k"  for  cpu-
       time  averaged  core usage (in 1k units), "avio" for average number of I/O operations per execution.  With options fields labeled "tio" for
       total I/O operations, "k*sec" for cpu storage integral (kilo-core seconds), "u" and "s" for user and system cpu time  alone  (both  in  cpu
       seconds) will sometimes appear.

Options
       -a      List  all  command names including those containing unprintable characters and those used only once. By default, places all command
	       names containing unprintable characters and those used only once under the name `***other.'

       -b      Sort output by sum of user and system time divided by number of calls.  Default sort is by sum of user and system times.

       -c      Besides total user, system, and real time for each command, print percentage of total time over all commands.

       -d      Sort by average number of disk I/O operations.

       -D      Print and sort by total number of disk I/O operations.

       -f      Force no interactive threshold compression with option.

       -i      Do not read in summary file.

       -j      Instead of total minutes for each category, give seconds per call.

       -k      Sort by cpu-time average memory usage.

       -K      Print and sort by cpu-storage integral.

       -l      Separate system and user time; normally they are combined.

       -m      Print number of processes and number of CPU minutes for each user.

       -n      Sort by number of calls.

       -r      Reverse order of sort.

       -s      Merge accounting file into summary file when done.

       -t      For each command, report ratio of real time to the sum of user and system times.  If the sum of user and system times is too  small
	       to report, `*ignore*' appears in this field.

       -u      Superseding all other flags, print for each command in the accounting file the user ID and command name.

       -v      Followed  by  a number n, types the name of each command used n times or fewer.	Await a reply from the terminal; if it begins with
	       `y', add the command to the category `**junk**.' This is used to strip out garbage.

Restrictions
       Accounting is suspended when there is less than 2% free space on disk.  Accounting resumes when free space rises above 4%.

Files
       Raw accounting

       Summary

       Per-user summary

See Also
       acct(2), ac(8)

																	     sa(8)
All times are GMT -4. The time now is 12:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy