[FX.php List] Making sure servers are responding to FX queries
Chris Hansen
chris at iViking.org
Wed Sep 25 21:25:46 MDT 2013
Yes, I am lurking, and I will look at things when I get the chance. That said, there's been some great stuff on this thread. Thanks everyone!
--Chris
On Sep 25, 2013, at 11:15 AM, Steven Thoms <sthoms at wavecomm.com> wrote:
> That is nice, but it seems that it answers the question 'is port 80 open?', not specifically, 'is the wpe running?'
>
> The version I used with the DBNames call was really fast and accurate.
>
> Maybe if Chris is lurking, he could look into that specific call;)
>
> 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
>>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
More information about the FX.php_List
mailing list