akips 0.4.2__tar.gz → 0.4.4__tar.gz
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.
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"""This akips python module provides a simple way for python scripts to interact with
|
|
2
2
|
the AKiPS Network Monitoring Software Web API interface."""
|
|
3
3
|
|
|
4
|
-
__version__ = "0.4.
|
|
4
|
+
__version__ = "0.4.4"
|
|
5
5
|
|
|
6
|
+
import csv
|
|
6
7
|
import io
|
|
7
|
-
import re
|
|
8
8
|
import logging
|
|
9
|
+
import re
|
|
9
10
|
from datetime import datetime
|
|
10
|
-
|
|
11
|
+
|
|
11
12
|
import pytz
|
|
12
|
-
import
|
|
13
|
+
import requests
|
|
13
14
|
|
|
14
15
|
from akips.exceptions import AkipsError
|
|
15
16
|
|
|
@@ -208,7 +209,7 @@ class AKIPS:
|
|
|
208
209
|
[any|all|not group {group name} ...]`
|
|
209
210
|
"""
|
|
210
211
|
params = {
|
|
211
|
-
"cmds": f"mgroup {device}
|
|
212
|
+
"cmds": f"mgroup * {device}",
|
|
212
213
|
}
|
|
213
214
|
if groups:
|
|
214
215
|
group_list = " ".join(groups)
|
|
@@ -282,7 +283,7 @@ class AKIPS:
|
|
|
282
283
|
[any|all|not group {group name} ...]`
|
|
283
284
|
"""
|
|
284
285
|
params = {
|
|
285
|
-
"cmds": f"mget * {device} {child} {attribute}
|
|
286
|
+
"cmds": f"mget * {device} {child} {attribute}",
|
|
286
287
|
}
|
|
287
288
|
if value:
|
|
288
289
|
# [value {text|/regex/|integer|ipaddr}]
|
|
@@ -311,7 +312,9 @@ class AKIPS:
|
|
|
311
312
|
return data
|
|
312
313
|
return None
|
|
313
314
|
|
|
314
|
-
def get_events(
|
|
315
|
+
def get_events(
|
|
316
|
+
self, event_type="all", period="last1h", group_filter="any", groups=[]
|
|
317
|
+
):
|
|
315
318
|
"""
|
|
316
319
|
Pull a list of events.
|
|
317
320
|
|
|
@@ -322,6 +325,10 @@ class AKIPS:
|
|
|
322
325
|
[any|all|not group {group name} ...]`
|
|
323
326
|
"""
|
|
324
327
|
params = {"cmds": f"mget event {event_type} time {period}"}
|
|
328
|
+
if groups:
|
|
329
|
+
# [any|all|not group {group name} ...]
|
|
330
|
+
group_list = " ".join(groups)
|
|
331
|
+
params["cmds"] += f" {group_filter} group {group_list}"
|
|
325
332
|
text = self._get(params=params)
|
|
326
333
|
if text:
|
|
327
334
|
data = []
|
|
File without changes
|
|
File without changes
|
|
File without changes
|