Solved

Need help writing custom script for Linux admin task

Posted on 2009-06-30
1
291 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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…

821 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