2017-03-08 01:49 AM
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 = [
'LIF Status Down',
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!
2017-05-22 09:22 PM - edited 2017-05-22 10:30 PM
Here is very simple example of attaching a script to an alarm for the OCUM vApp in perl. There is additional information available here:
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...
#!/usr/bin/perl my $file="/opt/netapp/ocum/scriptPlugin/$ARGV"; open (MYFILE, ">>", $file); print MYFILE "$ARGV $ARGV\n"; close (MYFILE);
You can view the instructions on how to login to the OCUM vApp applianance here:
Also i've written some instuctions on how to troubleshoot it here:
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.