Skip to content

Instantly share code, notes, and snippets.

receivers:
filelog:
include: ["/var/log/redis/redis.log"]
start_at: beginning
operators:
- type: file_input
include: ["/var/log/redis/redis.log*"]
start_at: beginning
watch_poll_interval: 15s
- type: multiline
@oleewere
oleewere / temp
Last active February 9, 2024 20:28
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"sync"
docker-build:
docker build -t oleewere/cbd:latest .
docker run --rm --entrypoint cp -v $$(pwd):/src oleewere/cbd:latest build/Darwin/cbd /src/cbd
Dockerfile:
FROM golang:1.12
ADD . /go/src/github.com/hortonworks/cloudbreak-deployer
WORKDIR /go/src/github.com/hortonworks/cloudbreak-deployer
@oleewere
oleewere / azure
Created August 2, 2022 14:31
azure
#!/bin/sh
export SUBSCRIPTIONID="3ddda1c7-d1f5-4e7b-ac81-0523f483b3b3"
export RESOURCEGROUPNAME="oszabo-rg"
export STORAGEACCOUNTNAME=$(az storage account list -g $RESOURCEGROUPNAME --subscription $SUBSCRIPTIONID|jq '.[]|.name'| tr -d '"')
export ASSUMER_OBJECTID=$(az identity list -g $RESOURCEGROUPNAME --subscription $SUBSCRIPTIONID|jq '.[]|{"name":.name,"principalId":.principalId}|select(.name | test("AssumerIdentity"))|.principalId'| tr -d '"')
export DATAACCESS_OBJECTID=$(az identity list -g $RESOURCEGROUPNAME --subscription $SUBSCRIPTIONID|jq '.[]|{"name":.name,"principalId":.principalId}|select(.name | test("DataAccessIdentity"))|.principalId'| tr -d '"')
export LOGGER_OBJECTID=$(az identity list -g $RESOURCEGROUPNAME --subscription $SUBSCRIPTIONID|jq '.[]|{"name":.name,"principalId":.principalId}|select(.name | test("LoggerIdentity"))|.principalId'| tr -d '"')
export RANGER_OBJECTID=$(az identity list -g $RESOURCEGROUPNAME --subscription $SUBSCRIPTIONID|jq '.[]|{"name":.name,"principalId":.principalId
@oleewere
oleewere / cipa.py
Created July 6, 2022 17:20
checkipaconsistency v2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tool to check consistency across FreeIPA servers
Author: Peter Pakos <peter.pakos@wandisco.com>
Copyright (C) 2017 WANdisco
This program is free software: you can redistribute it and/or modify
@oleewere
oleewere / cop_logging_agent_check.sh
Last active December 8, 2021 13:54
cop_logging_agent_check.sh
#!/bin/sh
: ${LOGFILE_FOLDER:="/var/log/cdp-telemetry-logging-doctor"}
MINION_SCRIPTS_FOLDER="/opt/salt/scripts"
SALT_CMD_TIMEOUT=120
LIVENESS_THRESHOLD_SECONDS=86400 # 1 day in seconds
BUFFER_LIMIT_BYTES=10485760 # 10 MB in bytes
# increase this to make sure to override the script in case of diagnostics
# todo: find better solution - pass by cli option?
VERSION=1
@oleewere
oleewere / words
Last active January 21, 2021 22:17
{
edit
}
#!/usr/bin/env python
import argparse
import sys
import os
import json
import subprocess
#import datetime
#from datetime import timezone, timedelta
This file has been truncated, but you can view the full file.
{
"images": {
"base-images": [
{
"created": 1571884856,
"date": "2019-10-24",
"description": "Official Cloudbreak image",
"images": {
"aws": {
@oleewere
oleewere / get-azure-msi
Created February 19, 2020 20:55
Get user assigned Azure Managed Identity from running VM by curl (with default MSI)
#!/usr/bin/env sh
function main() {
local defaultMsi=$1
access_token=$(curl -s -k -H "Metadata: true" "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/" | jq .access_token | tr -d '"')
access_token_status=$?
if [[ "${access_token_status}" != "0" ]]; then
echo "$defaultMsi"
return 0
fi