Afreeman -
This may be a long post, but here goes. (By the by, if you've got a largish NCC that uses Remedy, be sure to warn them before you try this. It inserts a ticket whenever a node goes down, so be sure to modify the second block to only insert tickets for important nodes.)
Also, i realize that my script has my Remedy account and admin password right in the script, but since i'm the only person with access to my OpenView server, and one of two with access to the Remedy server, it's not a major concern of mine. You may want to modify it to read in a config doc.
First, get ARSPerl :
and install this on to your OpenView server. I've never gotten it working with OpenView's native Perl, so i install ActivePerl as well (v 5.6.x)
Next, copy these three DLL's from any Remedy directory onto the OpenView server (c:\winnt\system32 is good if you've got Windows)
arapi4x.dll
arrpc4x.dll
arutl4x.dll
Okay, in OpenView, go to Options > Event Configuration. Select 'OpenView' in the Enterprises. Select 'OV_Node_Down'. On the Action tab, write "perl $OV_BIN\\CreateTicket.pl $2", where $OV_BIN is the path to the OpenView binary folder (ie. x:\\openview\\bin)
Still with me?
Now the easy part. Copy this whole script, and save it as "CreateTicket.pl", and place it in the $OV_BIN folder. Accidentally unplug a server to see if it works. Check the log file ovactiond.log on the OpenView server. If all goes well, the last line should look something like :
Tue Jan 06 14:22:10 Command "d:\\perl\\bin\\perl.exe d:\openview\bin\CreateTicket.pl EBN702_Cat2924" returned standard output data:
Success :: NIAN00000004404
Write back with any questions, i'll definitely try to help you out. A real good place to check with questions is on that buffalo.edu web page. The school is absolutely aweful, but the web page is pretty helpful.
#############
###########################
# needs the following dll's to work : arapi4x.dll arrpc4x.dll arutl4x.dll
# where x is the version number (4.0 or 4.5)
# which can be found in the Remedy installation dir
###########################
use ARS; # use the Action Remedy System package
###########################
### Default Variables
###########################
# The values you're going to insert into the ticket.
# At the very least, you'll need the fields that are required to save the ticket set here.
$strLastName = "OpenView";
$strFirstName = "HP";
($strNode) = (shift);
$strDescription = "$strNode is down";
$strServerName ="(insert server name or ip)"; # server ip or name
$strUserName = "(insert remedy account with admin rights)"; # user account in Remedy
$strPassword = "(insert remedy account password)"; # user password
$strSchema = "TTS-Main"; # schema name.
###########################
##### DO WE CARE ABOUT THIS NODE?
###########################
if (($strNode !~ / (host name of node you care about) /i))
{
exit();
}
###########################
##### LOGON TO THE REMEDY SERVER
###########################
# ControlID is a "scalar control record", basically a pointer to a successful logon
$ctrControlID = ars_Login($strServerName, $strUserName, $strPassword)
|| die "can't logon to the server: $ars_errstr";
###########################
##### CREATE THE DATE (UNIQUE ID)
###########################
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
$year = ($year - 100) + 2000;
$mon = sprintf("%02d", $mon);
$mday = sprintf("%02d", $mday);
$min = sprintf("%02d", $min);
$sec = sprintf("%02d", $sec);
if ($hour > 12)
{
$hour = $hour-12;
$strUmm = "PM";
}
else
{
$strUmm= "AM";
}
$strUniqueID = "$mon/$mday/$year $hour:$min:$sec $strUmm";
###########################
##### CREATE THE TICKET
###########################
# These are different for every Remedy box.
# in the ticket database, look at the table titled "Field", and the column "FieldID" to see what these numbers should be
%hshValues = (
8=>$strDescription,
536870913=>$strLastName,
536870914=>$strFirstName,
536871004=>$strUniqueID
);
$intEntryID = ars_CreateEntry($ctrControlID, $strSchema, %hshValues) || die "Error on submission to ARS:\n$ars_errstr\n";
print "Success :: $intEntryID\n";
############################################################
################################# LOGOFF THE REMEDY SERVER #
############################################################
ars_Logoff($ctrControlID);
exit 0;