[FX.php List] Making sure servers are responding to FX queries
Bob Patin
bob at patin.com
Wed Sep 25 14:34:07 MDT 2013
I already had that, but first I needed to be sure that the server's actually up and running.
The interesting thing is this: I pointed to a non-existent server, and because the server didn't exist, the page stalled out; now I put the fsockopen test ABOVE my query; if the server isn't there, it never gets to the query; if the server IS there, it does the query.
However...
What if the server is there, but WPE is stalled out for some reason? Without disabling one of my WPEs (which I can't do), I can't really test that state.
If anyone has code to test for that, I'd appreciate it...
Thanks,
Bob Patin
Longterm Solutions LLC
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com
FileMaker 9, 10, 11& 12 Certified Developer
Member of FileMaker Business Alliance and FileMaker TechNet
--
Twitter: bobpatin
AIM: longterm1954
iChat: bobpatin
--
Expert FileMaker Consulting
FileMaker Hosting for all versions of FileMaker
On Sep 25, 2013, at 12:19 PM, Steven Thoms <sthoms at wavecomm.com> wrote:
> It seems the strongest assurance would come from putting the wpe test code in the /* DO A QUERY NOW */ statement block...
>
> Steve
> 207 798-0171
>
> On Sep 25, 2013, at 12:50 PM, Bob Patin wrote:
>
>> I found Webko's example, which I added here:
>>
>> if( !fsockopen ($server, 80, $errno, $errstr, 2) ){
>> $color = "#FFADA7";
>> $body = $machine." IS NOT RESPONDING.";
>> }else{
>> /* DO A QUERY NOW */
>> }
>>
>> Works great... not sure why I never implemented it before now... :)
>>
>> BP
>>
>> Bob Patin
>> Longterm Solutions LLC
>> bob at longtermsolutions.com
>> 615-333-6858
>> http://www.longtermsolutions.com
>> FileMaker 9, 10, 11& 12 Certified Developer
>> Member of FileMaker Business Alliance and FileMaker TechNet
>> --
>> Twitter: bobpatin
>> AIM: longterm1954
>> iChat: bobpatin
>> --
>> Expert FileMaker Consulting
>> FileMaker Hosting for all versions of FileMaker
>>
>> On Sep 25, 2013, at 10:32 AM, Steven Thoms <sthoms at wavecomm.com> wrote:
>>
>>> Bob,
>>>
>>> The simplest solution I have found is to test each required file with a -findany request.
>>> If you get an error, the server isn't responding.
>>>
>>> Before version 11, I think, but maybe sooner the FMDBNames() stopped working in FX. But I used to use this code to test and it was very quick and worked a charm:
>>>
>>>
>>> // confirmDatabases
>>> $strError = '';
>>> $resultError = 0;
>>> $query = fmConnect(); // does not require a dbname, for obvious reasons; see below...
>>> $result = $query -> FMDBNames();
>>> //print_r($result);
>>> if ( $query->lastErrorCode != 0 ) {
>>> AddError("The databases are not available.<br />The Web Publishing Engine is not responding. ErrorCode:" . $query->lastErrorCode , $strError);
>>> } else {
>>> $searchDbs = explode("," , REQUIRED_DBS);
>>> $dataString = serialize($result['data']);
>>> foreach ( $searchDbs as $key=>$dbName ) {
>>> if ( strpos($dataString , $dbName) === false ) {
>>> $newError = "The " . $dbName . " database was not available.";
>>> AddError($newError , $strError);
>>> }
>>> }
>>> }
>>> if ( $strError != '' )
>>> include_once "{$AppLoc}src/error.php";
>>>
>>>
>>> With these settings at the top of the page...
>>>
>>> // db access files
>>> require_once "{$_SERVER['DOCUMENT_ROOT']}/FX/FX.php";
>>> require_once "{$_SERVER['DOCUMENT_ROOT']}/FX/FM_Errors.php";
>>> require_once "{$_SERVER['DOCUMENT_ROOT']}/FX/FX_Error.php";
>>> require_once "{$_SERVER['DOCUMENT_ROOT']}/FX/server_data.php";
>>>
>>> // db defaults
>>> define ("REQUIRED_DBS", "File1, File2, etc.");
>>> define ("GROUP_SIZE", "all");
>>> define ("ERROR_SPACE", "<br /> ");
>>>
>>> // fx interface functions
>>>
>>> function fmConnect($layout = '' , $groupSize = GROUP_SIZE, $responseLayout='') {
>>> $query = new FX(FM_IP, FM_PORT, FM_VERSION);
>>> if ( $layout != '' )
>>> $query -> SetDBData(FMDB, $layout, $groupSize, $responseLayout);
>>> $query -> SetDBUserPass(FM_USERNAME, FM_PASSWORD);
>>> return $query;
>>> }
>>>
>>> I hope that helps,
>>>
>>> Steve
>>>
>>>
>>> On Sep 25, 2013, at 11:03 AM, Bob Patin wrote:
>>>
>>>> A while back someone posted their code for monitoring whether a web server is responding to FX queries.
>>>>
>>>> I have a little test database on each of my FM servers and wrote a page that does a quick query every N minutes, but I don't think it's really telling me the truth.
>>>>
>>>> I say that because I retired one of my FM servers, and yet my page still reports that it's functioning normally... :)
>>>>
>>>> I'd love to get a copy of that code; I think it might've been Webko?
>>>>
>>>> Thanks,
>>>>
>>>> Bob Patin
>>>> Longterm Solutions LLC
>>>> bob at longtermsolutions.com
>>>> 615-333-6858
>>>> http://www.longtermsolutions.com
>>>> FileMaker 9, 10, 11& 12 Certified Developer
>>>> Member of FileMaker Business Alliance and FileMaker TechNet
>>>> --
>>>> Twitter: bobpatin
>>>> AIM: longterm1954
>>>> iChat: bobpatin
>>>> --
>>>> Expert FileMaker Consulting
>>>> FileMaker Hosting for all versions of FileMaker
>>>>
>>>> _______________________________________________
>>>> 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/20130925/5c835ff8/attachment.html
More information about the FX.php_List
mailing list