Skip to content

Instantly share code, notes, and snippets.

@trekr5
trekr5 / gist:443153c50cbe0480eb72
Created June 2, 2015 17:45
Edit New issue Graph not updating and average values remains the same because dataset contains two values when it should contain 360.
Hello,
I have followed the instructions for installing this widget and wish to use this to display my data which would be over 1 hour at 1 minute intervals. The graph isn't updating and the average value never changes.
When I do a console.log to see what the variables dataset contain, I can see that there are only two elements in this array with values that bare no resemblance to my dataset. I have a dataset that contains 360 datapoints, 6 for every minute so I would expect to see the average being sum total of datapoints/360 and the sparklines chart to show those 360 datapoints. Is that the way the coffeescript code is supposed to work? Please correct me if I'm wrong.
I have the following timer.coffee file:-
`class Dashing.Timer extends Dashing.Widget
#!/bin/bash
# Dashing service
# Add this file to /etc/init.d/
# $ sudo cp dashboard /etc/init.d/
# Update variables DASHING_DIR, GEM_HOME, & PATH to suit your installation
# $ sudo nano /etc/init.d/dashboard
# Make executable
# $ sudo chmod 755 /etc/init.d/dashboard
# Update rc.d
# $ sudo update-rc.d dashboard defaults
curl -XGET 'localhost:9200/logstash-2015.04.30/_search?pretty' -d '{
"facets": {
"3": {
"date_histogram": {
"field": "@timestamp",
"interval": "1m"
},
"global": true,
"facet_filter": {
"fquery": {
@trekr5
trekr5 / gist:5f2ff2a7f3791918a0dd
Last active August 29, 2015 14:20
My elasticsearch query
client = Elasticsearch::Client.new hosts: [{host: 'localhost:9200', port: 9200}]
value = client.search index: logstash_date,
body: {
"facets"=> {
"0"=> {
"date_histogram"=> {
"field"=> "@timestamp",
"interval"=> "15m"
@trekr5
trekr5 / gist:e7e9deb528800a4775ee
Created March 30, 2015 10:24
chefspec test to ensure that decrypted databag returns data
require 'spec_helper'
describe 'core::local_users_linux' do
let (:chef_run) { ChefSpec::SoloRunner.new.converge('core::local_users_linux') }
let(:databag){Chef::EncryptedDataBagItem.load("aws-admin-passwords", "svc_goagent")}
before do
allow(databag).and_return({
it\cookbook-core>vagrant provision windows
windows: Loading Berkshelf datafile...
windows: Sharing cookbooks with VM
windows: Updating Vagrant's Berkshelf...
windows: Resolving cookbook dependencies...
windows: Fetching 'core' from source at .
windows: Using apt (2.6.1)
windows: Using chef-client (4.2.4)
windows: Using chocolatey (0.2.1) from https://github.com/chocolatey/chocolatey-cookbook.git (at master)
windows: Using chef_handler (1.1.6)
def remove_login_rights(user)
cookbook_file "ntrights.exe" do
source "ntrights.exe"
path "/windows/temp"
mode '0644'
action :create_if_missing
notifies :run, 'execute[remove-right]', :immediately
end
execute "remove-right" do
def remove_login_rights(user)
cookbook_file "ntrights.exe" do
source "ntrights.exe"
path "C:/users/#{user}"
mode '0644'
action :create_if_missing
notifies :run, 'execute[remove-right]', :immediately
end
@trekr5
trekr5 / gist:d4cd96a032a819dc93e3
Created March 23, 2015 18:46
restriction of access
def svc_create_user(user,shadow_password)
user user do
supports :manage_home => true
comment "chef created service user: #{user}"
home "/home/#{user}"
shell 'usr/sbin/nologin'
action :create
end
@trekr5
trekr5 / gist:a00d8622300fb83a954f
Created March 16, 2015 11:39
local_users_spec.rb
describe 'core::local_users' do
before (stub_resources)
let (:chef_run) do
ChefSpec::SoloRunner.new do |node, server|
env = Chef::Environment.new
env.name 'my_environment'
env.override_attributes(encrypted_data_bag_secret_key_path: 'C:/tmp/vagrant-chef-2/encrypted_data_bag_secret')
allow(server).to receive(:encrypted_data_bag_secret_key_path).and_return(env.override_attributes)