Operating System - HP-UX
1755953 Members
3768 Online
108839 Solutions
New Discussion юеВ

Re: Need a script to execute in HPUX machine

 
SOLVED
Go to solution
Sharma_2002us
Occasional Advisor

Need a script to execute in HPUX machine

Need a script to execute mentioned commands and should give output in any format(HTML,word,excel)
1.uptime
2.cmviewcl -v
3.dmesg
4.tail -500 /var/opt/resmon/log/eventlog
5.Lvdisplay -v
6.lanscan -q
7.bdf
etc

please help me for this, otherwise each time i need to execute this commands and check it.Which is boring and difficult.
So Please get some script or give some solution.
16 REPLIES 16
James R. Ferguson
Acclaimed Contributor
Solution

Re: Need a script to execute in HPUX machine

Hi:

This could be a simple as this:

# cat ./myview
uptime
cmviewcl -v
dmesg
tail -500 /var/opt/resmon/log/eventlog
lvdisplay -v
lanscan -q
bdf
exit

# ./myview > ./myview.log

Regards!

...JRF...
Sharma_2002us
Occasional Advisor

Re: Need a script to execute in HPUX machine

But i need the output in the html or any other format which should not store in the server.
It should store in the Desktop which i am logging through it.
Matti_Kurkela
Honored Contributor

Re: Need a script to execute in HPUX machine

If I was a software developer, I might just say: "Moving the file to your workstation is outside the original scope of the project (as defined in your original post). This will have an extra cost."

In plain English (as opposed to Developerese), that would be "Why didn't you say so in the first place???"

Formatting the file into HTML is not going to make any difference in the task of moving the file from the HPUX system(s) to your workstation: most file transfer methods don't care what's inside the file, they just move it. So is the HTML format a real requirement, or something you thought might help?

Actually, moving the file to your workstation might be the most complicated part of the script.

The first big question is, what file transfer methods are available in your environment? What file transfer protocols are available both on the HPUX machines and on your workstation? Or can you install something into your workstation?

When the transfer method is selected, the next big question is, can the file be "pushed" from the HPUX machine(s) to your workstation, or must you do something (e.g. run another script on the workstation) to "pull" the files from the HPUX machine(s)?

For example, if your workstation had a SSH server software running in it, and all your HPUX servers had the free HP Secure Shell product installed it would be easy to modify James's script to write its output to a file, then push the file to your workstation using the scp command.

If you can only set up a writeable Windows network share on your workstation, and all the HPUX machines have a CIFS client installed, you could perhaps use that in the script to push the output file to the network share of your workstation.

If your site has a firewall between your workstation and the HPUX machines and it's configured to stop all connections from HPUX to workstation (but not vice versa), then you need to "pull" the files to you by doing something at your workstation. If the HPUX systems have the above-mentioned HP Secure Shell product installed, you could install PuTTY (a free SSH client that includes some scriptable command-line tools), and use its "plink" command to run the data collection script on a HPUX machine, then use "pscp" command to pull the output file from the HPUX machine to you.

You could even write a script (a .bat or .cmd in a Windows environment) to do this automatically for all your systems at once.

If SSH is not available, you might do something similar with telnet/rlogin and FTP, although that would not be secure at all.

...But listing all these possible methods without knowing anything about your environment is really boring and difficult and won't help you much. So please, answer these two questions:

1.) What file transfer protocols are available between your workstation and the HPUX machines?

2.) Is it possible to "push" data to your workstation from the HPUX side?

MK

MK
Raj D.
Honored Contributor

Re: Need a script to execute in HPUX machine

Sharma,

For HTML format,
This is what you need:


CFG2HTML, nice tool:


cfg2html_hpux_4.69-20100419-24165.depot cfg2html 4.69 for HP-UX 11.11-11.31 (hppa+ia64)


Check this out
http://www.cfg2html.com/

- Download the .depot file. --> ftp to the server.
- Install the depot , with swinstall
- Run the command # ./cfg2html
- The output will be .html and .txt as well.
- ftp back to your PC.
- you can open with browser and see all the data.
- Done.


Cheers, Have fun!.
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Sharma_2002us
Occasional Advisor

Re: Need a script to execute in HPUX machine

As u Said i can push the file from the Server to Desktop or any place.
but I am working as RE in customer Site so there are 59 HPUX servers. so i can't keep on logging and push the output file to the desktop..
madhuchakkaravarthy
Trusted Contributor

Re: Need a script to execute in HPUX machine

hi

my suggestion is generate ssh keys and use the below script.

----------------------------------
for i add all ur hostname(urs is 59 servers)

do

echo "======================================================================================================================================"

echo " "

echo " $i "

ssh $i /usr/local/bin/sudo /usr/sbin/cmviewcl



done

echo "======================================================================================================================================"

regards

MC
madhuchakkaravarthy
Trusted Contributor

Re: Need a script to execute in HPUX machine

hi

for generating ssh keys


http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1424116

refer to this post

regards

MC
Sharma_2002us
Occasional Advisor

Re: Need a script to execute in HPUX machine

Thanks Madhu but is there any easy method apart from that to run the script.
Sharma_2002us
Occasional Advisor

Re: Need a script to execute in HPUX machine

Its like just the script all the required output should come and print in the GNU format...Because i do't much about HPUX...still learning.... so plz help me for making a script..