Ok, so I've been around the forum for a bit piecing together a LUA scrpt to parse CDM thresholds from every box we monitor. After gaining insights and code snippets from several of you I have made good progress but still have a ways to go. Before I get too far into this let me tell you my end goal. So, my goal is to have a custom PHP webpage for system administrators to go to and get all the information about their box and how we are monitoring it, what blackouts they have, their thresholds etc... I have many pieces complete and the page is up and running with basic configuration info as well as blackouts. I get most of this information by parsing the main nas.cfg with shell and plopping the data in MYSQL. So far it's really easy to get the data I want from one simple flat config file.
Now on to thresholds:
Problem 1) (not a problem annymore) Each box has their own cdm.cfg that can only be accessed with the logmon probe and with LUA, so I chose to use LUA to pull the thresholds, problem solved.
Problem 2) Various operating systems have different configurations that make the LUA script a bit difficult. For instance a minor issue was that I could not forsee what drive letters would be used for all of the windows boxes. This fix was easy and required an array with all the letters. But with NIX boxes, how in the world could I use LUA to parse the mount points, they could be anything! To say the least, this has driven me crazy and I am not sure what options I have. I am not a programmer by trade but I can get my way around a bit. Below you will find my code that works great for windows boxes and is set to only run on windows boxes.
Problem 3) How in the world should I run this script? My plan is to run it based on an alarm. So I will script an alarm to be sent out to all boxes with a message that will trigger my script to run. The script saves the info to disk to be used later to generate MYSQL. Is this really a good way to run this script?
I do apologize that my thoughts are quite scattered and I'm sure you can tell that I have been working on this for WAY to long. I'm just asking for some direction, and I am neck deep in this and I want to make sure I'm going the right way.
Without further ado.... Here's my script: