LogicMonitor
Elixir wrapper for the Logic Monitor REST API as outlined here.
Still in development. POST has not been tested. Need remainder of resources implemented. Contributions welcome!
Installation
LogicMonitor can be installed by adding logic_monitor to your list of dependencies in mix.exs:
def deps do
[{:logic_monitor, "~> 0.0.6"}]
endConfiguration
LogicMonitor requires three application variables. Add the following variables to your config.exs file (this example retrieves those variables from environment variables):
config :logic_monitor,
account: System.get_env("LM_ACCOUNT"),
access_id: System.get_env("LM_ACCESS_ID"),
access_key: System.get_env("LM_ACCESS_KEY")
The HTTPotion timeout value is configurable by the optional timeout application variable, which defaults to 30_000 (30 seconds) when not set:
config :logic_monitor,
timeout: 60_000Usage
For each Resource, the list of allowable query parameters can be found on the LogicMonitor site here or in a module resource at the top of the respective module.
Alerts
LogicMonitor.Alerts.all()
LogicMonitor.Alerts.all(sort: "this_way", fields: "type,id")ApiTokens
LogicMonitor.ApiTokens.all()
LogicMonitor.ApiTokens.all(sort: "this_way", fields: "accessId,adminName")
LogicMonitor.ApiTokens.for_user("124")AuditLogs
LogicMonitor.AuditLogs.all()
LogicMonitor.AuditLogs.all(sort: "this_way", fields: "a,b,c")
LogicMonitor.AuditLogs.get("12345")
LogicMonitor.AuditLogs.get("12345", fields: "a,b,c")Raw requests to Logic Monitor for resources that are not yet implemented can be made like this:
LogicMonitor.Request.get("/alert/alerts","filter=type:serviceAlert")
LogicMonitor.Request.post("/alert/alerts/1234/ack", "", "{\"ackComment\":\"hello\"}")Docs can be found at https://hexdocs.pm/logic_monitor.