Skip to content

Instantly share code, notes, and snippets.

View himynamesdave's full-sized avatar

David G himynamesdave

View GitHub Profile
@himynamesdave
himynamesdave / cpu.sh
Last active August 29, 2015 14:01
Splunk Raspberry Pi CPU Monitor
#! /bin/sh
for c in $(seq 1 60)
do
TIME=$(date +"%D %T.%3N %Z")
TEMP=$(vcgencmd measure_temp)
VOLTS=$(vcgencmd measure_volts)
CPU_TEMP=`echo $TEMP | cut -d \' -f 1`
VOLTS=`echo $VOLTS | cut -d V -f 1`
echo "time=$TIME|$VOLTS|$CPU_TEMP"
sleep 1
@himynamesdave
himynamesdave / myfirstpage.html
Created May 20, 2014 14:47
Intro to creating pages using the Splunk Web Framework
{% extends "splunkdj:base_with_app_bar.html" %}
{% load splunkmvc %}
{% block content %}
<div id="barchart"></div>
{% endblock content%}
{% block js %}
<script>
var deps = [
@himynamesdave
himynamesdave / inputs.conf
Created May 24, 2014 10:41
example twitter input for splunk REST API modular input
[rest://Twitter Follow @himynamesdave]
auth_type = oauth1
delimiter = ^
endpoint = https://stream.twitter.com/1.1/statuses/filter.json
host = TwitterAPI
http_method = GET
index_error_response_codes = 0
oauth1_access_token = YOUR_ACCESS_TOKEN
oauth1_access_token_secret = YOUR_ACCESS_TOKEN_SECRET
oauth1_client_key = YOUR_CLIENT_KEY
@himynamesdave
himynamesdave / inputs.conf
Last active August 29, 2015 14:01
example foursquare input for splunk REST API modular input
[rest://Foursquare Checkins himynamesdave]
auth_type = none
endpoint = https://api.foursquare.com/v2/users/self/checkins
host = FourquareAPI
http_method = GET
index_error_response_codes = 1
response_handler = FourSquareCheckinsEventHandler
response_type = json
sourcetype = FoursquareCheckin
streaming_request = 0
<dashboard>
<label>AirPi Feeds</label>
<row>
<panel>
<chart>
<title>Current Temperature</title>
<searchString>index=rpi | fields Temp_BMP | head 1</searchString>
<earliestTime/>
<latestTime/>
<option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisNone</option>
@himynamesdave
himynamesdave / splunk-dashboard-for-nexonia-expenses.xml
Created November 12, 2014 21:46
A Splunk Dashboard for tracking Nexonia Expenses
<form>
<label>Nexonia Expenses</label>
<fieldset submitButton="false">
<input type="time" token="field1" searchWhenChanged="true">
<label>Time Range</label>
<default>
<earliestTime>0</earliestTime>
<latestTime/>
</default>
</input>
@himynamesdave
himynamesdave / inputs.prop
Created March 19, 2015 15:49
Splunk inputs.conf file to be used with REST Modular input for analytics.usa.gov - more here: http://wp.me/pMBBy-5DV
[rest://people online right now p60s]
auth_type = none
endpoint = https://analytics.usa.gov/data/live/realtime.json
http_method = GET
index_error_response_codes = 0
polling_interval = 60
response_type = json
sourcetype = _json
streaming_request = 0
@himynamesdave
himynamesdave / view.xml
Created March 19, 2015 21:19
Splunk Simple XML Dashboard for analytics.usa.gov data
<dashboard>
<label>analytics.usa.gov</label>
<row>
<panel>
<single>
<title>Visitors Online Now</title>
<search>
<query>sourcetype="_json" source="rest://people online right now 1min"| stats latest("data{}.active_visitors") as "Active Visitors"</query>
<earliest>rt-1m</earliest>
<latest>rt</latest>
@himynamesdave
himynamesdave / responsehandler.py
Created May 15, 2015 19:41
Instagram Response Handler for REST API Modular Input
class InstagramFollowedByEventHandler:
def __init__(self,**args):
pass
def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
if response_type == "json":
output = json.loads(raw_response_output)
last_indexed_id = 0
@himynamesdave
himynamesdave / props.conf
Created June 22, 2015 19:09
CDC birth record extractions for US and Territories datasets from 2003-current.
[cdc_births_2003]
MAX_DAYS_AGO=36500
TIME_FORMAT=%Y%m %H%M%d
TIME_PREFIX=.{14}
disabled=false
pulldown_type=true
SHOULD_LINEMERGE = false
category = Custom
description = "CDC birth record extractions for US and Territories datasets from 2003-current. Slight hack in that day is grouped by first 7 days of month as records only contain weekday of birth, not day of month for birth."
#