Skip to content

Instantly share code, notes, and snippets.

View Andersson007's full-sized avatar

Andrew Klychkov Andersson007

  • Red Hat, @ansible
  • The Czech Republic, Brno
View GitHub Profile
@Andersson007
Andersson007 / issue_copier.py
Last active April 7, 2020 06:26
Copy issue from a repo to another one.
#!/usr/bin/python3
# Copyright: (c) 2020, Andrew Klychkov (@Andersson007) <aaklychkov@mail.ru>
# MIT License
#
# Requirements:
# 1. pip3 install PyGithub
# 2. GitHub access token
#
# Example:
# ./issue_copier.py -t your_github_token_here \
@Andersson007
Andersson007 / pg_query_inform.py
Last active October 2, 2019 12:10
The script shows or sends notification about slow or idle-in-transaction queries
#!/usr/bin/python3
# pg_query_inform.py - shows or sends notification about slow
# or idle-in-transaction queries.
# (functionality will be added if necessary)
# use pg_query_inform.py -h to show syntax
#
# Author: Andrew Klychkov aaklychkov@mail.ru
# Version: 0.2
# Date: 2019-10-02
# License: Copyleft free software
@Andersson007
Andersson007 / pgdump_check.py
Created July 31, 2018 07:10
The script checks postgres dump and sends mail notification about status and statistic
#!/usr/bin/python
# pgdump_check.py - checks postgres dump and
# sends mail notification about status and statistic
#
# Author: Andrey Klychkov aaklychkov@mail.ru
# Version: 1.0
# Date: 2018-07-31
# Licence: Copyleft free software
# Requirements:
# * Python 2.6;
@Andersson007
Andersson007 / space_stat.py
Last active September 10, 2019 08:54
The script collects, analyzes and sends a mail notification about filesystem space situation.
#!/usr/bin/python3
# space_stat.py - collects, analyses and sends
# a mail notification about filesystem space situation
#
# Author: Andrey Klychkov aaklychkov
# Version: 1.0
# Date: 2018-07-26
# Licence: Copyleft free software
# Requirements: Python3+
#
@Andersson007
Andersson007 / pg_stat_growth_tables.py
Last active July 26, 2018 05:34
The script collects statistics about size growth of tables, saves it to stat files, calculate stat and sends a mail notification
#!/usr/bin/python
# pg_stat_growth_tables.py - Collects statistics
# about growth of table size, saves it to stat files,
# calculate stat and sends a mail notification that contents of:
# 1) top tables by size
# 2) top tables by 1 day growth (with a difference)
# 3) similar lists for 7 days and 30 days
#
# Also you can set up growth percentage threshold
# (GROWTH_PRSTG_ALERT in Main params section below).
@Andersson007
Andersson007 / schema_check.py
Last active April 11, 2018 12:49
The script checks changes of a Postgresql database schema and send notifications about it.
#!/usr/bin/python
# schema_check.py -
# Checks changes of a Postgresql database schema
# and send notifications about it.
#
# It may be critical for some cases
# (running logical replication, for example)
#
# Author: Andreyk Klychkov aaklychkov@mail.ru
# Licence: Copyleft free software
@Andersson007
Andersson007 / print_bloat.py
Last active April 5, 2018 09:35
The script prints top of bloated indexes with stat.
#!/usr/bin/python
# print_bloat.py - Print top of bloated indexes with stat
# Author: Andreyk Klychkov aaklychkov@mail.ru
# Licence: Copyleft free software
# Syntax: ./print_bloat.py <dbname>
# Date: 23-03-2018
#
# Requirements: python2+, psql and postgres (installed locally),
# run it as 'postgres' user
#
@Andersson007
Andersson007 / pg_tbl_idx_stat.py
Last active April 11, 2018 12:54
The script shows postgresql indexes of a passed table with their size and some table statistics.
#!/usr/bin/python3
# pg_tbl_idx_stat.py - The script shows postgresql indexes
# of a passed table with their size and some table statistics
#
# Author: Andrey Klychkov aaklychkov@mail.ru
# Date: 23-03-2018
# Licence: Copyleft free software
# Requirements: python3, psql and postgres (installed locally),
# run as 'postgres' user
#