3 years ago
How to get current logicmonitor platform version?
Hello all,
Does anyone know how to grab the latest logic monitor platform version with groovy? E.g. the current one is v176 release (https://www.logicmonitor.com/release-notes)
I need it for a post request that I am running on a datasource with groovy.
Any help would be greatly appreciated.
Yours Sincerely,
Ronald McDonald
- Anonymous3 years ago
I do this as part of my script that notifies me of LogicModule updates. Some of these include statements are likely not needed if this is all you're doing.
import org.apache.http.HttpEntity import org.apache.http.client.methods.CloseableHttpResponse import org.apache.http.client.methods.HttpPost import org.apache.http.impl.client.CloseableHttpClient import org.apache.http.impl.client.HttpClients import org.apache.http.util.EntityUtils import javax.crypto.Mac import javax.crypto.spec.SecretKeySpec import org.apache.commons.codec.binary.Hex import org.apache.http.entity.ContentType import org.apache.http.entity.StringEntity import groovy.json.* def account = hostProps.get("LogicModule_Updates.company") def jsondata = new URL("https://${account}.logicmonitor.com/santaba/rest/version").getText() def versiondata = new JsonSlurper().parseText(jsondata) def version = versiondata.data.version.major ?: "173"