Re: Re: Working Version of Net_Monitor - Please Review :)

From: Date: Thu, 09 Dec 2004 20:51:09 +0000
Subject: Re: Re: Working Version of Net_Monitor - Please Review :)
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-34982@lists.php.net to get a copy of this message
Hi Bertrand, The message is what the Net_* package returns. The default is English for these packages. However, using the code/service combination I could easily see definining: $_language[fr][HTTP][404] = "La page que vous recherchez n'existe pas ou a été déplacée"; to support foreign languages. In your hypothetical situation, the team could receive any combinbation of message/service/code to help debug the problem. The most terse is probably "host: service: code". Having the code standard across all services (200 = OK, etc.) makes more sense than defining a unique numeric code for every type of service, since it becomes easier to see at-a-glance what is 200 (OK) and what is down (0). However, the actual messages returned by the various Net_* packages can be very useful in their own right, which is why they are included. Best, RP bertrand Gugger wrote:
Robert Peake wrote:
Interesting. The whole purpose of $result = $this->_result is actually *greater* readability
Then further reading the code I need to come back to it and get that this $result is a copy of $this->_result what means one more line to read or to remind. (the CPU eating is not of interest)
(except where it is necessary to not operate on the class array directly). The fact that you find a shorter, more mnemonic variable less readable is pretty amazing to me.
Yes, because I *need* to return to what was affected to this $mnemonic variable. It's no difference to read $this->_mnemonic or $mnemonic or getting more example from your code:
           $this->_results_diff = $this->stateDiff($this->_results,$last_state);
...               $primary_sub = $primary[$i];
...            $ps_code = $primary_sub['code'];
...                if ($ss_host == $ps_host && $ss_service == $ps_service) {
then I need to go back to understand it was:
               if ($ss_host == $this->_results[$i]['code'] && $ss_service == $ps_service) {
(It's just integrating your "mnemonic" $ps_host, 'primary' (current) state of host same should be done for 'secundary' (last state)) $ps_host here acts poorly as mnemonic. I really prefer $this->_results[$i]['code']
More amazing that you threaten to withhold a vote based on such a minor point of style, even though you are not a Pear developer.
(That was a joke)
You forget the message component in this proposed redesign.
What's the need to store it ? State code is enough. Could you imagine this message could be else as english/american (it's another point)
If the arrays were restructured as you propose, it would be significantly more difficult to sort the structure you are proposing based on anything but host (first) and service (second).
What's your checkAll() doing ?
For this reason and since this package is in the early stages of growth,
Yes just now you can do something
I think I will stick to the slightly more flat, slightly more readable,
It's serialized, no more flat, but you still can read it.
slightly more flexible,
What is it less flexible in what I said ?
and slightly less specialized array structure.
You are allready specialized Host(URL?)/service, what is natural.
As stated in the proposal, 200 is always OK. 0 is a general problem. -1 is undefined.
That is funny, Why not have each service defining its OK value, exactly as you have: var $_service = 'HTTP'; in redefining class class Net_Monitor_Service_HTTP, let's have a var $_serviceOK = 200;
Everything else is service-defined (e.g. 404 is "Page Not Found" for HTTP and HTTPS).
Even OK should be service-defined Do you imagine the alerts are to be handled by somebody ? We are a team watching our alerts. So when it's taken into account (not yet solved) by one of us then the alert state is to be freezed so the other keep quite. What's the best way to do that with your package ? Is your package realistic with a few machines and a few people there ? Do you allready endured a stuttering machine by alert system ? I was liking to help, get the monitoring in some real situation. à+


« previous php.pear.dev (#34982) next »