cancel
Showing results for 
Search instead for 
Did you mean: 

Start XMC scripts or workflows via NAC Notifications" or NetSight "Alarms Manager"

Start XMC scripts or workflows via NAC Notifications" or NetSight "Alarms Manager"

StephanH
Valued Contributor III
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:

  • Something happens on a device (like port goes down)
  • Alarms manager detects this issue
  • Alarms manager starts a script to fix it
In Workflows there is a "Signal" element in the Events category. But It's not clear for me whether the signal is something from outside or a event within the workflow.
For me the event is from outside (example port down on an arbitrary switch in XMC).

Best regards
Stephan

Regards Stephan
14 REPLIES 14

Lennert_VL
New Contributor
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

Zdeněk_Pala
Extreme Employee
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?
Regards Zdeněk Pala

Lennert_VL
New Contributor
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.

e3b92b1cd4d64ca8bd3e33ff8a21d502_7b93575f-388b-497e-9493-653437a82392.png


e3b92b1cd4d64ca8bd3e33ff8a21d502_226e661d-5d01-4d47-a19c-4921e098012e.png



So why would this occur? Any alternatives?

Thanks in advance,

Lennert

Zdeněk_Pala
Extreme Employee
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:

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
GTM-P2G8KFN