Skip to content

Instantly share code, notes, and snippets.

# If you want to stop and remove your stopped containers:
docker stop $(docker ps -a -q) &&
docker rm $(docker ps -a -q)
# Run containers:
docker-compose up -d
version: '3.1'
services:
postgres:
image: postgres:12
hostname: postgres
container_name: postgres
ports:
- "5432:5432"
environment:
Change Grafana default Username and Password :
1. Run : sudo nano /etc/grafana/grafana.ini
2. Change the following parameters :
#################################### Security #################################$
[security]
# default admin user, created on startup
admin_user = tap-your-username
@s-chb
s-chb / grafana rules
Created July 28, 2020 16:14
grafana rules
Grafana Queries:
1. CPU load :
sum(irate(node_cpu_seconds_total{mode="idle",instance=~'$node'}[5m])) or sum(irate(node_cpu{mode="idle",instance=~'$node'}[5m]))
2. Memory Usage :
100-(node_memory_MemAvailable{instance=~'$node'}/node_memory_MemTotal{instance=~'$node'}*100)
3. Disk Space Usage
groups:
- name: alert.rules
rules:
- alert: InstanceDown
expr: up == 0
for: 1m
labels:
severity: "critical"
annotations:
summary: "Endpoint {{ $labels.instance }} down"
CREATE SOURCE CONNECTOR http_source WITH (
'http.request.headers' = 'Content-Type: application/json',
'http.request.url' = 'http://demo:demo@public-ipv4:8080/engine-rest/history/activity-instance/',
'http.throttler.interval.millis' = '30000',
'http.request.method' = 'GET',
'kafka.topic' = 'act_hi_taskinst',
'http.throttler.catchup.interval.millis' = '1000',
'connector.class' = 'com.github.castorm.kafka.connect.http.HttpSourceConnector',
'tasks.max' = '1',
'key.converter' ='org.apache.kafka.connect.storage.StringConverter',
CREATE SOURCE CONNECTOR csv WITH (
'connector.class' = 'FileStreamSink',
'tasks.max' = '1',
'topics' = 'process_logpickr',
'file' = 'process.csv',
'key.converter' ='org.apache.kafka.connect.storage.StringConverter',
'value.converter' = 'org.apache.kafka.connect.storage.StringConverter'
);
CREATE SOURCE CONNECTOR http WITH (
'topics' = 'process_logpickr',
'tasks.max' = '1',
'connector.class' = 'io.confluent.connect.http.HttpSinkConnector',
'http.api.url' = 'http://public-ipv4:8888',
'key.converter' = 'org.apache.kafka.connect.storage.StringConverter',
'header.converter' = 'org.apache.kafka.connect.storage.StringConverter',
'value.converter' = 'org.apache.kafka.connect.storage.StringConverter',
'confluent.topic.bootstrap.servers' = 'broker:29092',
'confluent.topic.replication.factor' = '1',
const http = require('http');
http.createServer(function (req, res) {
console.log('..' + req.method + ' method invoked');
if (req.method === 'POST') {
let body = '';
req.on('data', chunk => {
body += chunk.toString();
});
req.on('end', () => {
console.log('..' + body);
CREATE SOURCE CONNECTOR jdbc_source WITH (
'connector.class' = 'io.confluent.connect.jdbc.JdbcSourceConnector',
'connection.url' = 'jdbc:postgresql://postgres:5432/camunda',
'connection.user' = 'camunda',
'connection.password' = 'camunda',
'topic.prefix' = 'jdbc_',
'table.whitelist' = 'act_hi_taskinst',
'mode' = 'incrementing',
'numeric.mapping' = 'best_fit',
'incrementing.column.name' = 'id',