# index.html
- 192.168.1.22 [Status: Unknown ]
- 192.168.0.2 [Status: Unknown ]
- 192.168.0.3 [Status: Unknown ]
# urls.py
url(r'^ping/(?P\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/$', ping),
# views.py
def ping(request, address=None):
if os.system('ping -c3 -q ' + address):
msg = "Ping OK"
else:
msg = "No response"
return HttpResponse(msg)
Inspiration : http://www.grenadepod.com/2009/11/13/query-data-from-django-site-with-jquery/