Hi,

I need to check if some of our client soap api server is live.

in my prometheus.yml

  - job_name : 'clients'
    metrics_path: /probe
    scrape_interval: 30s
    file_sd_configs:
      - files:
          - '/etc/prometheus/targets/*.yml'
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 
X.X.202.179:9115  # The blackbox exporter's real hostname:port.

my blackbox.yml:

modules:
  http_2xx:
    prober: http
    timeout: 5s
    http:
      valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
      valid_status_codes: [200,201]  # Defaults to 2xx
      method: GET
      headers:
        Host: 
        Accept-Language: en-US
        Origin: example.com
      no_follow_redirects: false
      fail_if_ssl: false
      fail_if_not_ssl: false
      fail_if_body_matches_regexp:
        - "Could not connect to database"
      fail_if_body_not_matches_regexp:
        - "Download the latest version here"
      fail_if_header_matches: # Verifies that no cookies are set
        - header: Set-Cookie
          allow_missing: true
          regexp: '.*'
      fail_if_header_not_matches:
        - header: Access-Control-Allow-Origin
          regexp: '(\*|example\.com)'
      tls_config:
        insecure_skip_verify: false
      preferred_ip_protocol: "ip4" # defaults to "ip6"
      ip_protocol_fallback: false  # no fallback to "ip6"      
  magento1_x:
    prober: http
    timeout: 10s
    http:
      method: POST
      headers:
        SOAPAction: "urn:Mage_Api_Model_Server_V2_HandlerAction"
        Content-Type: text/xml; charset="utf-8"
      body: '<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/";>
    <Body>
        <login>
            <username></username>
            <apiKey></apiKey>
        </login>
    </Body>
</Envelope>'
      preferred_ip_protocol: "ip4"
      
in /targets/ directory
http_2xx.yml:( I can get *200* for below)

- labels:
    module: http_2xx
  targets:
    - 'https://xxxxxxx.com'
    - 'https://www.xxxxxx.com'

magento1_x.yml(I cant get 200 for below ones)

- labels:
    module: magento1_x
  targets:
  - 'https://www._client_host_.com/api/v2_soap/'

with curl I got *200*

 curl -v --location --request POST 'https://www._client_host_.com/api/v2_soap/' 
--header 'SOAPAction:  "urn:Mage_Api_Model_Server_V2_HandlerAction"' --header 
'Content-Type:  text/xml; charset="utf-8"' --data-raw '<Envelope 
xmlns="http://schemas.xmlsoap.org/soap/envelope/";>
    <Body>
        <login>
            <username></username>
            <apiKey></apiKey>
        </login>
    </Body>
</Envelope>'
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 192.240.171.50:443...
* TCP_NODELAY set
* Connected to www._client_host_.com (192.240.171.50) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=_client_host_.com
*  start date: May 23 23:10:21 2020 GMT
*  expire date: Aug 21 23:10:21 2020 GMT
*  subjectAltName: host "www._client_host_.com" matched cert's 
"www._client_host_.com"
*  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
*  SSL certificate verify ok.
> POST /api/v2_soap/ HTTP/1.1
> Host: www._client_host_.com
> User-Agent: curl/7.68.0
> Accept: */*
> SOAPAction:  "urn:Mage_Api_Model_Server_V2_HandlerAction"
> Content-Type:  text/xml; charset="utf-8"
> Content-Length: 192
>
* upload completely sent off: 192 out of 192 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 *200 *OK
< Date: Tue, 14 Jul 2020 08:57:43 GMT
< Server: Apache
< Set-Cookie: PHPSESSID=glb8rlg296d2ssdki0q2qjh1v5; expires=Tue, 14-Jul-2020 
09:57:43 GMT; Max-Age=3600; path=/; domain=_client_host_.com; secure; HttpOnly
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< Set-Cookie: CUSTOMER=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; 
Max-Age=0; path=/; domain=_client_host_.com; secure; httponly
< Set-Cookie: CUSTOMER_INFO=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; 
Max-Age=0; path=/; domain=_client_host_.com; secure; httponly
< Set-Cookie: CUSTOMER_AUTH=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; 
Max-Age=0; path=/; domain=_client_host_.com; secure; httponly
< Content-Length: 321
< Vary: Accept-Encoding,User-Agent
< Content-Type: text/xml; charset=UTF-8
<
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>6</faultcode><faultstring>Required
 parameter is missing, for more details see 
"exception.log".</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
* Connection #0 to host www._client_host_.com left intact

but in 
http://52.59.202.179:9115/probe?target=https%3A%2F%2Fwww._client_host_.com%2Fapi%2Fv2_soap%2F
 
<http://52.59.202.179:9115/probe?target=https%3A%2F%2Fwww.zohooralreef.com%2Fapi%2Fv2_soap%2F>

probe_dns_lookup_time_seconds 0.000907718
probe_duration_seconds 0.715782868
probe_failed_due_to_regex 0
probe_http_content_length 269
probe_http_duration_seconds{phase="connect"} 0.107355228
probe_http_duration_seconds{phase="processing"} 0.387106167
probe_http_duration_seconds{phase="resolve"} 0.000907718
probe_http_duration_seconds{phase="tls"} 0.32711412
probe_http_duration_seconds{phase="transfer"} 0.000230468
probe_http_redirects 0
probe_http_ssl 1
probe_http_status_code *500*
probe_http_uncompressed_body_length 269
probe_http_version 1.1
probe_ip_addr_hash 2.37858288e+08
probe_ip_protocol 4
probe_ssl_earliest_cert_expiry 1.598051421e+09
probe_ssl_last_chain_expiry_timestamp_seconds 1.598051421e+09
probe_success 0
probe_tls_version_info{version="TLS 1.2"} 1


I dont understand what is wrong with blackbox.yml I cant get *200 *from 
there.


-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/662be591-7943-4248-b759-083653d234e9n%40googlegroups.com.

Reply via email to