AnsweredAssumed Answered

Extract Thresholds of all Robots With LUA

Question asked by benwithem on Aug 27, 2010
Latest reply on Aug 28, 2010 by keith_k

I have been working on the following LUA script to extract threshold values from the CDM and print them to text file for using later. The goal is to extract thresholds from all robots, but running this script using a profile only returns the CDM thresholds from the hub with the nas probe. Does anyone have any suggestions on accomplishing this task? I am assuming what data is returned depends on how the script is ran.

 

I have also tried running this on an alarm trigger and tried to extract the hostname that way, but it still returns the hostname of the nas. I can however get the nimid of each individual alarm, but not the corresponding hostname.

 

--

-- Extract the CDM configuration file from the controller as a table and

-- access parts of the configuration, and print the contents sorted by section.

--

controller = nimbus.request("controller","get_info")

args = pds.create()

pds.putString (args,"name","cdm")

 

cfg,rc = nimbus.request ("controller","probe_config_get",args)

 

dir= "E://"

host = controller.robotname

ext= ".txt"

filename= dir..host..ext

io.output(filename)

 

io.write("Robot="",controller.robotname)

print("Robot=",controller.robotname)

 

   pagefile_error = cfg["/memory/alarm/pagefile error"]

if pagefile_error ~= nil then

   io.write("\nPagefile Error=",pagefile_error.threshold)

   print("Pagefile Error=",pagefile_error.threshold)

end

   pagefile_warning = cfg["/memory/alarm/pagefile warning"]

if pagefile_warning ~= nil then

   io.write("\nPagefile Warning=",pagefile_warning.threshold)

   print("Pagefile Warning=",pagefile_warning.threshold)

end

   physical_error = cfg["/memory/alarm/physical error"]

if physical_error ~= nil then

   io.write("\nPhysical Error=",physical_error.threshold)

   print("Physical Error=",physical_error.threshold)

end

   physical_warning = cfg["/memory/alarm/physical warning"]

if physical_warning ~= nil then

   io.write("\nPhysical Warning=",physical_warning.threshold)

   print("Physical Warning=",physical_warning.threshold)

end

   swap_error = cfg["/memory/alarm/swap error"]

if swap_error ~= nil then

   io.write("\nSwap Error=",swap_error.threshold)

   print("Swap Error=",swap_error.threshold)

end

   swap_warning = cfg["/memory/alarm/swap warning"]

if swap_warning ~= nil then

   io.write("Swap Warning=",swap_warning.threshold)

   print("Swap Warning=",swap_warning.threshold)

end

   paging_error = cfg["/memory/alarm/paging error"]

if paging_error ~= nil then

   io.write("\nPaging Error=",paging_error.threshold)

   print("Paging Error=",paging_error.threshold)

end

   paging_warning = cfg["/memory/alarm/paging warning"]

if paging_warning ~= nil then

   io.write("\nPaging Warning=",paging_warning.threshold)

   print("Paging Warning=",paging_warning.threshold)

end

Outcomes