[FX.php List] "No Action Taken" on query

Tim 'Webko' Booth tim.webko at gmail.com
Tue Jan 12 15:56:28 MST 2016


Any monitoring of a web server (of any sort) has to occur on a different
machine though, surely? If the web server has fallen over, then it can't
check itself...

At a previous job, we had an external web server that ran all of this for
all of the servers (we had about 10 active machines).

On 13 January 2016 at 09:53, Bob Patin <bob at patin.com> wrote:

> That’s close to what I’m doing now; I poll the server, and if it doesn’t
> respond in a few seconds, I poll it a 2nd time. My hope was that, if the
> 2nd one failed, I could then do some things to alert me (SMS, email,
> on-screen, all of which it already does).
>
> The only problem is that if WPE fails, it hangs up the code and it doesn’t
> proceed any farther. What I’d love is some sort of mechanism that catches
> this in some sort of IF statement and then lets me do the alerts.
>
> But your idea may work; I could perhaps do a query in a loop for x times;
> if it fails all 5 times (or whatever) I could then simply exit and display
> the alert. I don’t think I’d need a 2nd machine though…
>
> B
>
>
> On Jan 12, 2016, at 4:22 PM, Jonathan Schwartz <jonathan at exit445.com>
> wrote:
>
> Bob,
>
> Repeating my suggestion from yesterday…a sick WPE can’t tell you it’s
> sick.  It just doesn’t respond.  So rather than trying to make that work,
> consider the approach I suggested:
> 1) Poll the machines at some regular interval, looking for a known WPE
> result.  Record the timestamp in a separate server.
> 2) In a separate script, examine the length of time elapsed since the most
> recent polling timestamp.  If it exceeds the interval, you can conclude
> that WPE has not responded on the target server.  So, lack of a timely
> response is your foolproof detection mechanism.
>
> I had this running on a 10 minute interval on a very busy e-commerce
> website.  Worked like a charm.
>
> Hope that helps.
>
> Jonathan
>
> Jonathan Schwartz
> jonathan at exit445.com
>
>
>
> On Jan 12, 2016, at 2:01 PM, Bob Patin <bob at patin.com> wrote:
>
> But do you get anything back if WPE is off? THat’s where I can’t seem to
> find a workable solution; it polls the machines just fine, but if the WPE
> is off, nothing gets returned and my script stalls out on the errant
> machine…
>
> Bob Patin
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> FileMaker 9, 10, 11, 12 & 13 Certified Developer
> http://www.longtermsolutions.com
> -
> iChat: bobpatin at me.com
> Twitter: bobpatin
>> FileMaker Consulting
> FileMaker Hosting for all versions of FileMaker
> PHP • Full email services • Free DNS hosting • Colocation • Consulting
>
> On Jan 12, 2016, at 3:53 PM, Tim 'Webko' Booth <tim.webko at gmail.com>
> wrote:
>
> That simply checks if there is any response on Port 80 - and I nicked that
> from somewhere else a long time ago...
>
> As the WPE machines in my setups are the ones using Port 80, it seems
> fairly reliable to me.
>
> Cheers
>
> Webko
>
> On 13 January 2016 at 08:19, Bob Patin <bob at patin.com> wrote:
> That first bit looks like what I have, so you must have been the kind
> donor… :)
>
> Question about your script: if the WPE is totally down, do you get
> anything back? Using this line
>
> if( !fsockopen ($dbHost, 80, $errno, $errstr, 2) )
>
>
> I get an error message sometimes, but more often than not I get nothing
> back at all.
>
> B
>
> Bob Patin
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> FileMaker 9, 10, 11, 12 & 13 Certified Developer
> http://www.longtermsolutions.com
> -
> iChat: bobpatin at me.com
> Twitter: bobpatin
>> FileMaker Consulting
> FileMaker Hosting for all versions of FileMaker
> PHP • Full email services • Free DNS hosting • Colocation • Consulting
>
>
>
> On Jan 12, 2016, at 3:15 PM, Tim 'Webko' Booth <tim.webko at gmail.com>
> wrote:
>
> The one I generally use just for testing the first place (so could be
> adapted to do other things if used on a cronjob or similar):
>
> <?php
>
> include_once('include/db_config.php'); // DataBase Configuration File.
> include_once('include/FX/FX.php'); // FX.php file
>
>
> //Simple server tests
> $_SESSION['serverError'] = ""; // reset server error
> //Check if Port 80 works at all
> if( !fsockopen ($dbHost, 80, $errno, $errstr, 2) ) {
> $_SESSION['serverError'] = "Server not up";
> } else {
> //Check -dbnames
> /* $pageObj = new FX($dbHost,$port,$dbType,$conType);
> $pageData = $pageObj->DoFXAction('view_database_names');*/
> //Check if a findany to an available table works
> $pageObj=new FX($dbHost,$port,$dbType,$conType);
> $pageObj -> setDBPassword($dbPass,$dbUser);
> $pageObj -> setDBData($dbName,'LAYOUT', 'all');
> $pageData = $pageObj -> FMFindAny();
> if (FX::isError($pageData)) {
> echo $pageData->getMessage();
> echo "<br />";
> var_dump($pageData);
> }
> elseif ($pageData[‘errorCode’] != 0) {
> $_SESSION['serverError'] = $pageData['errorCode'];
> echo "A FileMaker error occurred ({$pageData[‘errorCode’]})";
> }
> else {
>    var_dump($pageData);
> echo "All is well";
> }
>
> }
> if ($_SESSION['serverError'] != "0") {
> echo "Error: ".$_SESSION['serverError'];
> }
> ?>
>
> On 13 January 2016 at 06:17, Bob Patin <bob at patin.com> wrote:
> Well… here’s what I’m doing—maybe you can tell me where my error is.
>
> I have a page that checks all of my FM Servers to see that the WPE is up;
> it reloads the page every 4 minutes:
>
> After my query I’m running this (I forget who gave this to me):
>
> // is server up?
> if( !fsockopen ($server, 80, $errno, $errstr, 2) ){
> // does a bunch of page formatting here for the display
> }
>
> I’ll try swapping that out for
>
> if (FX::isError($qResult)){
> // do stuff
> }
>
> So my question is this: if the WPE is down, FX isn’t going to return
> anything, is it? SO, assuming I just did a query, returning the results to
> $qResult, what do I look for to be returned when the WPE doesn’t respond? I
> always thought that, if WPE is down, nothing gets returned at all…
>
> Last question: is there an advantage to using FX::isError() to something
> like this:
>
> if ($qResult[‘errorCode'] != 0
>
> ? I think you told me once that FX::isError waits for the query to finish
> before it is invoked; wouldn’t that be the same thing with my little IF
> statement above? Is the first method better, or just simpler?
>
> Thanks,
>
> Bob
>
> Bob Patin
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> FileMaker 9, 10, 11, 12 & 13 Certified Developer
> http://www.longtermsolutions.com
> -
> iChat: bobpatin at me.com
> Twitter: bobpatin
>> FileMaker Consulting
> FileMaker Hosting for all versions of FileMaker
> PHP • Full email services • Free DNS hosting • Colocation • Consulting
>
>
>
> On Jan 12, 2016, at 11:10 AM, Chris Hansen <chris at iViking.org> wrote:
>
> Hey Bob,
>
> Glad to hear you got that figured out.
>
> As for knowing when the WPE is down, if you're checking FX::isError() --
> and if you're using FX you should be -- that should give you some
> indication, since there should be an error from attempting to connect to
> the server.  Additionally, I seem to recall that others on the list have
> posted methods that they use to check server health; could some of them
> chime in here?
>
> Best,
>
> --Chris
>
> On Jan 12, 2016, at 7:30 AM, Bob Patin <bob at patin.com> wrote:
>
> Chris,
>
> I finally found the issue; the client had provided an incorrect server
> address.
>
> So, and I think I’ve asked this before, do you have a way that, if an FX
> query fails because the WPE is down, that it’ll return an error?
>
> Thanks,
>
> Bob Patin
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> FileMaker 9, 10, 11, 12 & 13 Certified Developer
> http://www.longtermsolutions.com
> -
> iChat: bobpatin at me.com
> Twitter: bobpatin
>> FileMaker Consulting
> FileMaker Hosting for all versions of FileMaker
> PHP • Full email services • Free DNS hosting • Colocation • Consulting
>
> On Jan 11, 2016, at 10:22 PM, Chris Hansen <chris at iViking.org> wrote:
>
> Bob,
>
> Usually when you see that error, it means that somehow an action (like
> FMFind) was never reached in the code.  Is there something in your code
> that could be stopping things before you get to the final call, or did you
> omit one?
>
> Best,
>
> --Chris
>
> On Jan 11, 2016, at 1:45 PM, Bob Patin <bob at patin.com> wrote:
>
> Does this indicate that FX is failing to communicate w/ the Filemaker
> Server?
>
> Thanks,
>
> Bob Patin
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> FileMaker 9, 10, 11, 12 & 13 Certified Developer
> http://www.longtermsolutions.com
> -
> iChat: bobpatin at me.com
> Twitter: bobpatin
>> FileMaker Consulting
> FileMaker Hosting for all versions of FileMaker
> PHP • Full email services • Free DNS hosting • Colocation • Consulting
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20160113/6f55bf8d/attachment-0001.html


More information about the FX.php_List mailing list