Improve http ping response

This pull request does two things:

1. It is useful to store the http status code returned by a server when it is a client error (4XX) or server error (5XX). This can give insight into why the ping failed.
2. In the above situation (say a server returns a 502), then we should also store this in the exception attribute.

Tests added.