We have updated our SimpleScript install on NodeHost and now you can take advantage of 2 new functions s.check_valid_ssl and s.check_expired_ssl to automatically get alerts when your SSL fails using workers. The script is simple and you just need to change the domain and enter in your API key to get alerts.

v.sslvalid=true
v.domain="nodehost.ca"

v.has_ssl=s.check_valid_ssl(v.domain)
if v.has_ssl false
v.sslvalid=false
end

v.expired_ssl=s.check_expired_ssl(v.domain)
if v.expired_ssl true
v.sslvalid=false
end

if v.sslvalid false
v.title=s.string_url_encode("Certificate is expired or not in place")
v.message=s.string_url_encode("We are unable to verify the ssl certificate for the v.domain domain. When we Checked for valid SSL and if not expired it failed.")
v.alert=s.http_request_get("https://api.nodehost.cloud/post_account_email_create?api_key=APIKEY&subject=v.title&message=v.message&type=alert")
v.response=s.json_decode_reverse(v.alert)
if notset v.response[data][error]
s.echo("Alert sent via email")
else
s.echo("Was not able to send alert")
end
else
s.echo("The certificate is valid and not expired!")
end
Was this article helpful?
Cancel
Thank you!