Skip to content

Instantly share code, notes, and snippets.

Avatar

Giovanni Torres giovtorres

View GitHub Profile
@giovtorres
giovtorres / bootstrap-role-vagrant.sh
Created Sep 20, 2017
Bootstrap files for a new ansible role after running `ansible-galaxy init` (Vagrant)
View bootstrap-role-vagrant.sh
#/bin/bash
# Bootstrap files for a new ansible role after running `ansible-galaxy init`
echo "[+] Checking for .gitignore..."
if [ ! -f ".gitignore" ]; then
echo "[+] Not found. Creating .gitignore..."
cat > .gitignore << _EOF_
__pycache__
*.pyc
@giovtorres
giovtorres / virt-install-centos
Last active Dec 14, 2020
Install CentOS cloud images on KVM using cloud-init
View virt-install-centos
#!/bin/bash
## **Updates to this file are now at https://github.com/giovtorres/kvm-install-vm.**
## **This updated version has more options and less hardcoded variables.**
# Take one argument from the commandline: VM name
if ! [ $# -eq 1 ]; then
echo "Usage: $0 <node-name>"
exit 1
fi
@giovtorres
giovtorres / sysctl_custom.conf
Last active Mar 25, 2017
Custom Sysctl settings
View sysctl_custom.conf
# WARNING: know why you are changing every single sysctl option. Do not blindly change them.
# You need to understand the effects of each setting. For some settings, you may want to
# increment until errors subside, rather than increasing the values to their max values.
# References:
# https://access.redhat.com/sites/default/files/attachments/20150325_network_performance_tuning.pdf
# https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
# Red Hat Tuned profiles
# Adapter Queue
# Maximum number of packets taken from all interfaces in one polling cycle
View slurm_sched_stats_dashboard.json
{
"id": 23,
"title": "SLURM Scheduler Statistics",
"originalTitle": "SLURM Scheduler Statistics",
"tags": [
"Slurm"
],
"style": "dark",
"timezone": "browser",
"editable": true,
@giovtorres
giovtorres / slurm_sched_stats.py
Last active Apr 3, 2020
Graph Slurm's sdiag with PySlurm and Graphite
View slurm_sched_stats.py
#!/usr/bin/python
# vim: set ts=4 sw=4 et
"""
slurm_sched_stats.py
A script that uses PySlurm to get the slurm scheduler statistics.
"""
import pickle
import socket
@giovtorres
giovtorres / __init.py__
Last active Mar 28, 2016
Slurm sdiag wrapped in cython
View __init.py__
from __future__ import absolute_import
import sys
import ctypes
sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)
from .sdiag import *
@giovtorres
giovtorres / .vimrc
Created Feb 25, 2016
My VIM rc file
View .vimrc
set background=dark
set number
set cursorline
set showmatch
" default
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
@giovtorres
giovtorres / graphite.conf
Last active Dec 31, 2015
Run Graphite behind uwsgi + nginx in a subpath/subdirectory/non-root path
View graphite.conf
# This is the config I used for nginx to proxy graphite via uwsgi to a non-root path.
#
# Graphite is a stubborn Django app that must reside at the DocumentRoot level
# and is not readily moved to a subpath.
#
# The following config allows you to reach the graphite composer at
# http://HOSTNAME/graphite. The graphite will redirect all URLs back at the top
# level, so the remaining locations handle those and pass them back to the
# uwsgi server.
#
@giovtorres
giovtorres / send-cluster-util.py
Created Dec 31, 2015
Push slurm cpu and memory cluster utilization to a carbon (graphite) instance for graphing
View send-cluster-util.py
#!/usr/bin/python
# vim: set ts=4 sw=4 et
"""
send_cluster_util.py - A script that will get CPU and Memory utilization
for a SLURM cluster and submit it directly to carbon's
pickle listener port.
http://graphite.readthedocs.org/en/latest/feeding-carbon.html#the-pickle-protocol
"""
View show-cluster-util.py
#!/usr/bin/python
"""
show-cluster-util
This script uses the Python SLURM bindings to get cluster utilization,
which accounts for nodes being allocated exclusively or totally allocated.
"""
import hostlist