Skip to content

Instantly share code, notes, and snippets.

yang wzyuliyang

Block or report user

Report or block wzyuliyang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ansible-test-yaml-in-template.py
import yaml
from jinja2 import Template
template = Template("""
{% if users is defined and users %}
{% for user in users %}{{ user }}
{% endfor %}
{% endif %}
""")
View admin-rest-api.java
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
public class Main {
@wzyuliyang
wzyuliyang / pyenv.sh
Created Oct 14, 2016 — forked from clozed2u/pyenv.sh
Install python 2.7.10 with pyenv on centos 7
View pyenv.sh
# install python 2.7.10 with pyenv on centos 7
yum install -y gcc gcc-c++ make git patch openssl-devel zlib-devel readline-devel sqlite-devel bzip2-devel
git clone git://github.com/yyuu/pyenv.git ~/.pyenv
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> .bashrc
echo 'eval "$(pyenv init -)"' >> .bashrc
pyenv install 2.7.10
pyenv global 2.7.10
View ceph-graphite.py
#!/usr/bin/env python
import time
import socket
import subprocess
import json
graphite_host = 'my.graphite.machine'
graphite_port = 2003
prefix = 'ceph'
@wzyuliyang
wzyuliyang / ceph-rest-api.wsgi
Created Oct 11, 2016 — forked from wido/ceph-rest-api.wsgi
Ceph REST API WSGI wrapper
View ceph-rest-api.wsgi
'''
WSGI wrapper for the Ceph REST API to be run behind Apache with mod_wsgi.
Place this script in /var/www as ceph-rest-api.wsgi and use this VirtualHost:
<VirtualHost *:80>
DocumentRoot /var/www
ServerName ceph-rest-api
ErrorLog /var/log/apache2/error.log
@wzyuliyang
wzyuliyang / ceph-graphite-pool-stats.py
Created Oct 11, 2016 — forked from wido/ceph-graphite-pool-stats.py
Send Ceph pool statistics to Graphite
View ceph-graphite-pool-stats.py
#!/usr/bin/env python
'''
This script gathers pool statistics from RADOS and sends them to a Graphite server
It allows you to graph and see what each pool is doing.
Author: Wido den Hollander <wido@widodh.nl>
'''
View ceph-udev-disk-scheduler.rules
# udev rule to set disk schedulers for Ceph
# For spinning disks we want the CFQ scheduler so that we can set
# priorities on client and recovery I/O threads
#
# Author: Wido den Hollander <wido@42on.com>
# Date: July 2015
# Use deadline for SSDs
ACTION=="add|change", KERNEL=="sd[a-z]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"
@wzyuliyang
wzyuliyang / nginx-radosgw.conf
Created Oct 11, 2016 — forked from wido/nginx-radosgw.conf
Nginx proxy for Ceph RADOS Gateway with Civetweb
View nginx-radosgw.conf
server {
listen 80;
listen [::]:80;
server_name localhost;
client_max_body_size 0;
proxy_buffering off;
proxy_set_header Host $host;
@wzyuliyang
wzyuliyang / ceph-health.py
Created Oct 11, 2016 — forked from wido/ceph-health.py
Ceph Health in Python in a loop
View ceph-health.py
#!/usr/bin/env python
import time
import rados
import json
def get_cluster_health(r):
cmd = {"prefix":"status", "format":"json"}
ret, buf, errs = r.mon_command(json.dumps(cmd), b'', timeout=5)
result = json.loads(buf)
@wzyuliyang
wzyuliyang / ceph-upgrade-hammer-jewel.sh
Created Oct 11, 2016 — forked from wido/ceph-upgrade-hammer-jewel.sh
Ceph upgrade OSD from Hammer to Jewel
View ceph-upgrade-hammer-jewel.sh
#!/bin/bash
#
# Script for updating a running Ceph Hammer cluster to Jewel
#
# This has to be run on the OSD node(s) as root
#
# Written for and tested on CentOS 7
#
# Used to upgrade Ceph at ODC-Noord in the Netherlands
#
You can’t perform that action at this time.