Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to write a script that will log into several switches and check the status of several ports. I am running RHEL 4, and I have HP ProCurve 3500yl switches. I want to run something like the following:

ssh myhost -l myuser show interface A3

But when I do so, the ssh command just hangs until I hit ctrl-c. The manual seems to think I want to check the switch status through a web interface, so I can't find much guidance on getting the status remotely. Is there a way to do this over ssh? Is there another way that would be better but still scriptable?

share|improve this question
add comment

4 Answers

The usual method for checking switch status is by using SNMP. I would check to see if your switch supports SNMP (most managed switches should) and if it exposes the information you want via SNMP.

If you can program Perl, I'd recommend looking at the SNMP::Info module to make querying them easy.

share|improve this answer
add comment

You're doing it the correct way[1] - I would suggest opening up a ticket with HP to get this bug fixed.

You could one of these as a workaround:

ssh myuser@myhost show interface A3 < /dev/null
ssh myhost -l myuser $(echo -e 'show interface A3\nexit')

[1] i.e. works on a Cisco :)

share|improve this answer
add comment

This can be because of the HP welcome screen.

Install rancid, configure and run ~rancid/bin/hlogin -c "show version" switch1 switch2

(confirmed with HP 2626, just wait, it will log out)

Rancid rocks. If you're not using it, start now.

share|improve this answer
    
+1 for mentioning Rancid. Nice alternative solution. –  James Sneeringer Oct 15 '09 at 17:58
add comment

I don't know about the 3500yl, but on the 2600 and 2800, remote ssh commands are not supported. Running ssh with the -v (verbose) option gives the following:

debug1: Sending command: show interface 26
debug1: Received SSH2_MSG_UNIMPLEMENTED for 8
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.