amuck-landowner

traceroute/ping looking glass via ssh

William

pr0
Verified Provider
i'm searching for someone to implement a looking glass in PHP with multinode support and access to the nodes by ssh (so commands run natively without backend) - similar to lg.he.net minus the bgp options.

Basic theme required, budget bespoken but not more than xx€, very basic API would be nice to have also.
 
Last edited by a moderator:

5n1p

New Member
Not sure why would you want to do this with ssh. I'm not good with php but here is simple bottle python script for ping and traceroute, I have added auth info also so you would need to run curl from your php page for all server ip's and get output:


from bottle import run, route, request, auth_basic
import os

def login_func(user, passwd):
if user == 'testuser' and passwd == 'testpasswd':
return True
else:
return False

@route('/ping/<ip>')
@auth_basic(login_func)
def ping_func(ip):
request.auth
ping_com = 'ping -c 4 %s' % ip
return os.popen(ping_com)

@route('/traceroute/<ip>')
@auth_basic(login_func)
def traceroute_func(ip):
request.auth
trace_com = 'traceroute %s' % ip
return os.popen(trace_com)

run (host='0.0.0.0', port=8081, debug=False)


to run command from your php you should use this:


curl --user testuser:testpasswd http://server1-IP:8081/ping/1.2.3.4

or

curl --user testuser:testpasswd http://server1-IP:8081/traceroute/1.2.3.4



I think it's safer this way ofc you should change username and password in that script. Simple curl without username and pass will give 401 error, so less chance for someone to abuse service.

Hope this helps.
 

Nikki

New Member
I don't see why you'd want to use it with straight ssh, but if you're willing to drop that requirement there's  does exactly what you want.
 
Last edited by a moderator:

Wintereise

New Member
SSH is probably because he intends to run this from actual routers, and not servers.

Routers tend not to have PHP/Python available, and are often the only clients that can actually decipher a MPLS path.
 

William

pr0
Verified Provider
I mainly want to use SSH as a setup with Nginx or alike simply does not scale to the current 100+ POPs, neither does the posted Python solution...

I'm also willing to opensource it if that changes anyting.
 
Last edited by a moderator:

Nikki

New Member
I mainly want to use SSH as a setup with Nginx or alike simply does not scale to the current 100+ POPs, neither does the posted Python solution...

I'm also willing to opensource it if that changes anyting.
LowEndPing might work for that, just enable websockets and use beanstalkd for the queue. If it doesn't I could always look into it and make it hopefully work. I just don't see how using ssh would change how it scales :p
 
Top
amuck-landowner