Testing if other computer is online

Hello everyone!
How is it going?
So, I’m here again… haha… let’s go!!
While testing a feature in the system, I need to be sure that other computer, a server, is online. I’m thinking about doing that by ping but I didn’t find anything that can help me to do that. Is there anyone here that did something like this before and could help me?
Thanks in advance!
Have a nice day!

You can always use the OperatingSystem or Process libraries to start a command, like ping, then process its output.

But if your server has some service, like SSH, or HTTP(S), you can use the RequestsLibrary, SSHLibraryor other web testing library, to obtain data from server.

2 Likes

hummm… good… I have just searched in the robot builtin… my bad… I’m going to look into that others libraries docs and come back later to say if I found something… thanks a lot bro!

I am assuming that your computer is in the cloud : AWS / GC / Azure

PIng & Traceroute sadly are disabled

two options :
1- Use SSH
2- In security rules , enable another port

Then use RequestsLibrary or SSHLibrary as mentionned by HelioGuilherme66

1 Like

Using ping or traceroute is not fool proof way. For example, the machine itself could be online but the services it is used for could be offline or failing in other ways.

Depending on what services are being used, simple socket connection could be a better indication if the “machine is up or not”. Eg, ssh would do this but would then that would require that SSH is configured and it could still fail if auth fails.

I’d start by first going thru a list of what are the essential service the machine should provide (eg, what network ports should be available) and then opening a network socket into that port. This could be done via telnet and process library but for portability, i’d personally just use pure python and see if the 1. socket can be opened and 2. Does the server respond in any way from that socket/port.

3 Likes

+1 for SSHLibrary

It is the more reliable, and really easy to implement.
Open a ssh connection on the server, and catch if there is an issue.

The other way should be an endpoint on this server with a heartbeat or alive, then you just need to send a request to know the status, but need implementation on the server, if this endpoint is not already available.

Last, if in the cloud, use the cloud services to get availability of the server. More complex to implement.

1 Like