Elastic HeartBeat HTTP - elasticsearch

I am working on a monitoring solution, and I am facing some issues. I need to create a request towards a URL, and parse the response. I have tried the following, but cannot find the message in grafana :
- type: http
urls: ["https://securpharm-status.de/status"]
schedule: '#every 600s'
proxy_url: http://user#1.1.1.1
tags: ["name"]
name: "status"
check.request:
method: GET
check.response:
json:
- description: check status
condition:
equals:
status: ok
also tried many other options, but still only the response code has been returned.

Related

How is the actual Request URL generated from a custom connector api definition

Since there isn't currently a native databricks powerapps connector, I set up a custom connector that calls the jobs runnow api using an AD backed service principle bearer token. I then shared the custom connector and the connection with users for them to run. While this is working fine for everyone on my team, the actual end users are getting a 401 error response. Since everyone on my team are admins in Azure and Databricks, it's likely we have permissions that the end users don't. However, we're having a hard time pinpointing where that might be.
During PowerApps monitoring sessions, we did notice that the Request URL is different for the users getting successful 200 responses, versus those getting 401. The odd thing is, neither matches the specified host in the custom connector. Can anyone tell me how this is generated?
Here is the custom connector code we're using:
swagger: '2.0'
info: {title: Databricks Jobs, description: Call Databricks Jobs API,
version: '1.0'}
host: <databricksInstance>.azuredatabricks.net
basePath: /api/2.1/jobs/
schemes: [https]
consumes: []
produces: []
paths:
/run-now:
post:
responses:
default:
description: default
schema:
type: object
properties:
run_id: {type: integer, format: int32, description: run_id}
number_in_job: {type: integer, format: int32, description: number_in_job}
summary: Start Databricks Notebook as a Job
description: Start Databricks Notebook as a Job
operationId: run-now
x-ms-visibility: important
parameters:
- {name: Content-Type, in: header, required: true, type: string, default: application/json,
x-ms-visibility: internal}
- {name: Accept, in: header, required: true, type: string, default: application/json,
x-ms-visibility: internal}
- name: body
in: body
required: true
schema:
type: object
properties:
job_id: {type: integer, format: int64, description: job_id, title: ''}
required: [job_id]
definitions: {}
parameters: {}
responses: {}
securityDefinitions:
API Key: {type: apiKey, in: header, name: Authorization}
security:
- API Key: []
tags: []
Here is the actual request as seen in PowerApps monitor that returns a successful 200 code (same url for everyone getting a success):
And here is the actual request sent that returns the 401 error:
As you can see, the request url is the same for both except for that last highlighted string. Can anyone tell me how that is generated from the specified host in the API call definition? Any idea what that may signify?

Spring Cloud Gateway - RewriteLocationResponseHeader

I have the following route inside my Spring Cloud Gateway configuration:
- id: pgadmin
uri: lb://pg-admin-service
predicates:
- Path=/pgadmin/**
filters:
- RewritePath=/pgadmin(?<segment>/?.*), $\{segment}
- RewriteLocationResponseHeader=AS_IN_REQUEST, Location, , <---- this line is incorrect
The request comes in on http://10.0.0.100/pgadmin/ as an unauthenticated user. The application returns a response containing a location header with the value:
http://10.0.0.100/login
The browser tries to rediect to that URL. Instead, it should redirect to:
http://10.0.0.100/pgadmin/login
What is the correct value for the RewriteLocationResponseHeader in the route definition?
Many thanks
JT
Try something this if you want to rewrite your path:
- id: docs
uri: lb://auth-service
predicates:
- Path=/my-auth/**
filters:
- RewritePath=/my-auth(?<segment>/?.*), $\{segment}
or to simply forward the request onto your service:
- id: docs
uri: lb://auth-service
predicates:
- Path=/my-auth/**

ELK Heartbeat dashbaord add ID

How can I add ID field to Kibana / Uptime dashboard?
Installed ver 7.3. This shows "NAME" as one of the column headers. You can specify what is displayed in there in monitor configuration:
- type: http
name: 'QA.Service - THIS HERE'
enabled: true
schedule: '#every 5m'
urls: ["http://checkstatus/blah/blah"]
check.response:
status: 200
json:
- description: Json Response
condition:
equals:
Status: Ok

Multiple paths in http module - metricbeats

I am using http module of metricbeats to monitor jmx. I am using http module instead of the jolokia module because it lacks wildcard support at this point. The example configuration in the documents is as follows.
- module: http
metricsets: ["json"]
period: 10s
hosts: ["localhost:80"]
namespace: "json_namespace"
path: "/jolokia/"
body: '{"type" : "read", "mbean" : "kafka.consumer:type=*,client-id=*", "attribute" : "count"}'
method: "POST"
This works fine and I am able to get data to kibana. I see errors when I configure it as follows to call multiple paths.
- module: http
metricsets: ["json"]
enabled: true
period: 10s
hosts: ["localhost:80"]
namespace: "metrics"
method: POST
paths:
- path: "/jolokia/"
body: '{"type" : "read", "mbean" : "kafka.consumer:type=*,client-id=*", "attribute" : "bytes-consumed-rate"}'
- path: "/jolokia/"
body: '{"type" : "read", "mbean" : "kafka.consumer:type=*,client-id=*", "attribute" : "commit-latency-avg"}'
This does not seem to be the right config and I see that the http events have had failures.
2018/02/26 19:53:18.315740 metrics.go:39: INFO Non-zero metrics in the last 30s: beat.info.uptime.ms=30000 beat.memstats.gc_next=4767600 beat.memstats.memory_alloc=4016168 beat.memstats.memory_total=47474256 libbeat.config.module.running=3 libbeat.output.read.bytes=4186 libbeat.output.write.bytes=16907 libbeat.pipeline.clients=7 libbeat.pipeline.events.active=0 libbeat.pipeline.events.published=18 libbeat.pipeline.events.total=18 libbeat.pipeline.queue.acked=18 metricbeat.http.json.events=3 metricbeat.http.json.failures=3
Documentation on how to setup http module: Example configuration
I had to query multiple URL's of my REST API and I could achieve that by having multiple modules of "http" with different host URL's following is the example:
- module: http
metricsets: ["json"]
period: 3600s
hosts: ["http://localhost/Projects/method1/"]
namespace: "testmethods"
method: "GET"
enabled: true
- module: http
metricsets: ["json"]
period: 3600s
hosts: ["http://localhost/Projects/method2/"]
namespace: "testmethods"
method: "GET"
enabled: true
This made me achieve have multiple paths for the same module
Multiple paths are not supported by the http module's json metricset.
What you found in the config example is for the http module's server metricset. This metricset does not query URLs. Instead it opens an http server on the specified port, and can receive input on multiple paths which are used to separate data into different namespaces.

swagger editor UI sends a OPTIONS request method instead of PUT and DELETE

http://editor.swagger.io sends a OPTIONS request method instead of PUT and DELETE but for POST and GET it's work perfectly
even I have installed a Chrome extension that adds Access-Control-Allow-Origin to outgoing requests. and same added in the c# code like below
[EnableCors(origins: "", headers: "", methods: "*", exposedHeaders: "x-docname,x-docid")]
put:
tags:
- sources
summary: Updated sources Groups
description: This Will Create new Group under sources
operationId: PUT
consumes:
- application/x-www-form-urlencoded
produces:
- application/json
parameters:
- name: sourceId
in: path
description: name that need to be updated
required: true
type: string
- name: text
in: formData
description: Updated name of the text
required: true
type: string
responses:
200:
description: "Ok : Successful requests"
201:
description: "Created : Successful creation"
400:
description: "Bad Request : The path info doesn't have the right format"
403:
description: "Forbidden : The invoker is not authorized to invoke the operation"
404:
description: "Not Found : The object referenced by the path does not exist"
500:
description: "Internal Server Error : The execution of the service failed in some way"

Resources