This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import logging | |
import time | |
import luigi | |
logger = logging.getLogger(__name__) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; do | |
# capture pidstat | |
pidstat_in_mem=$(pidstat -l -w -u -h -d -r -p ALL) |grep -v 'Time UID\|Linux' | |
# the template | |
#Time,UID,PID,%usr,%system,%guest,%CPU,CPU,minflt/s,majflt/s,VSZ,RSS,%MEM,kB_rd/s,kB_wr/s,kB_ccwr/s,iodelay,cswch/s,nvcswch/s,Command | |
# index's | |
time_idx=1 | |
pid=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# -*- mode: perl; indent-tabs-mode: t; perl-indent-level: 8 -*- | |
# Author: Andrew Theurer | |
# | |
package GenData; | |
use strict; | |
use warnings; | |
use File::Basename; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# index's | |
time_idx=1 | |
pid=3 | |
cpu_pres=7 | |
mem_pres=13 | |
rss=12 | |
cmd=20 | |
pidstat_in_mem=$(pidstat -l -w -u -h -d -r -p ALL |grep -v 'Time UID\|Linux') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
# -*- coding: utf-8 -*- | |
def search_item_with_index_of(arr, target): | |
"""Scan list of integers (sorted) and retrive the smaller index using python | |
standart list libary l.index(). | |
Args: | |
arr (list): list of integers. | |
target (target): The target int to lookup. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
oc exec -ti prometheus-k8s-0 -c prometheus -- curl -s http://localhost:9090/targets |grep -i '<a id="job' | |
######## example output ##### | |
# <a id="job-alertmanager-main" href="#job-alertmanager-main">alertmanager-main (3/3 up)</a> | |
# <a id="job-apiserver" href="#job-apiserver">apiserver (3/3 up)</a> | |
# <a id="job-cluster-monitoring-operator" href="#job-cluster-monitoring-operator">cluster-monitoring-operator (1/1 up)</a> | |
# <a id="job-kube-state-metrics" href="#job-kube-state-metrics">kube-state-metrics (2/2 up)</a> | |
# <a id="job-kubelet" href="#job-kubelet">kubelet (210/210 up)</a> | |
# <a id="job-node-exporter" href="#job-node-exporter">node-exporter (105/105 up)</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// POC for pre-loaded search engine, the following code impl a search component | |
// based on a Document files i.e (ELK system). | |
// DataSet object must initialized first (pre-load - in order to map text to document(s)), in | |
// real life, we will need to sync the Objct and update it when new documents arrives | |
// currently this is a single thread app. | |
// the DataSet Object is a singleton instance (thread safe), to support multiple clients. | |
// Object updates are not thread safe yet! | |
// time complaxity: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Interpolation Search in Golang | |
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
var ( | |
index int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cname=$(docker ps --filter name=k8s_prometheus_prometheus-k8s --format "{{.Names}}") | |
ppid=$(pgrep -f '/bin/prometheus --web') | |
mkdir -p ./prometheus_profiler/ | |
# start monitor | |
while true; do | |
d=$(date "+%s") | |
nsenter --target $ppid --mount --uts --ipc --net --pid curl http://localhost:9090/debug/pprof/heap > ./prometheus_profiler/heap_${d}.pprof | |
for arg in inuse_space inuse_objects alloc_space alloc_objects; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; | |
do | |
echo "$(date +'%m-%d-%y-%H:%M:%S') $(oc exec prometheus-k8s-0 -n openshift-monitoring -c prometheus -- df |grep -v tmp |grep '/prometheus')" >> ~/pvc_monitor_0.log | |
echo "$(date +'%m-%d-%y-%H:%M:%S') $(oc exec prometheus-k8s-1 -n openshift-monitoring -c prometheus -- df |grep -v tmp |grep '/prometheus')" >> ~/pvc_monitor_1.log | |
sleep 15 | |
done | |
exit 0 |
NewerOlder