Skip to content

Instantly share code, notes, and snippets.

View justinkambic's full-sized avatar
🏠
Working from home

Justin Kambic justinkambic

🏠
Working from home
View GitHub Profile
@justinkambic
justinkambic / kill-script-recorder.sh
Created April 25, 2023 14:18
Killall script recorder
#!/bin/bash
# Set the substring to search for in the command name
substring="synthetics-recorder"
# Find the process IDs (PIDs) of processes whose command contains the substring
pids=$(pgrep -f "$substring")
# Loop through each PID and send SIGTERM to terminate the process
for pid in $pids; do
@justinkambic
justinkambic / gist:3f65fbd42c68dd5b9145ba1790fb6779
Created May 5, 2021 18:43
Fleet policy causing Agent to run multiple Heartbeat processes
id: 697aba10-ada2-11eb-acdf-2b0d5f78c911
revision: 20
outputs:
default:
type: elasticsearch
hosts:
- 'http://localhost:9200'
output_permissions:
default:
_fallback:
@justinkambic
justinkambic / gist:484cfc7d7c1faf230e8d141665a3ac2b
Created February 9, 2021 18:43
desired synthetics policy
// currently
- id: 90976344-cd1f-4f1c-8d96-efa2f8324738
name: synthetics-1
revision: 1
type: synthetics/http
use_output: default
meta:
package:
name: synthetics
version: 0.1.3
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
heartbeat.monitors:
###### from shahzad
- type: http
name: elastic
hosts: ["https://www.elastic.co"]
schedule: "@every 10s"
tags: ["secure"]
mode: all
fields_under_root: true
env GEO_NAME="fairbanks" env DATA_PATH="~/tmp/heartbeat-data2" env ES_URL="http://localhost:9200" env AUTH="/Users/jk/git/justinkambic/kibana/packages/kbn-dev-utils/certs/ca.crt" env CERT="/Users/jk/git/justinkambic/kibana/packages/kbn-dev-utils/certs/elasticsearch.crt" env KEY="/Users/jk/git/justinkambic/kibana/packages/kbn-dev-utils/certs/elasticsearch.key" ./heartbeat -e
2020-04-13T09:03:28.389-0400 INFO instance/beat.go:609 Home path: [/Users/jk/git/justinkambic/src/github.com/elastic/beats/heartbeat] Config path: [/Users/jk/git/justinkambic/src/github.com/elastic/beats/heartbeat] Data path: [~/tmp/heartbeat-data2] Logs path: [/Users/jk/git/justinkambic/src/github.com/elastic/beats/heartbeat/logs]
2020-04-13T09:03:28.390-0400 INFO instance/beat.go:617 Beat ID: e71b4c44-395e-4944-80e8-6d5826284d96
2020-04-13T09:03:28.392-0400 INFO [beat] instance/beat.go:945 Beat info {"system_info": {"beat": {"path": {"config": "/Users/jk/git/justinkambic/src/github.com/elastic/beats/heartbeat", "data": "~/tmp/heartbeat-
@justinkambic
justinkambic / gist:3871200d5c1c5c8f74002ed4a327d8d1
Last active March 11, 2020 14:29
es query with spread vs without
// with spread
{
"size": 0,
"query": {
"bool": {
"filter": [
{
"exists": {
"field": "summary"
}
This file has been truncated, but you can view the full file.
- type: http
schedule: "@every 1m"
urls: ["http://localhost:20000/"]
- type: http
schedule: "@every 1m"
urls: ["http://localhost:20001/"]
- type: http
schedule: "@every 1m"
urls: ["http://localhost:20002/"]
- type: http
GET heartbeat-7*/_search
{
"query": {
"bool": {
"filter": [
{
"exists": {
"field": "summary.up"
}
}
@justinkambic
justinkambic / schema.gql.ts
Created June 11, 2019 13:33
A WIP GQL schema for heartbeat-states index
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import gql from 'graphql-tag';
export const monitorStatesSchema = gql`
type Agent {