• 0

Post a crictical issue count to API server




I want to POST an critical issue count to my API server. My python script is as follow.

import json
from urllib import parse, request
from config import (USER, PASSWORD, COMPANY)
def rpc(action, params):
    Make a call to the LogicMonitor RPC library and return the response
    print("Calling action: {action}".format(action=action))
    print("Parameters: {params}".format(params=params))
    param_str = parse.urlencode(params)
    creds = parse.urlencode({"c": COMPANY, "u": USER, "p": PASSWORD})
    if param_str:
        param_str = param_str + "&"
    param_str = param_str + creds
        url = "https://{0}.logicmonitor.com/santaba/rpc/{1}?{2}"
        f = request.urlopen(url.format(COMPANY, action, param_str))
        return f.read()
    except IOError as ioe:
        # end try

# end rpc

def main():
    response = rpc("getAlerts", {"level": "critical"})
    tmp_text = response.decode("utf-8")
    instance = json.loads(tmp_text)
    count = len(instance.get('data').get('alerts'))

if __name__ == "__main__":


I know to do this job in python webserver, but I want to use `LogicMonitor` integration.

How can I convert it to `Custom HTTP Delivery`?

I have been reading the docs for a while, but it seems not answer exactly what I want at all

Hope communities can support me figure out how to finish this job

Best regards


Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
  • LogicMonitor Staff

Hi Sarit,

It sounds like you're looking to send a count of critical alerts to an external server or application, is that correct?  The Custom HTTP Delivery option in LogicMonitor is intended to provide a way to send an HTTP request in response to an alert, and since there isn't an alert to trigger based on here I'm not sure it's the best fit for this scenario.  Can you explain a little bit more about what you're trying to accomplish?



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.