Skip to content

Instantly share code, notes, and snippets.

@giovtorres
giovtorres / virt-install-centos
Last active March 15, 2023 09:57
Install CentOS cloud images on KVM using cloud-init
#!/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 / slurm_core_states.py
Last active July 30, 2020 00:21
Collectd Python plugin to get Slurm's core allocation by state
#!/usr/bin/python
# vim: set ts=4 sw=4 et
"""
slurm_core_states.py - A read plugin that will dispatch the core cpu states
returned by the Slurm sinfo command.
"""
import collectd
import signal
@giovtorres
giovtorres / slurm_sched_stats.py
Last active April 3, 2020 08:41
Graph Slurm's sdiag with PySlurm and Graphite
#!/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
{
"id": 23,
"title": "SLURM Scheduler Statistics",
"originalTitle": "SLURM Scheduler Statistics",
"tags": [
"Slurm"
],
"style": "dark",
"timezone": "browser",
"editable": true,
@giovtorres
giovtorres / .vimrc
Created February 25, 2016 02:10
My VIM rc file
set background=dark
set number
set cursorline
set showmatch
" default
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
@giovtorres
giovtorres / bootstrap-role-vagrant.sh
Created September 20, 2017 12:08
Bootstrap files for a new ansible role after running `ansible-galaxy init` (Vagrant)
#/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 / sysctl_custom.conf
Last active March 25, 2017 11:46
Custom Sysctl settings
# 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
#!/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
@giovtorres
giovtorres / __init.py__
Last active March 28, 2016 00:02
Slurm sdiag wrapped in cython
from __future__ import absolute_import
import sys
import ctypes
sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)
from .sdiag import *
@giovtorres
giovtorres / scontrol-show-node.py
Last active January 2, 2016 04:27
"scontrol show node" in python
#!/usr/bin/python
"""
scontrol-show-node - python equivalent to `scontrol show node`.
It also takes an optional node as an argument.
"""
import sys
from datetime import datetime
from operator import itemgetter