Operating System - HP-UX
1828038 Members
2409 Online
109973 Solutions
New Discussion

How to agregate data from various outputs to one single file

 
NDO
Super Advisor

How to agregate data from various outputs to one single file

Hi

I have a shell script that ruins on multiple servers, and gives me the following output:

Filesystem: / mounted [ OK ]
Filesystem: /stand mounted [ OK ]
Filesystem: /tmp mounted [ OK ]
Filesystem: /home mounted [ OK ]
Filesystem: /opt mounted [ OK ]
Filesystem: /usr mounted [ OK ]
Filesystem: /var mounted [ OK ]

 Uptime :   6:30am  up 4 days, 18:35,  1 user,  load average: 0.01, 0.01, 0.01

I/O related logs in the syslog.log file :
=========================================



LVM related logs in the syslog.log file :
=========================================



Warnings in logs:
=================


Errors in logs:
===============

But this is for a single server, and I want to have one single file with all this information but for all the servers like:

server 1:

mounted file systems : ok

.......
......


server 2:

mounted file systems: no


......


......

 

Can I have some ideas in how to approach this

2 REPLIES 2
Steven Schweda
Honored Contributor

Re: How to agregate data from various outputs to one single file

> Can I have some ideas in how to approach this

   Write a shell script?  This is a pretty elementary task.  How much
don't you know?  Web search for terms like, say:

shell  script  tutorial

   Make some files:

pro3$ cat file_1
file1 a
file1 b
file1 c

pro3$ cat file_2
file2 a
file2 b
file2 c

   Create an output file, and append things to it:

pro3$ touch all
pro3$ echo 'server 1:' >> all
pro3$ cat file_1 >> all
pro3$ echo 'server 2:' >> all
pro3$ cat file_2 >> all

pro3$ cat all
server 1:
file1 a
file1 b
file1 c
server 2:
file2 a
file2 b
file2 c

   Where will you get the server names like "server 1"?  Where will the
individual report files be?


   Presumably, a loop with some variables in the "echo" and "cat"
commands would make more sense than a long line of "echo" and "cat"
commands with constant arguments.

Re: How to agregate data from various outputs to one single file

There's already a tool for that - pdsh... see this post for a few more details...

https://community.hpe.com/t5/System-Administration/PDSH-configuration-in-HPUX-11-31/td-p/4728236#.XfnXGmT7Q-U

 

The manual referenced there has moved to here:

https://support.hpe.com/hpsc/doc/public/display?docLocale=en_US&docId=emr_na-c01920477&withFrame


I am an HPE Employee
Accept or Kudo