First a good thing to check is that your server is up to date, time is in sync, and OAuth is working properly - most of the time when it seems like “your IP is blocked” it’s actually an expired token, your clock is out of sync (OAuth doesn’t work) or your libraries are out of date and trying to make a request to a deprecated endpoint. Use the CURL test tool on one of the REST endpoints to generate a valid request.
Another thing to keep in mind are rate limits - assume that any endpoint that doesn’t have a ratelimit listed in the chart https://dev.twitter.com/rest/public/rate-limits is 15 calls per 15 minutes. Twitter responds with ratelimit info in response headers - you can use those to keep an eye on requests and stop when you run out of calls. It’s a very bad idea to call the same endpoint from multiple threads - your rate limits will be unpredictable, make 1 call at a time per endpoint instead.
Monitoring to make sure api.twitter.com is reachable is a bad idea: See F.5.d https://dev.twitter.com/overview/terms/agreement-and-policy#6.Update_Be_a_Good_Partner_to_Twitter it’s better to just keep your app running normally, and monitor for error responses.
Log and analyse errors from the API properly, and respond accordingly: see https://dev.twitter.com/overview/api/response-codes eg: if it’s a network timeout, it’s ok to retry after a short wait time, if it’s a rate limit notice - examine the response headers for the appropriate rate limit reset time, add on a few extra seconds and do not make any more requests to the endpoint. If it’s a 401, 403, 404 type error: do not make the request again. If it’s a problem with the request (invalid parameters, too many characters or whatever) fix it before retrying.
You’re unlikely to be blocked for making a few errors occasionally, or even running the maximum allowed calls frequently - but you are very likely to be blocked if you ignore errors and just keep retrying calls that are failing.