File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ import requests
2
+ from orionsdk import SwisClient
3
+
4
+
5
+ def main ():
6
+ npm_server = 'localhost'
7
+ username = 'admin'
8
+ password = ''
9
+ AlertID = 1 #AlertID for which we export data in xml file.
10
+
11
+ swis = SwisClient (npm_server , username , password )
12
+ results = swis .invoke ('Orion.AlertConfigurations' , 'Export' , AlertID )
13
+ print (results )
14
+
15
+ with open ('out.xml' , 'w' ) as f :
16
+ f .write (results )
17
+
18
+ requests .packages .urllib3 .disable_warnings ()
19
+
20
+
21
+ if __name__ == '__main__' :
22
+ main ()
Original file line number Diff line number Diff line change
1
+ import requests
2
+ from orionsdk import SwisClient
3
+
4
+
5
+ def main ():
6
+ npm_server = 'localhost'
7
+ username = 'admin'
8
+ password = ''
9
+ importfile = 'out.xml' #file which contain AlertConfiguration in xml format.
10
+
11
+ swis = SwisClient (npm_server , username , password )
12
+
13
+ with open (importfile , 'r' ) as f :
14
+ alert = f .read ()
15
+
16
+ results = swis .invoke ('Orion.AlertConfigurations' , 'Import' , alert )
17
+ print (results )
18
+
19
+ requests .packages .urllib3 .disable_warnings ()
20
+
21
+
22
+ if __name__ == '__main__' :
23
+ main ()
You can’t perform that action at this time.
0 commit comments