Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HP OPENVIEW NNM

Status
Not open for further replies.
Apr 26, 2000
12
US
I wrote a small vbscript to handle notifications from HP OpenView NNM. I am running on NNM B.06.10 on NT 4.0. If I run the script from the command line, either with or without arguments, it runs fine. When executed by NNM, it fails with an exit value 1. I have a case open with HP, but so far they are stumped. Does anyone have any idea what could be wrong? My guess is the script, because I am not too well versed in vbscript. Here is the script:

' VBSCRIPT TO SEND MAIL FROM HP OPENVIEW
'
' SET DEFAULTS AND OTHER VARIABLES
exec="D:\OpenView\contrib\custom_utils\mailto\mailto.exe"
from=" -U OpenView"
host=" -H xxxxxx.minolta.com"
who=" -D jpapa@minolta.com"
'
' GET COMMAND LINE ARGUMENTS
Set objArgs = Wscript.Arguments
'
' Build message
if WScript.Arguments.Count = 0 then
msg=" -M UNKNOWN_ERROR"
end if
if WScript.Arguments.Count = 1 then
arg1=objArgs.Item(0)
msg=" -M " & arg1
end if
if WScript.Arguments.Count > 1 then
arg2=objArgs.Item(1)
msg=msg & "..." & arg2
end if
'
' Build default subject line
subj=" -S HP_OpenView_Alert..." & arg1
'
'
Dim MyObj
Set MyObj=CreateObject("WScript.Shell")
'
' SET UP MAILING ADDRESSES
Call SendIt
'
if arg1 = "ecomapp1s" _
or arg1 = "ecomweb2p" _
or arg1 = "ecomsqlp" then
subj=subj & "..." & arg2
who=" -D joeblow@minolta.com"
Call SendIt
who=" -D jamesbond@minolta.com"
Call SendIt
end if
'
if arg1 = "hp01" then
who=" -D ajackson@minolta.com"
Call SendIt
end if
'
'
Sub SendIt'
' TEST IF "MAILTO" PROGRAM EXISTS
' if it does not, just echo parameters
'
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(exec)) Then
StrMailProg=exec & from & who & host & subj & msg
MyObj.Run(StrMailProg)
Else
Wscript.Echo subj & msg
Wscript.Echo who
End If
End Sub
[sig][/sig]
 
Got the answer, meant to post it a couple of days ago.

To run vbscript under HP OpenView Network Node Manager, you must include "wscript.exe" on the command line, preceding the script you want to execute. [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top