Skip to content

Instantly share code, notes, and snippets.

@jadbaz
jadbaz / PrometheusUtil.java
Last active March 22, 2022 16:58
Prometheus Registry To Text
import io.prometheus.client.Collector;
import io.prometheus.client.CollectorRegistry;
import io.prometheus.client.Counter;
import io.prometheus.client.Gauge;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
{
"channels": {
"default": {
"version": "9999.1.2.3",
"url": "https://nocdevhttpserver/commander/cmdagent/releases/cmdagent_9999.1.2.3.zip",
"sha256": "78095C3F13B94F6EB0CF36B44A35985621B03C7EB30AF122D470C63F9BD9DC9E"
}
}
}
@jadbaz
jadbaz / metrics_output.txt
Last active June 12, 2020 11:10
Example output from Prometheus Java example
# HELP last_request_time Last request time
# TYPE last_request_time gauge
last_request_time{ws_type="ws_type_1",ws_method="get",} 1.591954253939E9
last_request_time{ws_type="ws_type_3",ws_method="post",} 1.591954175872E9
last_request_time{ws_type="ws_type_2",ws_method="post",} 1.591954246263E9
last_request_time{ws_type="ws_type_2",ws_method="get",} 1.59195425353E9
last_request_time{ws_type="ws_type_1",ws_method="post",} 1.591954177074E9
last_request_time{ws_type="ws_type_3",ws_method="get",} 1.591954253931E9
# HELP request_duration Request duration
# TYPE request_duration histogram
@jadbaz
jadbaz / sentry_vanilla_js_example.html
Last active January 16, 2024 15:38
Sentry Vanilla JS example
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Sentry JS Example</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<script
src="https://browser.sentry-cdn.com/5.16.1/bundle.min.js"
integrity="sha384-XeIbINcUQP10HtmVHwZigannjNDpoQRe+uhAoW9J5HU5dHFpilP164LjqO78xtIB"
crossorigin="anonymous">
@jadbaz
jadbaz / compile_zabbix_agent_openssl_static.sh
Created April 30, 2020 10:49
Compile zabbix agent with openssl with static libraries
PCRE_VERSION=8.44
ZABBIX_VERSION=4.4.7
OPENSSL_VERSION=1.1.1g
### gcc ###
test ! `which gcc` && test `which apt-get` && apt-get install g++
test ! `which gcc` && test `which yum` && yum install g++
### PCRE ###
cd /usr/local/src
@jadbaz
jadbaz / OpenSSL_command_line_Root_and_Intermediate_CA.md
Last active November 14, 2022 00:43
OpenSSL command line Root and Intermediate CA

OpenSSL command line Root and Intermediate CA

Creating root, intermediate and end-user certs

Prepare

Create a directory to contain everything

Root

Create directory

mkdir -p ./root

@jadbaz
jadbaz / OpenSSL_command_line_Root_and_Intermediate_CA.md
Last active August 26, 2023 18:03
OpenSSL command line Root and Intermediate CA

OpenSSL command line Root and Intermediate CA

Creating root, intermediate and end-user certs

Prepare

Create a directory to contain everything

Create index files

touch certindex
echo 1000 > certserial
@jadbaz
jadbaz / java_curr_date.sh
Created July 18, 2019 08:03
Javac one-liner for getting current date and time
echo "public class T { public static void main (String[] args) { System.out.println(new java.util.Date()); } }" > T.java; javac T.java; java T
header="<?xml version=\"1.0\" encoding=\"UTF-8\"?><ZenossEvents>"
line="<ZenossEvent><SourceComponent><device>$2</device></SourceComponent><summary>$4 - ###</summary><eventClassKey>GenericErrorKey</eventClassKey><component></component><severity>$3</severity></ZenossEvent>"
footer="</ZenossEvents>"
body=""
for i in `seq 1 $1`; do
this_line=$(echo $line | sed "s/###/$i/g")
body="${body}${this_line}"
done
@jadbaz
jadbaz / zenoss_list_event_classes.py
Last active July 3, 2019 12:45
Python Script to List Zenoss events in Zendmd
#!/usr/bin/env python
# https://community.zenoss.com/forum/community-home/digestviewer/viewthread?GroupId=19&MessageKey=5a46e08b-1fc2-45eb-be5a-2a428f3ce2fc
import Globals
ZENPACK_NAME="ZenPacks.acme.Classes"
limit = 10000000
classFilter = None
count = 0
ec_count = 0
mappings_count = 0