Subscribe

OnCommand Unified Manager alert/script integration?

Has anyone tried script integration with OCUM 7.1? I cannot seem to get it to work, or perhaps I have misunderstood something ...

 

I have uploaded a test script in Perl to the OCUM server and associated it with an alert.

 

I can then test this alert (click on test in the Web UI) and I receive an Alert email message from OCUM, however I don't see the output of my script anywhere. If I have understood correctly, it should be added to the body of the email message. Is that correct?

 

On the OCUM server system itself I can see that my script has apparently been successfully run i.e. in the file "/var/log/ocum/ocum-script.log" I see:

...

2017-03-07 20:42:13 [DEBUG] [ScriptExecutor-8] [AuthenticationUtils:73] - Successfully logged in for script execution.
2017-03-07 20:42:13 [INFO ] [ScriptExecutor-8] [AlertScriptService:104] - Script execution of file : all_args.pl for EventID : 282400 in progress..
$VAR1 = [
          '-eventID',
          '282400',
          '-eventName',
          'LIF Status Down',
          '-eventSeverity',
          'error',
          '-eventSourceID',
          '10056564',
          '-eventSourceName',
          'clusternodename-ic2',
          '-eventSourceType',
          'NETWORK_LIF',
          '-eventState',
          'NEW',
...

2017-03-07 20:42:53 [INFO ] [ScriptExecutor-8] [AlertScriptService:90] - Execution of script file : all_args.pl for EventID : 282400 completed successfully with exitcode : 0
2017-03-07 20:42:53 [DEBUG] [ScriptExecutor-8] [AuthenticationUtils:115] - Successfully logged out.

 

The "$VAR1 = ..." text is the output of the script, all this script does is to print out its arguments and environment.

 

The OCUM server is the VMware appliance platform, it was recently upgraded from version 6.2 to 7.1. Other than this issue it seems to be functioning normally.

 

Thanks in advance for any advice!

 

Cheers,

Robb.

 

Re: OnCommand Unified Manager alert/script integration?

[ Edited ]

Hi Robb,

 

Here is very simple example of attaching a script to an alarm for the OCUM vApp in perl. There is additional information available here:

 

http://www.netapp.com/us/media/tr-4585.pdf

 

If for examples sake you just wanted to test that you can attach a script to an alarm and that the script is executed successfully to verify the application is functioning as expected then...

 

  • Create a perl script which creates a file in the scriptPlugin directory by eventID number. EG (in my case i saved the file as 'ocumalarm.pl')

 

 

#!/usr/bin/perl
my $file="/opt/netapp/ocum/scriptPlugin/$ARGV[1]";
open (MYFILE, ">>", $file);
print MYFILE "$ARGV[0] $ARGV[1]\n";
close (MYFILE);
  • Upload the script to OCUM ("Administration \ Manage Scripts \ Add").
  • Create your OCUM alarm and configure it to attach the uploaded script. EG

ocum_alarm.png

 

  • Invoke the process which triggers the alarms, creates an event and runs the script. (In my case i admin failed a disk to trigger the alarm and create the event)

ocum_event.png

 

  • Check the script logs to view the event arguments and script exit code.

You can view the instructions on how to login to the OCUM vApp applianance here:

https://kb.netapp.com/support/s/article/ka31A00000012qfQAA/How-to-access-the-OnCommand-Virtual-Machine-DIAG-shell


Also i've written some instuctions on how to troubleshoot it here:

https://community.netapp.com/t5/OnCommand-Storage-Management-Software-Discussions/customizing-mails-from-ocum-7-1/m-p/131149#M23751

Using the above example when i trigger the alarm (in my case by admin failing a disk on a simulator) the script is successfully invoked and executed creating the file by eventID number.

 

 

diag@TESTOC71P1:~$ sudo -i
root@TESTOC71P1:~# cd /var/log/ocum
root@TESTOC71P1:/var/log/ocum# cat ocum-script.log 2017-05-23 12:48:57 [DEBUG] [default task-64] [ScriptPlugin:30] - Processing the rest request for script plugin. Event ID : 10 2017-05-23 12:48:57 [INFO ] [ScriptExecutor-1] [AlertScriptService:216] - Detecting command for file : ocumalarm.pl 2017-05-23 12:48:57 [DEBUG] [ScriptExecutor-1] [AlertScriptService:169] - ------ Script Arguments BEGIN------ 2017-05-23 12:48:57 [DEBUG] [ScriptExecutor-1] [AlertScriptService:175] - -eventID : 10 -eventName : Some Failed Disks -eventSeverity : critical -eventSourceID : 1 -eventSourceName : cluster1 -eventSourceType : CLUSTER -eventState : NEW -eventArgs : count=1,diskMessage=NET-1.1 (admin failed),disksList=NET-1.1 2017-05-23 12:48:57 [DEBUG] [ScriptExecutor-1] [AuthenticationUtils:73] - Successfully logged in for script execution. 2017-05-23 12:48:57 [INFO ] [ScriptExecutor-1] [AlertScriptService:104] - Script execution of file : ocumalarm.pl for EventID : 10 in progress.. -eventID 2017-05-23 12:49:37 [INFO ] [ScriptExecutor-1] [AlertScriptService:90] - Execution of script file : ocumalarm.pl for EventID : 10 completed successfully with exitcode : 0 2017-05-23 12:49:38 [DEBUG] [ScriptExecutor-1] [AuthenticationUtils:115] - Successfully logged out.

The file is sucessfully created in the script plugin directory:

 

root@TESTOC71P1:/opt/netapp/ocum/scriptPlugin# ls -1
10
ocumalarm.pl
root@TESTOC71P1://opt/netapp/ocum/scriptPlugin# cat 10
-eventID 10

 

Obviously the script isn't doing much other than logging the event arguements but hopfully it's a useful example for you to get started.

 

/Matt

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.