I am trying to pull thresholds from the processes probe with LUA and I have a small question. I can account for all proccess names while iterating through the log file but how would I account for any possible parameter? Considering the following code snippet from the proceess probe log how would I put the paramater/value data for vxpd.exe into an array? Not sure if this is possible...
<watchers> <vpxd.exe> active = yes description = Monitoring vpxd.exe action = none command = "C:\Program Files\VMware\Infrastructure\VirtualCenter Server\vpxd.exe" arguments = process = vpxd.exe process_count_type = process_count = report = down execute = cpu_num_check = cpu_usage_max = cpu_usage_min = user = password = max_size = min_size = thread_count_limit = thread_count_type = thread_count_min = thread_count_max = track_by_pid = no process_restart = no invert_owner = no proc_cmd_line = "C:\Program Files\VMware\Infrastructure\VirtualCenter Server\vpxd.exe" scan_proc_cmd_line = no scan_proc_owner = no max_restarts = scan_cpu_usage = no scan_size = no scan_threads = no scan_proc_parent = False scan_proc_parent_name = group = resource_execute = no resource_command = resource_arguments = alarm_schedule = qos_schedule = qos_process_state = no qos_process_cpu = no qos_process_memory = no qos_process_count = no qos_process_threads = no subsystem = <window> active = no name = class = expect = existent on_error = ignore </window> </vpxd.exe> <watchers>
I assume that when you list out the thresholds, you want to provide some sort of description for each rather than using the option name from the config file. In that case, I think you would have to code the script to look for each individually. However, rather than write a lot of if statements, you could use all of the options you wish to display as keys for a table, with the values being the descriptions, then you can just loop through the table and look for each option.
Rather than worrying about all options in the config, you should be able to keep the list more limited. Many of the options below are not related to thresholds, so you can probably ignore them. That should cut down the list quite a bit. Then you could also choose to ignore any options that you never use in your configs. The drawback is that then you have to remember to update the script if you ever use those options in the future.