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.
we have installed OCUM on a windows server..
Can you advice if thee script will also work on Windows:
open (MYFILE, ">>", $file);
print MYFILE "$ARGV $ARGV\n";
I think wirth path spelling it needs to be modified, can you help on this?
As you are running OCUM on Windows it would be more appropriate to run a powershell script than a PERL script. I don't believe the PERL binaries are included with the OCUM installer on windows. The OCUM vApp does have a version of PERL. If you want to do the same thing in powershell, first check\set your execution policy:
PS C:\> Get-ExecutionPolicy PS C:\> Set-ExecutionPolicy Unrestricted
Note: on a default windows installation the powershell execution policy is set to restricted. This will prevent OCUM from running the script. The solution is to open an elevated powershell prompt running as admin and set your execution policy.
Then save the following as .ps1 file and upload it into the script plugin directory via GUI. Click on "manage scripts". The default location is "C:\Program Files\NetApp\ocum\scriptPlugin"
$Args | Out-File -FilePath $($(Split-Path($MyInvocation.MyCommand.Path)) + "\" + $((Get-Date).ToString("yyyy_MM_dd_HH_mm_ss_fff")) + "_event_id_" + $Args + ".log")
If you attach this to an alarm and trigger it all it will do is log the event ID by date and time to a file in the script plugin directory. EG
C:\Program Files\NetApp\ocum\scriptPlugin>dir /b 2017_07_20_22_32_02_056_event_id_13.log ocum_event.ps1
It's just an example to test the functionality and ensure your script is being invoked when the alarm is triggered and an event is generated.
You can search "ocum-script.log" file for details. The default log file location on Windows is:
Search the for the OCUM event ID number. Is there something in particular you are attempting to achieve with a script for your OCUM alarm?
Hope this helps