Skip to content

Commit

Permalink
Merge pull request #32 from suchitrotti/master
Browse files Browse the repository at this point in the history
export and import alerts
  • Loading branch information
danjagnow committed May 8, 2019
2 parents 3060d63 + 869ab4a commit 8cd279d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
22 changes: 22 additions & 0 deletions samples/export_alert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import requests
from orionsdk import SwisClient


def main():
npm_server = 'localhost'
username = 'admin'
password = ''
AlertID = 1 #AlertID for which we export data in xml file.

swis = SwisClient(npm_server, username, password)
results = swis.invoke('Orion.AlertConfigurations', 'Export', AlertID)
print(results)

with open('out.xml', 'w') as f:
f.write(results)

requests.packages.urllib3.disable_warnings()


if __name__ == '__main__':
main()
23 changes: 23 additions & 0 deletions samples/import_alert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import requests
from orionsdk import SwisClient


def main():
npm_server = 'localhost'
username = 'admin'
password = ''
importfile = 'out.xml' #file which contain AlertConfiguration in xml format.

swis = SwisClient(npm_server, username, password)

with open(importfile, 'r') as f:
alert = f.read()

results = swis.invoke('Orion.AlertConfigurations', 'Import', alert)
print(results)

requests.packages.urllib3.disable_warnings()


if __name__ == '__main__':
main()

0 comments on commit 8cd279d

Please sign in to comment.