Solved

Need help writing custom script for Linux admin task

Posted on 2009-06-30
1
290 Views
Last Modified: 2012-05-07
I'm spending a lot of time manually reporting basic Linux system stats that I get from either Cacti monitoring tool and/or Top and ps command.  I'm essentially writing a report in following format below.

I'm pretty sure this could be done in Shell scripting and Cron job, not sure if it would be easier as a Perl script.  Either way I'm open to learning the most efficient and simplest solution for the above admin task.  
Host: <name value>
 
CPU Util: <value> (if Idle % is 100 - 60% print "Good" ; if Idle % is 60 - 30% print "Fair"; if Idle % is 30 - 0% print "Bad")
 
Memory Util: <value> (if Free Mem % is 100 - 60% print "Good" ; if Free Mem % is 60 - 30% print "Fair"; if Free Mem % is 30 - 0% print "Bad")
 
Up since: (check date PID was started;  calculate number of days/hours PID has been runninig; print value)
 
Email Frequency: Select (every 60 mins | every 24 hours )
Format HTML 
Send email to recipients
End.

Open in new window

0
Comment
Question by:gmahler5th
1 Comment
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 24757765
echo ''
echo Host: `uname -n` '< br>'
echo CPU/Memory Util: '< br>
'
top -b -n 1|head -6|tail -4
echo '

Open in new window

< br>'
echo Up since: `w|awk '(NR==1){print $3" "$4}'` '< br>'
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question