Operating System - Linux
1819801 Members
3037 Online
109607 Solutions
New Discussion юеВ

Trying to check port/service avaibility on remote servers via ssh

 

Trying to check port/service avaibility on remote servers via ssh

Hi, I'm doing a script which, from a centralized server, via ssh, it checks using netstat if mail services are listening on various remote-servers. Usually the command is "ssh remote-server netstat -an |grep ip:NN LISTEN|head -1" where NN is the door number (usually 25).
The problem is that if the server is busier than usually (or for other reasons maybe) it fails the check and even if service is up I collect an error.

I would like to eliminate the false positives.

Should I use another method, getting info still via ssh? Or you have a success story doing in another way?

Thanks,

Leonardo.
6 REPLIES 6
Ivan Ferreira
Honored Contributor

Re: Trying to check port/service avaibility on remote servers via ssh

I really think that you should not use SSH and just use nmap to test if the port is open.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Alexander Chuzhoy
Honored Contributor

Re: Trying to check port/service avaibility on remote servers via ssh

Totally agree with Ivan. Using ssh for that is a bit odd.
George Liu_4
Trusted Contributor

Re: Trying to check port/service avaibility on remote servers via ssh

Yeah. Try nagios.

Re: Trying to check port/service avaibility on remote servers via ssh

Thank you for replies. Well, I've never used nmap, but If I will use nmap, I'll have to enable almost 100 "doors/routing" from the central server to the remote-servers.
This means some work for me, but if you are sure about nmap I will try...

What do you think?

Leo.
Stuart Browne
Honored Contributor

Re: Trying to check port/service avaibility on remote servers via ssh

I'd start using 'nagios' if you've got this large a system/network of systems to monitor.

Once firewall holes and routing is opened up, it makes so much of your administrative life easier. Include the use of 'nrpe' and 'mrtg' to get the entire picture of how you're network and systems are operating.

If you're network design dictates that certain paths not be fully opened, you can set up slave servers to test areas, and pipe those results through to a master server for centralized monitoring.

In the medium-to-long run, it will be more helpful and less intrusive than a stop-gag of ssh'n tunnels for tests that take microseconds.

To give you an idea, my Office systems :-

Number of systems monitored: 23
Total number of tests: 307

Types of things monitored:
Host availability
SMTP
POP
IMAP
LMTP
SSH
DNS
WWW
VoIP
Disk space
CPU load
Mail queue sizes
Process availablity
User activity
Database availability
Database consistancy
Database mirroring
One long-haired git at your service...

Re: Trying to check port/service avaibility on remote servers via ssh

Hi Stuart, thank you for your reply, I have some experience with netsaint but not as administrator. What I can say by user side is that it has false positives. Then I don't know if this dipends on configuration tuning..
I'll try with nagios hoping that this would be more relyable...
---
In your post then You entered also another topic I must consider: mrtg. I should start monitoring new RH boxes (mail queue and bytes and others...) I have an old installation on a 6.2 server which cares about these values, but I don't know if cfg file are good for RH3ES...

Two questions: both about nagios and mrtg: their communities are vivid?
Can I find any documentation/tutorial about my tasks?

Bye,

Leo.