Active IQ Unified Manager Discussions

Run Scripts from DFM Alarms

modugu
5,069 Views

Can someone confirm the correct syntax to use on windows

I was able to get this work on Linux

Feb 24 15:28:04 [DFMEvent:ERROR]: Failed to invoke script perl.exe C:\Documents and Settings\Administrator\Desktop\test\qtree_alert.pl: Could not invoke script: Error 2: The system cannot find the file specified.
Feb 24 16:13:04 [DFMEvent:ERROR]: Failed to invoke script perl.exe "C:\Documents and Settings\Administrator\Desktop\test\qtree_alert.pl" : Could not invoke script: Error 2: The system cannot find the file specified.
Feb 24 16:26:17 [DFMEvent:ERROR]: Failed to invoke script c:\stawberry\perl\bin\perl.exe "C:\Documents and Settings\Administrator\Desktop\test\qtree_alert.pl" : Could not invoke script: Error 3: The system cannot find the path specified.
Feb 24 16:31:04 [DFMEvent:ERROR]: Failed to invoke script c:\stawberry\perl\bin\perl.exe "C:\Documents and Settings\Administrator\Desktop\test\qtree_alert.pl" : Could not invoke script: Error 3: The system cannot find the path specified


C:\> dfm alarm modify  -s "c:\stawberry\perl\bin\perl.exe \"C:\Documents and Set
tings\Administrator\Desktop\test\qtree_alert.pl\" "  8
Changed script name for alarm 8 to c:\stawberry\perl\bin\perl.exe "C:\Documents
and Settings\Administrator\Desktop\test\qtree_alert.pl" .

C:\>dfm alarm list
Alarm                8
Group                qtree_alerts_users
Event Severity       All
Event Name           qtree-full
Time From            00:00
Time To              23:59
Script Name          c:\stawberry\perl\bin\perl.exe "C:\Documents and Settings\A
dministrator\Desktop\test\qtree_alert.pl"


C:\>dir "C:\Documents and Settings\Administrator\Desktop\test\qtree_alert.pl"
Volume in drive C is System
Volume Serial Number is 445F-488E

Directory of C:\Documents and Settings\Administrator\Desktop\test

02/24/2010  03:06 PM             1,761 qtree_alert.pl
               1 File(s)          1,761 bytes
               0 Dir(s)   9,221,627,904 bytes free

1 ACCEPTED SOLUTION

smoot
5,069 Views

Sounds like windows doesn't know to execute .pl files with "perl script.pl".

I can't remember if you solve this by making your script line be "perl myscript.pl" or write a wrapper .bat file with that one command line.  Or whether you can tell Windows that .pl files should be executed by perl.exe.

View solution in original post

6 REPLIES 6

smoot
5,070 Views

Sounds like windows doesn't know to execute .pl files with "perl script.pl".

I can't remember if you solve this by making your script line be "perl myscript.pl" or write a wrapper .bat file with that one command line.  Or whether you can tell Windows that .pl files should be executed by perl.exe.

marlon
5,069 Views

Not sure if this will work for alarm scripts, but it works for executing backup scripts...

Create a Windows .bat file that invokes the Perl script.

Example:

========  <example-bat-file>  ====================
" <path-to-DFM-install-
dir>\Per\bin\perl.exe" " <path-to-perl-script> " >>  <path-to-output-file>
=========================================

The script consists of one line. The line gives the full path to the Perl that is installed with DFM. It gives the full path the the Perl script that will be invoked. And it gives the full path to where the output of the from the Perl script is to be written.

Example script:

==========  <example-perl-script> ======================
for (%
ENV) {
printf ("%d) %s\n", $i++, $_); # print out the environment variables
}
===========================================

modugu
5,069 Views

Thanks for the bat file usage ,completly forgot about that part (windows vs linux)

I updated the alarm with a bat file ,I am still not able to get this working ,

Do scripts need a user to be defined always ,

what user will the script be invoked if no user is defined ?

The alarms are working from DFM but dont see the bat file being run

The bat file works when run manually

C:\>dfm alarm modify -u fistlast 8
Error: -u alarmScriptRunAs: fistlast is not available on windows.

Use "dfm help" for usage information.

C:\>dfm alarm modify -u root 8
Error: -u alarmScriptRunAs: root is not available on windows.

Use "dfm help" for usage information.

C:\>dfm alarm modify -u "OPSMGR02\Administrator" 8
Error: -u alarmScriptRunAs: OPSMGR02\Administrator is not available on windows.

Use "dfm help" for usage information.

C:\>dfm alarm list
Alarm                8
Group                qtree_alerts_users
Event Severity       All
Event Name           qtree-full
Time From            00:00
Time To              23:59
Script Name          "c:\qtree_alert.bat"


C:\>

C:\>dfm user list
Id    Administrator          Email                    Pager
----- ---------------------- ------------------------ ------------------------
29    Everyone
2565  NYPSLAB\opsmgrbackup
3052  OPSMGR02\Administrator
3486  root

User Root is dfm user ,with no windows login account.

modugu
5,069 Views

I tried both below ways for the script name/path to be triggered based on qtree-full event ,

I am unable  to get script trigger based on the event,

Can someone confirm the correct script path /name to use for OM on Windows Server

C:\>c:qtree_alert.bat

C:\>perl.exe "C:\Documents and Settings\Administrator\Desktop\test\qtree_alert.pl"

C:\>c:\qtree_alert.bat

C:\>perl.exe "C:\Documents and Settings\Administrator\Desktop\test\qtree_alert.pl"


C:\>dfm alarm list
Alarm                8
Group                qtree_alerts_users
Event Severity       All
Event Name           qtree-full
Time From            00:00
Time To              23:59
Script Name          c:qtree_alert.bat

modugu
5,069 Views

Just to add for reference

"Script Name          c:\qtree_alert.bat" worked

"Script Name          c:qtree_alert.bat" fails

kirk_brady
5,069 Views

i dont see how c:qtree_alert.bat would ever work because it is not a valid path?

can you add a >> output.log to your command and see if it is even running at all?

if the script is not found, i would simplify thing by changing the paths to one that has no spaces - eg perl and script both in c:\perl\script.pl and see if that works

Public