Solved

Need help writing custom script for Linux admin task

Posted on 2009-06-30
1
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
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.
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…
Six Sigma Control Plans

615 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