LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-05-2012, 01:53 PM   #1
vivek.defender
LQ Newbie
 
Registered: Dec 2012
Posts: 3

Rep: Reputation: Disabled
need some idea to automate report generation in linux and solaris servers


Hi all,

I need to automate performance report generation in linux and solaris servers.

Currently im taking report manually from 200 servers by loging in, so it would be very greatful if anybody have ideas.

parameters are cpu,memory,disk utilization,load average,ntp delay

Thanks in advance

Last edited by vivek.defender; 12-05-2012 at 01:54 PM.
 
Old 12-05-2012, 06:38 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Kind of depends on your requirements like for instance if host-based modification is allowed, if you need push or pull, etc, etc. Logging in is not necessary if you use SNMP with Nagios, Zenoss, GroundWork Core, OpenNMS or whatever tool or suite you fancy.
 
1 members found this post helpful.
Old 12-06-2012, 04:51 AM   #3
vivek.defender
LQ Newbie
 
Registered: Dec 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
thanks for thr reply

my report looks like this

Date,Server Name,Server IP,Operating System,Processor(<70%),Memory(<70%),Load Average,ntp,ntp_delay,Disk Space


i need to fill in the above parameters in an excel doc , each sheet in the doc refers to a country.

Last edited by vivek.defender; 12-06-2012 at 04:52 AM.
 
Old 12-06-2012, 06:36 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
So what is your question exactly?
 
Old 12-06-2012, 07:19 AM   #5
vivek.defender
LQ Newbie
 
Registered: Dec 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
this is the report runs in each server

#!/usr/bin/ksh
DATE=`date +%Y%m%d%H%M`
#HOST=`hostname`
HOST=name-x.x.x.x
DIR=/healthcheck/report
echo >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo ============== STATICS REPORT ================== >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo ============= >> $DIR/stats.${HOST}_${DATE}
echo VMSTAT-OUTPUT >> $DIR/stats.${HOST}_${DATE}
echo ============= >> $DIR/stats.${HOST}_${DATE}
vmstat 2 5 >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo ============ >> $DIR/stats.${HOST}_${DATE}
echo MEMORY USAGE >> $DIR/stats.${HOST}_${DATE}
echo ============ >> $DIR/stats.${HOST}_${DATE}
vmstat 2 5 | tail -1 | awk '{ print 100-($5/8257536)*100}' >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo ============== >> $DIR/stats.${HOST}_${DATE}
echo SAR-CPU-OUTPUT >> $DIR/stats.${HOST}_${DATE}
echo ============== >> $DIR/stats.${HOST}_${DATE}
sar -u 2 5 >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo ============= >> $DIR/stats.${HOST}_${DATE}
echo IOSTAT-OUTPUT >> $DIR/stats.${HOST}_${DATE}
echo ============= >> $DIR/stats.${HOST}_${DATE}
iostat -xnptc 2 5 >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo ================== >> $DIR/stats.${HOST}_${DATE}
echo IOSTAT-DISK-ERRORS >> $DIR/stats.${HOST}_${DATE}
echo ================== >> $DIR/stats.${HOST}_${DATE}
iostat -en >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
iostat -EN >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo ============ >> $DIR/stats.${HOST}_${DATE}
echo SYS-LOAD-AVG >> $DIR/stats.${HOST}_${DATE}
echo ============ >> $DIR/stats.${HOST}_${DATE}
uptime >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo =========== >> $DIR/stats.${HOST}_${DATE}
echo INODE-USAGE >> $DIR/stats.${HOST}_${DATE}
echo =========== >> $DIR/stats.${HOST}_${DATE}
/usr/ucb/df -i >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo ================ >> $DIR/stats.${HOST}_${DATE}
echo DISK-UTILIZATION >> $DIR/stats.${HOST}_${DATE}
echo ================ >> $DIR/stats.${HOST}_${DATE}
df -h >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo ==== >> $DIR/stats.${HOST}_${DATE}
echo DATE >> $DIR/stats.${HOST}_${DATE}
echo ==== >> $DIR/stats.${HOST}_${DATE}
date >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo ========== >> $DIR/stats.${HOST}_${DATE}
echo NTP STATUS >> $DIR/stats.${HOST}_${DATE}
echo ========== >> $DIR/stats.${HOST}_${DATE}
ntpq -p >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo ============= >> $DIR/stats.${HOST}_${DATE}
echo MEMORY REPORT >> $DIR/stats.${HOST}_${DATE}
echo ============= >> $DIR/stats.${HOST}_${DATE}
ps -eo pid,vsz,comm |sort -n -k 2,2 >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
echo >> $DIR/stats.${HOST}_${DATE}
while read LINE
do
printf $DATE
printf " "
print $LINE
done < $DIR/stats.${HOST}_${DATE}

and it runs on every server ,my task is to take those parameters in an excel sheet,to do this i have open the logs and take the report , i need to automate it

Last edited by vivek.defender; 12-06-2012 at 07:24 AM.
 
Old 12-06-2012, 08:51 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by vivek.defender View Post
my task is to take those parameters in an excel sheet
From reading your reply I'll assert that you neither have the inclination to suggest and discuss improvements nor that you are in a position to do so. That is a pity because the output you have to work with is not suitable for useful inclusion without modification. You will have to put in a lot of effort. Start by listing the common report file location(s) (/var/www, /var/log, /tmp), file ownership and access rights (0660, 0644, root, unprivileged user), the way(s) you access report data (SSH, telnet, HTTP, etc, etc) and how you think you should modify the report to fit a CSV file. Actual code preferred but any pseudo code should do.
 
Old 12-06-2012, 09:42 AM   #7
Habitual
LQ 5k Club
 
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,576
Blog Entries: 15

Rep: Reputation: Disabled
Personally, I'd start asking for help in a suitable format, such as [code][/code] tags around 75 lines of code, or script(s), or script output...
The markup is minimal, where rendered text can be problematic off the clipboard.

Moving on...
Linux and Solaris servers...
ssh keys will make this whole task seamless and fluid.
Do you have any that can help automate this?

Hard Answer:
If you are up for expanding your skill as either as a programmer, or a decent sysadmin, this sounds like a job for snmp, or Perl.

Easy Answer:
If it were me and I didn't know snmp, or Perl, I'd process the remote script by 'running' it from your workstation, going in over key-based ssh
For example:
Code:
ssh -i ~/.ssh/somekey_rsa userid@xxx.xx.xxx.xx <systat_utility_here>
ssh keys will make this whole task seamless and fluid, and $DIR/stats can be manipulated locally.

and then you are free to spend the saved time working on 51 less "ECHO" statements.

Have a great day!

Edit0: My suggestion is in NO WAY to be taken as a recipe as this task can be automated in about 5 quick steps, and perhaps some minor .sh code editing.

Last edited by Habitual; 12-06-2012 at 11:18 AM.
 
Old 12-07-2012, 12:22 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Nobody is going to read a spreadsheet with 200 rows every day of this sort of stuff.
I believe you'd be better off either

1. graphing it eg Cacti
OR
2. pump it into a DB, then you/someone can write a nice web gui to generate random reports based on input params eg servername and/or the values of certain values you've collected.

Of course see post #2 if you want to to be alerted if a param is exceeded.

In other words, exactly why do you want to do this; what will the data be used for; under what circumstances?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Using BASH to automate data processing and table generation. marcusrex Programming 19 04-13-2012 10:20 AM
RSA Public Key generation resets automatically halting SSH between linux servers Karthick2388 Linux - Server 10 03-26-2012 12:48 AM
automate SSL certificate generation jakev383 Linux - Server 4 07-24-2009 09:50 AM
Rebooting Linux servers bad idea? dippelw Linux - General 4 11-30-2005 04:50 PM
Report Generation Question BrentC Programming 1 10-18-2003 05:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration