Skip to content

Instantly share code, notes, and snippets.

Avatar

Denis Zhdanov deniszh

View GitHub Profile
@deniszh
deniszh / targetsContext2.patch
Created Oct 25, 2021
Patch for populating targets in graphite-web context
View targetsContext2.patch
--- views.py.bak 2021-10-25 21:19:07.891661700 +0200
+++ views.py 2021-10-25 21:21:17.093932100 +0200
@@ -74,6 +74,8 @@
'xFilesFactor' : requestOptions['xFilesFactor'],
'maxDataPoints' : requestOptions.get('maxDataPoints', None),
'targets': requestOptions['targets'],
+ 'maxStep': requestOptions.get('maxStep', None),
+ 'targets_serialized': requestOptions.get('targets_serialized', None),
}
data = requestContext['data']
@deniszh
deniszh / targetsContext1.patch
Created Oct 16, 2021
Patch for populating targets in graphite-web context
View targetsContext1.patch
--- /opt/graphite/webapp/graphite/render/views.py.bak 2021-10-07 19:04:25.052907254 +0000
+++ /opt/graphite/webapp/graphite/render/views.py 2021-10-13 20:11:51.136487024 +0000
@@ -73,6 +73,8 @@
'prefetched' : {},
'xFilesFactor' : requestOptions['xFilesFactor'],
'maxDataPoints' : requestOptions.get('maxDataPoints', None),
+ 'maxStep': requestOptions.get('maxStep', None),
+ 'targets_serialized': requestOptions.get('targets_serialized', None),
}
data = requestContext['data']
@deniszh
deniszh / compressPeriodicGaps.patch
Last active Oct 13, 2021
compressPeriodicGaps.patch
View compressPeriodicGaps.patch
--- functions.py.bak
+++ functions.py
@@ -151,6 +151,41 @@
return (seriesList)
+def _compressPeriodicGaps(series):
+ # removing periodic gaps, using summarize(seriesList, '<desired step>', 'last')
+ # but trying to auto detect step by first three existing values
+ consolidate = series.consolidationFunc
View compressgaps.patch
--- functions.py.bak
+++ functions.py
@@ -2139,6 +2139,8 @@
"""
results = []
for series in seriesList:
+ # applying _compressGaps() first
+ series = _compressGaps(series)
newValues = []
prev = None
@deniszh
deniszh / salt-2019.2-security.patch
Last active May 6, 2020
Fixes for CVE-2020-11651 and CVE-2020-11652 for Salt 2019.2 branch
View salt-2019.2-security.patch
# use https://github.com/deniszh/salt-security-backports instead
@deniszh
deniszh / salt-2015.5-security.patch
Last active May 6, 2020
Fixes for CVE-2020-11651 and CVE-2020-11652 for Salt 2015.5 branch
View salt-2015.5-security.patch
# use https://github.com/deniszh/salt-security-backports instead
@deniszh
deniszh / CVE-2020-11651-11652.sls
Created Apr 30, 2020
How to patch Salt by salt
View CVE-2020-11651-11652.sls
{% if grains.saltversion == "2016.11.6" %}
# Just in case there is no patch command installed
patch:
pkg.installed
# We use directory name here (saltpath) to apply patches that touch multiple files
saltmaster_security_patch:
file.patch:
- name: '{{ grains.saltpath }}'
@deniszh
deniszh / salt-2016.11-security.patch
Last active May 6, 2020
Fixes for CVE-2020-11651 and CVE-2020-11652 for Salt 2016.11 branch
View salt-2016.11-security.patch
# use https://github.com/deniszh/salt-security-backports instead
View oom_killer_stat.mtail
counter processes_oom_killed_total
counter processes_oom_killed_by_name by label
/Killed process (\d+) \((\S+)\) total-vm:\d+kB, anon-rss:\d+kB, file-rss:\d+kB$/ {
processes_oom_killed_total++
processes_oom_killed_by_name[$2]++
}
@deniszh
deniszh / set_nofile_limit.c
Created Nov 13, 2018 — forked from carlhoerberg/set_nofile_limit.c
Set nofile limit for a running process
View set_nofile_limit.c
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/resource.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \
} while (0)