Start XMC scripts or workflows via NAC Notifications" or NetSight "Alarms Manager"
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎10-30-2018 06:31 AM
Hello,
is there a way to start scripts (Python!) or workflows created via XMC triggered by NAC "Notifications" or Netsight "Alarms manager"?
I know I can start every script/executable in the file system and the python scripts are stored in the file system. But if I start these files directly I have to handle myself the "Device Selection" for the correct device the script should run against.
I hope there is a smoother way to do that because that's a normal scenario:
For me the event is from outside (example port down on an arbitrary switch in XMC).
Best regards
Stephan
is there a way to start scripts (Python!) or workflows created via XMC triggered by NAC "Notifications" or Netsight "Alarms manager"?
I know I can start every script/executable in the file system and the python scripts are stored in the file system. But if I start these files directly I have to handle myself the "Device Selection" for the correct device the script should run against.
I hope there is a smoother way to do that because that's a normal scenario:
- Something happens on a device (like port goes down)
- Alarms manager detects this issue
- Alarms manager starts a script to fix it
For me the event is from outside (example port down on an arbitrary switch in XMC).
Best regards
Stephan
Regards
Stephan
14 REPLIES 14
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎07-19-2019 09:58 AM
Yes, the test works when I replace it with the IP of my switch. But not when I let it be executed by the Notification engine, it still says it has 0 devices to work with.
XMC version 8.2.6.5
XMC version 8.2.6.5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎07-19-2019 09:49 AM
Does it work if you replace emc_vars["switchIP"] with the IP of your switch? and let it be executed by Notification engine?
What XMC version are you using?
What XMC version are you using?
Regards
Zdeněk Pala
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎07-19-2019 09:39 AM
Thanks for your quick responses. This helps a lot.
There's still the issue that no compatible devices are found, even though we change the emc_cli ip address to switchIP.
If i run your script through XMC, I get the error: no viable alternative for "switchIP"
So I put in variable switchIP manually and referenced it to global variable switchIP. But now I get error: device not found and switchIP stays empty so this would indicate that there's nothing in global variable switchIP which I can confirm in the variable results window.
So why would this occur? Any alternatives?
Thanks in advance,
Lennert
There's still the issue that no compatible devices are found, even though we change the emc_cli ip address to switchIP.
If i run your script through XMC, I get the error: no viable alternative for "switchIP"
So I put in variable switchIP manually and referenced it to global variable switchIP. But now I get error: device not found and switchIP stays empty so this would indicate that there's nothing in global variable switchIP which I can confirm in the variable results window.
So why would this occur? Any alternatives?
Thanks in advance,
Lennert
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
‎07-19-2019 08:52 AM
I see now the issue... the device is not automatically populated from notification engine = it is function as designed = imagine you just want to do API call somewhere, you do not want to establish the session to the switch, may be you want establish the session to the engine...
What you can do = change the activity from CLI to Python.
here is python code example:
What you can do = change the activity from CLI to Python.
here is python code example:
code:
#############CLI - FUNCTION DEFINITIONS
def sendConfigCmds(cmds):
for cmd in cmds:
cli_results = emc_cli.send( cmd )
if cli_results.isSuccess() is False:
print 'CLI-ERROR: ' + cli_results.getError()
exit
cli_lines = cli_results.getOutput()
return cli_lines
#############Establish the session and send commands
emc_cli.setIpAddress(emc_vars["switchIP"])
varCMDS = []
varCMDS.append('config terminal')
varCMDS.append('hosname I-Was-Here')
varCli_result = sendConfigCmds(varCMDS)
emc_cli.close()
Regards
Zdeněk Pala
