lm_rest 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +30 -1
- data/bin/system_category_cleaner.rb +5 -5
- data/lib/lm_rest/api_client.rb +1 -1
- data/lib/lm_rest/version.rb +1 -1
- data/lm_rest.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ca4971177cb2794426ad3ae05d420f1fdbda78717fc4d881380f367b6d820c6
|
4
|
+
data.tar.gz: 796de6d0afa84b5e176f188c17ec92043cfa55794755b6ab3daa744aea826f86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c2aca42fb85b2e09499664fa02fe6ac597ad2b2388f374b50bc3b8fa431871d8f0526b20e371ff55758bf6b4b7b4e57eac004c401f04521ed67c92100d1ae4
|
7
|
+
data.tar.gz: 9d433ae007765e5c3c7eccbfdeaa5aca086c21e0dd1fc5a9700ac4357c2393edec4f18d47474f4383f492c0e352dff99fa2038d66f9326b63272e4b6b15d4d8f
|
data/README.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
An Unofficial Ruby gem for the LogicMonitor REST API.
|
4
4
|
|
5
|
+
[](https://badge.fury.io/rb/lm_rest)
|
6
|
+
|
7
|
+
[LM Swagger API Docs](https://www.logicmonitor.com/swagger-ui-master/dist/)
|
8
|
+
|
5
9
|
## Installation
|
6
10
|
|
7
11
|
Add this line to your application's Gemfile:
|
@@ -18,6 +22,29 @@ Or install it yourself as:
|
|
18
22
|
|
19
23
|
`$ gem install lm_rest`
|
20
24
|
|
25
|
+
## Remove system.categories
|
26
|
+
|
27
|
+
If you accidentally applied system.categories all over your LogicMonitor
|
28
|
+
environment, or just need to clean out some old categories, there's an included
|
29
|
+
demo script just for you.
|
30
|
+
|
31
|
+
Install this gem, then check in the `/bin` folder of this repo for the
|
32
|
+
`system_category_cleaner.rb` script. It's very simple, you'll just need to pass
|
33
|
+
it the following arguments in order, preferrably in single quotes:
|
34
|
+
* Your portal name, like `'hooli'`
|
35
|
+
* Your API access ID like `'long_api_access_id'`
|
36
|
+
* Your API access Key like `'long_api_access_key'`
|
37
|
+
* The AppliesTo matching devices you want to scrub like
|
38
|
+
`'hascategory("collector")&& system.collectorversion>=24106'`
|
39
|
+
* The category you want to remove, like `'BadCategory'`
|
40
|
+
|
41
|
+
Your devices should be all cleaned up. The script will respect rate limits and
|
42
|
+
it splits all system.categories on ',' before removing the entry you specify.
|
43
|
+
|
44
|
+
It should go without saying that this is unofficial, unsupported, and may mess
|
45
|
+
your system up even more.
|
46
|
+
|
47
|
+
|
21
48
|
## Supported API Resources
|
22
49
|
|
23
50
|
Every API resource is defined in the `api.json` file and its associated defined
|
@@ -59,7 +86,9 @@ lm.get_datasource(721)
|
|
59
86
|
|
60
87
|
|
61
88
|
# return array of Resource objects whose names begin with "VMware"
|
62
|
-
|
89
|
+
# NOTE: when using filter, you need quotes around the filter's "value":
|
90
|
+
# This is incorrect in the LogicMonitor API docs as of this writing (8/10/2021)
|
91
|
+
lm.get_datasources(filter: 'name:"VMware*"')
|
63
92
|
|
64
93
|
|
65
94
|
# add a device to your account
|
@@ -9,9 +9,9 @@ def usage
|
|
9
9
|
puts "USAGE:\t" + $PROGRAM_NAME + ' account id key applies_to category'
|
10
10
|
puts ""
|
11
11
|
puts "\taccount - just the beginning of your portal name, like 'hooli'"
|
12
|
-
puts "\tid - API key access id"
|
13
|
-
puts "\tkey - API key access key"
|
14
|
-
puts "\tapplies_to - AppliesTo (in quotes on one line) matching devices you want to scrub"
|
12
|
+
puts "\tid - API key access id in quotes"
|
13
|
+
puts "\tkey - API key access key in quotes"
|
14
|
+
puts "\tapplies_to - AppliesTo (in single quotes on one line) matching devices you want to scrub"
|
15
15
|
puts "\tcategory - The system category value you wish to remove."
|
16
16
|
end
|
17
17
|
|
@@ -28,9 +28,9 @@ else
|
|
28
28
|
end
|
29
29
|
|
30
30
|
request = {
|
31
|
-
currentAppliesTo:
|
31
|
+
currentAppliesTo: @at,
|
32
32
|
needInheritProps: true,
|
33
|
-
originalAppliesTo:
|
33
|
+
originalAppliesTo: @at,
|
34
34
|
type: "testAppliesTo"
|
35
35
|
}
|
36
36
|
|
data/lib/lm_rest/api_client.rb
CHANGED
@@ -71,7 +71,7 @@ module LMRest
|
|
71
71
|
headers['Authorization'] = sign(method, uri, params)
|
72
72
|
headers['Content-Type'] = 'application/json'
|
73
73
|
headers['Accept'] = 'application/json, text/javascript'
|
74
|
-
headers['X-version'] = '
|
74
|
+
headers['X-version'] = '3'
|
75
75
|
|
76
76
|
url = api_url + uri
|
77
77
|
#puts "URL: " + url
|
data/lib/lm_rest/version.rb
CHANGED
data/lm_rest.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lm_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Rodrigues
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,14 +70,14 @@ dependencies:
|
|
70
70
|
name: json
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 2.5.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.5.1
|
83
83
|
description: Interact programmatically with your LogicMonitor account via the REST
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.4.19
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: API Wrapper for LogicMonitor Rest API v2.
|