DX Application Performance Management

Expand all | Collapse all

Could not load from MetricsDataService?wsdl

  • 1.  Could not load from MetricsDataService?wsdl

    Posted Sep 11, 2013 11:26 AM
    I'm trying to extract some mertics for one of my clients from introscope using php

    still busy on the development system and getting the following errors was wondering is anyone could help

    the follow command works;
    wget http://Guest:@v058apmdea005:8081/introscope-web-services/services/MetricsDataService?wsdl
    code that fails
    #!/usr/bin/php
    <?php
    //require_once "SOAP/Client.php";
    //Create the client object
    $wsdl = "v058apmdea005.absa.co.za:8081/introscope-web-sevices/services/MetricsDataService?wsdl";
    $user = "Guest";
    $pass = "";
    try {
    $soapclient = new SoapClient(
            'http://' . urlencode($user) . ':' . urlencode($pass) . '@' . $wsdl,
            array('login' => $user, 'password' => $pass));
    } catch (SoapFault $e) {
            var_dump(libxml_get_last_error());
            var_dump($e);
    }
    //Use the functions of the client, the params of the function are in
    //the associative array
    $params = array(
            'agentRegex' => '(.*)(.*)(.*)',
            'metricRegex' => '(.*):Average Response Time(.*)',
            'startTime' => '2013-09-11T12:00:00Z',
            'endTime' => '2013-09-11T12:05:00Z',
            'dataFrequency' => '60'
            );
    $response = $soapclient->getMetricData($params);
    
    var_dump($response);
    ?>PHP Fatal error:  SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://Guest:@v058apmdea005.absa.co.za:8081/introscope-web-sevices/services/MetricsDataService?wsdl' : failed to load external entity "http://Guest:@v058apmdea005.absa.co.za:8081/introscope-web-sevices/services/MetricsDataService?wsdl"
     in /var/www/html/wsdl/dave1.php on line 14
    object(LibXMLError)#1 (6) {
      ["level"]=>
      int(1)
      ["code"]=>
      int(1549)
      ["column"]=>
      int(0)
      ["message"]=>
      string(133) "failed to load external entity "http://Guest:@v058apmdea005.absa.co.za:8081/introscope-web-sevices/services/MetricsDataService?wsdl"
    "
      ["file"]=>
      string(0) ""
      ["line"]=>
      int(0)
    }
    object(SoapFault)#2 (9) {
      ["message":protected]=>
      string(282) "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://Guest:@v058apmdea005.absa.co.za:8081/introscope-web-sevices/services/MetricsDataService?wsdl' : failed to load external entity "http://Guest:@v058apmdea005.absa.co.za:8081/introscope-web-sevices/services/MetricsDataService?wsdl"
    "
      ["string":"Exception":private]=>
      string(0) ""
      ["code":protected]=>
      int(0)
      ["file":protected]=>
      string(28) "/var/www/html/wsdl/dave1.php"
      ["line":protected]=>
      int(14)
      ["trace":"Exception":private]=>
      array(1) {
        [0]=>
        array(6) {
          ["file"]=>
          string(28) "/var/www/html/wsdl/dave1.php"
          ["line"]=>
          int(14)
          ["function"]=>
          string(10) "SoapClient"
          ["class"]=>
          string(10) "SoapClient"
          ["type"]=>
          string(2) "->"
          ["args"]=>
          array(2) {
            [0]=>
            string(99) "http://Guest:@v058apmdea005.absa.co.za:8081/introscope-web-sevices/services/MetricsDataService?wsdl"
            [1]=>
            array(2) {
              ["login"]=>
              string(5) "Guest"
              ["password"]=>
              string(0) ""
            }
          }
        }
      }
      ["previous":"Exception":private]=>
      NULL
      ["faultstring"]=>
      string(282) "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://Guest:@v058apmdea005.absa.co.za:8081/introscope-web-sevices/services/MetricsDataService?wsdl' : failed to load external entity "http://Guest:@v058apmdea005.absa.co.za:8081/introscope-web-sevices/services/MetricsDataService?wsdl"
    "
      ["faultcode"]=>
      string(4) "WSDL"
    }
    
    error


  • 2.  RE: Could not load from MetricsDataService?wsdl

    Broadcom Employee
    Posted Sep 11, 2013 11:36 AM
    Dave,
    Try changing your agent expression:
    'agentRegex' => '(.*)\|(.*)\|(.*)',


  • 3.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 11, 2013 11:51 AM
    Didn't work
    Its failing on

    $soapclient = new SoapClient(
    'http://' . urlencode($user) . ':' . urlencode($pass) . '@' . $wsdl,
    // 'http://' . urlencode($user) . '@' . $wsdl,
    // 'http://' . $wsdl,
    array('login' => $user, 'password' => $pass));


  • 4.  RE: Could not load from MetricsDataService?wsdl

    Broadcom Employee
    Posted Sep 11, 2013 11:58 AM
    Try escaping the forward slash ("/") in $wsdl.


  • 5.  RE: Could not load from MetricsDataService?wsdl

    Broadcom Employee
    Posted Sep 11, 2013 12:03 PM
    I had recheck my PHP manuals to make sure my head was on straight :lol:
    You will have to escape all special characters in your strings with a backslash ("\").


  • 6.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 11, 2013 12:13 PM
    PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http:\/\/Guest:@v058apmdea005.absa.co.za:8081\/introscope-web-sevices\/services\/MetricsDataService?wsdl' : failed to load external entity "http:\/\/Guest:@v058apmdea005.absa.co.za:8081\/introscope-web-sevices\/services\/MetricsDataService?wsdl"
    in /var/www/html/wsdl/dave1.php on line 14


  • 7.  RE: Could not load from MetricsDataService?wsdl

    Broadcom Employee
    Posted Sep 11, 2013 12:15 PM
    Dave,
    I've got PHP on one of my VMs. I'll try working on your code snippet to see if I can get it to work.


  • 8.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 11, 2013 12:18 PM
    ta, i dont think is the backslashes from what i gather from the manual, more like the login.


  • 9.  RE: Could not load from MetricsDataService?wsdl

    Broadcom Employee
    Posted Sep 11, 2013 12:17 PM
    Can you show my function var_dump()?


  • 10.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 11, 2013 12:55 PM
    var_dump() is standard php


  • 11.  RE: Could not load from MetricsDataService?wsdl

    Broadcom Employee
    Posted Sep 11, 2013 01:24 PM
    Thanks, Dave; I haven't been spending as much time doing PHP coding as of late.


  • 12.  RE: Could not load from MetricsDataService?wsdl

    Broadcom Employee
    Posted Sep 11, 2013 04:05 PM
    Dave,
    You have a typo:
    $wsdl = "v058apmdea005.absa.co.za:8081/introscope-web-sevices/services/MetricsDataService?wsdl";
    Should be:
    $wsdl = "v058apmdea005.absa.co.za:8081/introscope-web-services/services/MetricsDataService?wsdl";


  • 13.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 12, 2013 03:36 AM
    can you believe it,
    It now loads the class onto the next challenge of getting the metric data.


  • 14.  RE: Could not load from MetricsDataService?wsdl

    Broadcom Employee
    Posted Sep 12, 2013 09:15 AM
    Please keep us informed and share the code if you can.


  • 15.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 16, 2013 01:04 PM
    working, code pasted below
    #!/usr/bin/php
    <?php
    //require_once "SOAP/Client.php";
    //Create the client object
    //$wsdl = "http://Guest:@v058apmdea005:8081/apm-web-services/services/MetricsService?wsdl";
    $wsdl5 = "v058apmdea005.absa.co.za:8081/introscope-web-services/services/MetricsDataService?wsdl";
    //$wsdl = "v058apmdea010.absa.co.za/introscope-web-services/services/MetricsDataService?wsdl";
    $wsdl10 = "v058apmdea010.absa.co.za:8081/introscope-web-services/services/MetricsDataService?wsdl";
    $user = "****";
    $pass = "*********";
    try {
    $soapclient5 = new SoapClient(
            'http://' . urlencode($user) . ':' . urlencode($pass) . '@' . $wsdl5,
            array('login' => $user, 'password' => $pass));
    } catch (SoapFault $e) {
            var_dump(libxml_get_last_error());
            var_dump($e);
    }
    
    try {
    $soapclient10 = new SoapClient(
            'http://' . urlencode($user) . ':' . urlencode($pass) . '@' . $wsdl10,
            array('login' => $user, 'password' => $pass));
    } catch (SoapFault $e) {
            var_dump(libxml_get_last_error());
            var_dump($e);
    }
    
    //var_dump($soapclient->__getFunctions());
    //Use the functions of the client, the params of the function are in
    //the associative array
    //ArrayOfTimesliceGroupedMetricData getMetricData(string $agentRegex, string $metricRegex, dateTime $startTime, dateTime $endTime, int $dataFrequency)
            $agentRegex = '(wasdr03)\|(.*)\|(.*)';
    //      $agentRegex = '(wasp(s|n)0(1|2).*)(.*)(IB.*)';
            $metricRegex = '(.*):Utilization(.*)';
    //      $metricRegex = 'Frontends\|Apps\|IBAbsa\:Average Response Time \(ms\)';
            $startTime = '2013-09-12T09:00:00Z';
            $endTime = '2013-09-12T10:00:00Z';
            $dataFrequency = '60';
    //$response = $soapclient->getMetricData($params);
    echo "\nGet Responce \n";
    //$response = $soapclient->getMetricData('(.*)\|(.*)\|(.*)', '(.*):Average Response Time(.*)', '2013-09-11T12:00:00Z', '2013-09-11T12:05:00Z', '60');
    $response5 = $soapclient5->getMetricData($agentRegex, $metricRegex, $startTime, $endTime, $dataFrequency);
          $agentRegex = '(wasp(s|n)0(1|2).*)(.*)(IB.*)';
          $metricRegex = 'Frontends\|Apps\|IBAbsa\:Average Response Time \(ms\)';
    $response10 = $soapclient10->getMetricData($agentRegex, $metricRegex, $startTime, $endTime, $dataFrequency);
    
    var_dump($response5);
    var_dump($response10);
    ?>


  • 16.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 16, 2013 01:08 PM
    Getting it working only created even more questions.

    I'm in South Africa and all my servers and data is catered in time zone SAST, thats GMT +2 or Africa/Johannesburg

    When I receive the data back from wsdl it comes back in GMT zone, is this the default whicj is what I'm expecting and where can it be changed to return data at a different time zone, like the time zone of the server.

    Dave


  • 17.  RE: Could not load from MetricsDataService?wsdl

    Broadcom Employee
    Posted Sep 16, 2013 03:11 PM
    Unless I'm completely mistaken, it should come back in your EM's timezone. Although, it would make sense to normalize it to GMT for ease of use.

    Great job in getting your PHP code working! I just tested it on my server and it worked fine.

    -Hiko


  • 18.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 18, 2013 02:39 PM
    Still coming back in GMT, anyone have any definite knowledge on the timezone returned by :8081/introscope-web-services/services/MetricsDataService?wsdl and of course on how to alter returned timezone

    Dave


  • 19.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 18, 2013 02:46 PM
    anyone know where the following file is

    CEMWebServicesSDK.zip


  • 20.  RE: Could not load from MetricsDataService?wsdl

    Broadcom Employee
    Posted Sep 19, 2013 11:46 AM
    You shouldn't need the SDK if all you're wanting to do is pull the CEM metrics.
    The following CA CEM web services APIs are available, when you start the Enterprise Manager:
    Open the following WSDLs in a web browser to expose the CA CEM web services:
    http://<host>:<port>/wily/cem/webservices/ConfigurationDataOutService?wsdl

    http://<host>:<port>/wily/cem/webservices/BizImpactDataOutService?wsdl

    http://<host>:<port>/wily/cem/webservices/EventsDataOutService?wsdl

    http://<host>:<port>/wily/cem/webservices/StatisticsDataOutService?wsdl

    Replace <host> and <port> with the hostname of the CA CEM computer and port number where the CA CEM server is running.

    You can also use the CEMExportTool from a commandline. You can get the binary in the Community Documents.


  • 21.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 20, 2013 07:28 AM
    CA Support Request 21539827 01 - WSDL RETURNING VALUES AT GMTHi Dave,

    Thanks for getting back to me - I did some research and can't find anything documented indicating that this is expected behaviour - however interpreting all times as GMT is not an unusual approach - as I have come across many applications that do that. I did find another post on the community a year ago asking the same question but no answer has been provided so I am not taking this question up internally and will get back to you as soon as possible.

    Taking a pragmatic approach however I would suggest that it might be worth looking at modifying your custom application to convert any input times to GMT before making the webservice call as I suspect this will come back as a working as designed / expected behaviour (albeit apparently undocumented).

    I will keep you informed as to the progress.

    best regards
    Mike


  • 22.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 20, 2013 07:30 AM
    CA Support Request 21539827 01 - WSDL RETURNING VALUES AT GMT

    Hi Dave,

    I think I have the answer - the starttime and endtime data types are xsd dataTime format and that has the following standard definition with regard to time zones

    Time Zones

    To specify a time zone, you can either enter a dateTime in UTC time by adding a "Z" behind the time - like this:

    <startdate>2002-05-30T09:30:10Z</startdate>
    or you can specify an offset from the UTC time by adding a positive or negative time behind the time - like this:

    <startdate>2002-05-30T09:30:10-06:00</startdate>

    or

    <startdate>2002-05-30T09:30:10+06:00</startdate>

    I see from your wsdl that you are specifying the Z at the end of the string this forcing it to GMT / UTC. Please can you try the alternate format with the offset and let me know if that helps.

    best regards
    Mike


    Thank you,
    CA Support


  • 23.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 20, 2013 07:31 AM
    Tested
    Exactly correct, have changed inputs to

    $startTime = '2013-09-20T13:00:00+02:00';
    $endTime = '2013-09-20T14:00:00+02:00';

    Values are still returned as UCT/GMT

    will request if this can be changed and post.

    Dave


  • 24.  RE: Could not load from MetricsDataService?wsdl

    Posted Sep 20, 2013 07:32 AM
    CA Support Request 21539827 01 - WSDL RETURNING VALUES AT GMT

    Hi Dave,

    Thanks for getting back to me - I will research the return data but suspect UTC time format is designed - in which case your application will need to handle any TZ conversion.

    Just for my better understanding please can you provide some sample input / output

    best regards
    Mike


    Thank you,
    CA Support


  • 25.  RE: Could not load from MetricsDataService?wsdl
    Best Answer

    Posted Sep 20, 2013 09:24 AM
    Cleaned up PHP with timezone correction
    #!/usr/bin/php
    <?php
    //require_once "SOAP/Client.php";
    //
    function array_values_recursive($arr){
            $arr = array_values($arr);
            foreach($arr as $key => $val)
                if(array_values($val) === $val)
                    $arr[$key] = array_values_recursive($val);
    
            return $arr;
    }
    //
    //Create the client object
    $wsdl10 = "v058apmdea010.absa.co.za:8081/introscope-web-services/services/MetricsDataService?wsdl";
    $user = "*****";
    $pass = "*****";
    //
    try {
    $soapclient10 = new SoapClient(
            'http://' . urlencode($user) . ':' . urlencode($pass) . '@' . $wsdl10,
            array('login' => $user, 'password' => $pass));
    } catch (SoapFault $e) {
            var_dump(libxml_get_last_error());
            var_dump($e);
    }
    //Use the functions of the client, the params of the function are in
    //the associative array
    //ArrayOfTimesliceGroupedMetricData getMetricData(string $agentRegex, string $metricRegex, dateTime $startTime, dateTime $endTime, int $dataFrequency)
    //      $agentRegex = '(wasdr03)\|(.*)\|(.*)';
    //      $agentRegex = '(wasp(s|n)0(1|2).*)(.*)(IB.*)';
    //      $metricRegex = '(.*):Utilization(.*)';
    //      $metricRegex = 'Frontends\|Apps\|IBAbsa\:Average Response Time \(ms\)';
            $startTime = '2013-09-20T13:00:00+02:00';
            $endTime = '2013-09-20T13:02:00+02:00';
            $dataFrequency = '60';
    //$response = $soapclient->getMetricData($params);
    // $agentRegex = '(wasp(s|n)0(1|2).*)(.*)(IB.*)';
            $agentRegex = '(wasp(s|n)0(1|2).*)(.*)(IBWasSrv)(.*)';
    //      $agentRegex = '(wasp(s|n)0(1|2).*)(.*)(IBWasSrv01)(.*)';
          $metricRegex = 'Frontends\|Apps\|IBAbsa\:Average Response Time \(ms\)';
    $response10 = $soapclient10->getMetricData($agentRegex, $metricRegex, $startTime, $endTime, $dataFrequency);
    //
    foreach($response10 as $key => $timesl) {
            //
            $timezone = "SAST";
            $gmt = DateTime::createFromFormat('Y-m-d\TH:i:s.uP',  $timesl->timesliceStartTime , new DateTimeZone('UCT') );
            $gmt->setTimezone(new DateTimeZone($timezone) );
            foreach( $timesl->metricData as $srv => $values ) {
                    echo $gmt->format('Y-m-d H:i:s');
                    echo " ";
                    print_r( $values->agentName );
                    echo " ";
                    print_r( $values->metricName );
                    echo " = ";
                    print_r( $values->metricValue );
                    echo "\n";
            }
    }
    
    ?>