First off: i apologise for dragging this out a bit. Once you are experienced you could probably do all the reasoning we are going through here in a few seconds of thought. But since you lack this experience and i want to show you how you tackle this sort of problems i show you and discuss every point applicable to any monitoring script. Some of what i will tell you will not be applicable to NTP because it is a very simply service. Others are more complicated and you will need this kind of reasoning, though.
So, bear with me - you might have come asking for a meal, i show you how to cook yourself.
Quote:
Originally Posted by
xiaogeji
the following is my plan and let me know if anything doesnt make sense
All makes sense to me, save for one point:
Quote:
Originally Posted by
xiaogeji
But if I am really stuck,as long as the "$(success status),$(service name),$(activity)" are in the output then it will still be fine
Quote:
Originally Posted by
xiaogeji
I shouldve clarified earlier that the only service I need to work on is ntpd.
Compare these two quotes. If there is only one service you want to monitor then why repeat the name of that service in every line? Do you really need that? Because the file will already be named "ntpd.log" or something such, so one would know that the messsages in there are about NTP or
ntpd respectively, no?
Now, having identified the fields (that is: the type of information you want to log) you need to identify how this information will be comprised in detail. What do i mean by that?
Well, take "success status", for instance: Th simplest model would be to have to possible values: "success" or "failure" (or "error" or whatever you want to name it). You could also have three possible outcomes, "success", "warning" and "failure". You could even have more. Have a look at the documentation of
syslog to get ideas. Basically syslog has "severity levels" which map to what i called "success status" here, seven of them. You specify a "threshhold severity" and everything "above" that severity will be logged, everything else will not.
Quote:
Originally Posted by
xiaogeji
the date is optional depending on the complexity:
Really? If you leave out the time stamp you have a message and don't know when that was. It is easy to do that but i wonder if it makes sense to do it this way.
OK, go over your list a seond time, plan on how many success status you want to have (and how they are called) and how you want to define them: What constitutes "success", what constitutes a "failure"? And how much has to go "quite not right" when you label the outcome a "warning". Once you do this we finally get around to writing the script.
I hope this helps.
bakunin