AnsweredAssumed Answered

Performing auto-operator action based on robot operating system type

Question asked by carstein.seeberg on Jan 15, 2009
Latest reply on Feb 12, 2009 by keith_k
Hi,

Enclosing a little snippet that will help the auto-operator to perform an action based on the operating system of the sending robot.  Note that you should add probe information (like cdm, ntservices, etc) to the profile filters to only act on alarms that come from the robot.  This is needed to avoid generating alarms for remote systems (like from net_connect, etc.).

Enjoy,
Carstein


--
-- Mapping alarms to the operating system type of a robot.
--
a = alarm.get ()
s = file.stat ("robotcache.db")
osname=""

database.open("robotcache.db")
if s == nil then
   database.query("CREATE TABLE ROBOT_OSTYPE (name text, hub text, os_minor text, os_major text)")
end

rs = database.query("SELECT os_major FROM ROBOT_OSTYPE WHERE name='"..a.robot.."' and hub='"..a.hub.."'")
if #rs == 0 then
   addr = "/"..a.domain.."/"..a.hub.."/"..a.robot.."/controller"
   info = nimbus.request(addr,"get_info")
   if info ~= nil then
      database.query("INSERT INTO ROBOT_OSTYPE VALUES ('"..a.robot.."','"..a.hub.."','"..info.os_minor.."','"..info.os_major.."')");
      osname = info.os_major
   else
      printf("error, no info from controller at: %s",addr)
   end
else
   osname = rs.os_major
end

database.close()

if osname == "Windows" then
   printf("Sending mail to Windooze groupies...")
elseif osname == "Linux" then
   printf("Sending mail to UNIX groupies...")
else
   printf("Unable to resolve osname for robot '%s', osname:%s",a.robot,osname)
end



Outcomes