Guys,
I did it! Thank you for the help. A coworker helped me polish it a bit, but I got it running. Here is the breakdown and script.
1. Powershell runs the script to identify the newest file and send in an alarm.
2. AO profile runs script on arrival. Script grabs file name from the alarm, then retrieves current file name from logmon profile. Compares the two, if they match, the alarm is cleared. If they do not match, the filename from the alarm is formatted with the proper directory, uploaded to the probe config, probe is restarted and the alarm is cleared.
-- Get message from the alarm and set as variable alarm1
alarm1 = alarm.get()
alarmMessage = alarm1.message
-- printf(alarm1.message)
-- Set probe to logmon
args = pds.create()
pds.putString(args,"name","logmon")
-- Get the contents of /profiles/AMCC Cloud/scanfile
cfg,rc = nimbus.request ("domain/hub/robot/controller","probe_config_get",args)
if rc == 0 then
log = cfg["/profiles/AMCC Cloud"]
if log ~= nilthen
logfile1 = printf(right (log.scanfile, 35))
end
end
-- trims directory from file name
logfile1 = (right (log.scanfile, 35))
-- Adds directory to file name from alarm message.
logfile2 = "X:\\directory\\"..alarm1.message
-- Compares files from alarm message and current probe config for differences and closes alarm if none
-- print(alarm1.message.." " ..logfile1)
if alarm1.message == logfile1 then
printf("File "..alarm1.message.." matches "..logfile1)
action.close (nimid)
else
printf("File "..alarm1.message.." does not match "..logfile1)
-- preparing new file name for upload
profile = "PROFILE NAME"
options = pds.create()
pds.putString (options,"/profiles/"..profile.."/scanfile",logfile2)
-- Uplodaing new config to probe
args = pds.create()
pds.putString (args, "name", "logmon")
pds.putPDS (args, "as_pds",options)
resp,rc = nimbus.request ("domain/hub/robot/controller","probe_config_set",args)
-- restarting probe
mypds = pds.create ()
output,return_status = nimbus.request ("domain/hub/robot/logmon", "_restart" )
if
return_status == NIME_OKthen
printf ("Restart successful")
else
printf ("Restart failed")
end
-- Closing the alarm
action.close (nimid)
end