led indication for services (on/off) on a linux machine

hi , i will start with a little background info about myself… im an arduino beginner (just received it by mail) with little c/c++ programming knowledge.

i need some guidance as to where to start regarding the project im on:

i would like to monitor a service running on a linux server and indicate the status of the service (on/off) by a led light.

connecting to the linux machine must be through an SSH tunnel, but as i gather arduino is too “weak” for ssh so i’ll need to send and receive commands to/from a local
pc via telnet, then the local pc will convert these commands to ssh and vice versa.

also communicating to and from the pc would have to go through wifi.

can you guys tell me if this is even possible? and if so , where should i start ?

thanks !

It might be more secure to plug the arduino into the server, and have it act as a small webserver. That way you wouldn't have to leave an SSH session open for long periods of time, possibly un-monitored. Most services on linux have some kind of status command that can be called via the terminal, so i'm thinking you could have a bash script that runs all those commands and saves the responses to a text file. That text file could be sent to the arduino over its usb serial connection. You might be able to open the connection to the arduino in the same script that polls all your services, if not a simple python script would do it. The arduino could display the results on a simple html page.

If you need an LED light at a remote location, a second arduino could parse the simple html page (or they could communicate directly) and light it. How you light it depends on the type of LED, it could be as simple as adding a current limiting resistor and turning it on with a pin, or you might need a transistor or relay for a larger LED.

My solution is a little overly-complex, but it would prevent any new attack vectors from being opened up.

that seems more secure but the problem is i dont have physical access to the remote linux server...
any thoughts?

track2:
that seems more secure but the problem is i dont have physical access to the remote linux server...
any thoughts?

I think I read your post wrong. I assumed the local PC would be local to the server, not to you. I also thought you meant the PC would be talking to the server over wifi.

So let me try again. You have a remote server that you want to monitor. You have a local PC that connects to the internet via wifi, and to the server over the internet. Will the arduino also need to use wifi to connect to the PC, or will it be close enough to connect through serial/usb?

How secure will the PC be? Will it just sit somewhere secure most of the time, or will you be lugging it around with you?(assuming its a laptop) You could probably get away with just locking down the user that you use for the SSH session. Give it read permissions for that one file, lock everything else, strip it of program execution permissions, don't give it a home directory, etc. A VPN would probably be preferable to SSH.

You could use the same bash file idea on the server, and have it save the output to a file on the PC, using a method like this: bash - How to remotely write to a file using SSH - Super User . Then you wouldn't have a constantly open incoming SSH tunnel to the server.

The local arduino could grab that information off the PC in any number of ways. I'm not familiar with telnet on the arduino, but there are many examples of sending data to and from an arduino via TCP or UDP packets. Depending on the amount of services you need to monitor, one packet could be enough.

So let me try again. You have a remote server that you want to monitor. You have a local PC that connects to the internet via wifi, and to the server over the internet. Will the arduino also need to use wifi to connect to the PC, or will it be close enough to connect through serial/usb?

thats correct , but the local pc is connected to the internet through a local router with a cable. also i need the arduino to connect to the local router via wifi.

How secure will the PC be? Will it just sit somewhere secure most of the time, or will you be lugging it around with you?(assuming its a laptop) You could probably get away with just locking down the user that you use for the SSH session. Give it read permissions for that one file, lock everything else, strip it of program execution permissions, don't give it a home directory, etc. A VPN would probably be preferable to SSH.

the pc is sitting in a secured location and is not mobile , also a constant open ssh tunnel to the server is not a problem .

For wifi on the arduino, I like the RN-XV Wifly units, with the WiflyHQ library:

You will also need an xbee explorer breakout board to make the RN-XV module work with the 5v serial lines on the Arduino.

I would just have the server save the results of that bash script to a file on the PC (using that method I linked to), then have a a little python script or something on the PC send a packet to the arduino containing the service state. The Wifly HQ library has an example that shows how to listen for a packet, and searching for "wiflyhq and python" shows you how to send the packet.

The actual lighting of the LED is trivial and covered in the playground and example sections of this site (its pretty much the first thing you learn how to do with an arduino). Thats assuming a standard 5mm LED, higher current LEDs require a little more setup.

ok that seems like a good starting point , i'll first need to learn how bash scripts work and how to make it save the file on the local PC.
that helped alot thanks!!