I have a question about what a good design would be for a particular program would be. This program checks a file that holds these contents, just more of them:
107: kmemsize 2194616 3019086 15216913 16738604 0 lockedpages 0 0 743 743 0 privvmpages 13061 22723 207792 228571 0 shmpages 39 695 20779 20779 0 dummy 0 0 0 0 0 numproc 25 37 666 666 0 physpages 4097 7011 0 2147483647 0 108: kmemsize 2194616 3019086 15216913 16738604 0 lockedpages 0 0 743 743 0 privvmpages 13061 22723 207792 228571 0 shmpages 39 695 20779 20779 0 dummy 0 0 0 0 0 numproc 25 37 666 666 0 physpages 4097 7011 0 2147483647 0 etc... The last column of this file is a "failcount" column. Every time there is an error in a particular Virtual Private Server for the particular resource 1 is added to the fail count column. This is fine, so I wrote a simple perl script that will periodically check the file for any non-zero values in the failcount column and send me an email letting me know. This worked fine until I realized some of the resources will get errors and this is fine. You also can't reset the the failcount to zero until the host OS is reboot, so I'm know getting an email everytime the program runs even though I am aware of the errors that are in it and they are fine. So my question is, What would be a good design to create a program that would ignore certain resources of certain VPS's. The VPS's are the 107, 108 #'s of the example text above. Ideally I would like to have two files, one an exclude file and another a barrier file. In the exclude file I would have the VPS #'s and resources to ignore, exp: 107:physpages,numproc 108:shmpages and another file that I would put the acceptable failcount for a particular VPS before I receive an email, exp: 108:physpages-28 But I'm not sure of a good way to handle this. Should I read the contents of these files and load each line into it's own array? I was thinking of a hash but each VPS {key} may have more than one value. Can I dynamically create array's depending on how may lines I have in the exclude.txt file? I'm not sure what kind of memory structure to use for this? multi-dimensional array? hash? How would some of you handle such a problem? Thank you for any advice. Romeo