Skip to content

Instantly share code, notes, and snippets.

Installing Graphite:

Graphite does two things:

  1. Store numeric time-series data
  2. Render graphs of this data on demand

What Graphite does not do is collect data for you, however there are some tools out there that know

#!/usr/bin/env python
# Parse disk:* from lshw -xml
"""
Sample Output:
ATA Disk Hitachi HDS72105 /dev/sda
Disk Space: 500107862016
Sector size: 512
@ri0day
ri0day / datatables.py
Last active August 29, 2015 14:14 — forked from pebreo/datatables.py
"""
http://datatables.net/forums/discussion/13679/working-code-for-server-side-paging-filtering-sorting-for-python-flask-mongodb
I wrote a python script for implementing server-side DataTables using python, flask, and mongodb. It works very well for me, so I thought I'd share the code for anyone that needs it. Below is the script generalized as a template for you guys.
by luv_tables
January 2013
"""
from collections import namedtuple
from pymongo import MongoClient
{
"description": "MyGroup allowed access to MyProject only",
"context": {
"application": "rundeck"
},
"for": {
"project": [
{
"match": {
"name": "MyProject"
function prompt_func() {
previous_return_value=$?;
prompt="\h:\W \u"
if test $previous_return_value -eq 0
then
PS1="${prompt}🍺 "
else
PS1="${prompt}💩 "
fi
}
<div>Execution ${execution.id} was <b>${execution.status}</b></div>
<ul>
<li><a href="${execution.href}">Execution result</a></li>
<li><a href="${job.href}">Job</a></li>
<li><a href="${execution.projectHref}">Project: ${execution.project}</a></li>
<li><a href="${rundeck.href}">Rundeck</a></li>
</ul>
<p>
</p>
dignan:rundeck greg$ curl -O -J -H 'x-rundeck-auth-token:Do4d3NUD5DKk21DR4sNK755RcPk618vn' http://localhost:4440/api/11/project/ABC/export
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 237k 0 237k 0 0 71132 0 --:--:-- 0:00:03 --:--:-- 71138
curl: Saved to filename 'ABC-20140225-181150.rdproject.jar'
dignan:rundeck greg$

resty example, copy project config to a new project:

resty http://localhost:4440/api/11 -H 'x-rundeck-auth-token: ...'

json:

GET /project/NAME.json | jq '{ "name": ("NEWNAME"), config:.config }' | POST /projects -H 'content-type:application/json'

xml:

[
{
id: "locahost",
description: "Rundeck server node",
hostname: "localhost",
osArch: "x86_64",
osFamily: "unix",
osName: "Mac OS X",
osVersion: "10.6.6",
tags: ''
#!/bin/bash -e
#set to correct path to xmlstarlet
XMLSTARLET=/usr/local/bin/xml
# xmlstarlet select xpath
# usage: xmlsel XPATH file
xmlsel(){
xpath=$1
shift
$XMLSTARLET sel -T -t -v "$xpath" $*