Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using ping to check if a Linux machine is online and ready to be used. However, ping doesn't really tell you if the system is actually doing anything useful, just that the kernel's network subsystem is alive and configured. Is there any way to tell that the machine is completely ready to perform tasks?

EDIT:

Sorry I wasn't clear. The tasks I need the machines to perform are varied. Some just run very small tests. Others talk to databases. And there'll probably be new tasks that the machines in the network will need to perform in the future. Is there a single command that tells me that all core(default) services are running?

share|improve this question

migrated from stackoverflow.com Mar 23 '13 at 2:42

This question came from our site for professional and enthusiast programmers.

2  
Perform what tasks? You can do a portscan to get an idea of which network-facing services are running on the machine. –  us2012 Mar 22 '13 at 14:59
    
The only thing you know with ping is that the network forwards ICMP packets to the destination addy, and the enpoint processes the packet. Period. –  YvesLeBorg Mar 22 '13 at 15:00
    
For any mod looking: poor flag selection, my apologies for that. Secondly, the question seems a bit too broad, or maybe unclear: essentially it sounds like a product recommendation, but the question itself is rather broad. –  Thor Dec 26 '13 at 18:11
add comment

5 Answers

I'd recommend setting up monitoring and alerting software like Nagios http://www.nagios.org/ or Zenoss.

They both have plugins for all the services (tasks) you're planning to offer on your server and will set up the heartbeat and analytic stuff to alert you when things go bad.

Like others have posted, ping only checks connectivity between the pinging computer and the host. Nagios, after initial setup, can monitor connectivity, check if Oracle is alive, verify your web server and application servers are up, memory/cpu usage, and anything else you can think of...

edit: I'm pretty certain there's no single command that can get you everything you're asking for out-of-the-box, but do let me know if there is one! :) Until then, you'll be in for a bit of work~

Hope this helps, -Minh

share|improve this answer
add comment

I think your own question is an answer in a way. Is there any way to tell that the machine is completely ready to perform tasks?

Which tasks? Lets say you want it to perform tasks using web and database and dns services. You could write a script that would check if all those services are running and server is not overloaded. Other than that, unless those tasks are not defined there is no useful way of knowing if server is ready to perform (which) tasks.

It sometimes happens that one of our servers is running perfectly alright but the DKIM service is stopped, it then makes PostFix unable to send out email, it can easily go undetected if we were not to check DKIM service. So you really have to define and then check for specified services in order to be sure.

share|improve this answer
add comment

That's a complex question... I guess the best way to check how everything is going is to connect to the linux machine by ssh, and executing commands from there to check all services. Anyway, note that you can't do this if the machine you're trying to connect to doesn't have a ssh daemon running (or has the 22 port blocked, for example).

As far as I know, there's no other way to check that out.

share|improve this answer
    
Why not? Write a web program that can check for those services and report. And in case that program itself doesn't load, that means even the web server is down. –  Hanky Panky ㇱ Mar 22 '13 at 15:02
    
By "no other way to check that out" i meant you have to check every service. Be it a shell script or a web interface, you have to code it manually as there's no built-in solution, AFAIK. –  Bartserk Mar 22 '13 at 15:05
add comment

Aside from pinging a host you could probably check if a specific port is open without any prior knowledge and without access to the machine itself. For a machine running a web service that you control i'd recommend creating a specific page with the info you're interested in (e.g mem load, processes, ...) in a format of your choice (xml, json, ...) and fetch and eval this on a regular basis.

Alternatively - thats something i used in the past - write a specific daemon for your server that collects info thats useful for you (as before, memory load, processes, ...) and transmit this to your supervision site regularly. But you'll have to make sure that you detect and handle the case where no updates arrive anymore.

Adressing your edit - I don't think there's a single command to check for default services remotely, as the default services vary depending on your task. The most basic approach, if you just want to see what a machine is doing would be to use some sort of

ps -ef

or

top

on the commandline to see the active processes (assuming a linux machine).

You could even wrap this in a php exec statement and transfer it to a client machine when the machine is running a webserver.

share|improve this answer
add comment

You could install a simple webserver (must at least be able to send html-files) to check if a specific html-file-content is sent wen using curl. (curl http://adress will write the content of the answer of the webserver to stdout).

share|improve this answer
add comment

Your Answer

 
discard

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