Skip to content

Instantly share code, notes, and snippets.

View niklibrato's full-sized avatar

Deprecated niklibrato

View GitHub Profile
@niklibrato
niklibrato / pingdom-checks.py
Created March 31, 2020 20:42
Create Pingdom check by Iterating through a list of IP addresses in a csv file and POSTing them to Pingdom
#!/usr/bin/env python
import requests
import csv
# Get your Pingdom Bearer token from https://my.pingdom.com/app/api-tokens or create a new one
bearer_token = 'secretpingdombearertoken'
url = "https://api.pingdom.com/api/3.1/checks"
headers = {'content-type': 'application/json'}
@niklibrato
niklibrato / pingdom-checks.py
Created March 31, 2020 20:42
Create Pingdom check by Iterating through a list of IP addresses in a csv file and POSTing them to Pingdom
#!/usr/bin/env python
import requests
import csv
# Get your Pingdom Bearer token from https://my.pingdom.com/app/api-tokens or create a new one
bearer_token = 'secretpingdombearertoken'
url = "https://api.pingdom.com/api/3.1/checks"
headers = {'content-type': 'application/json'}

Keybase proof

I hereby claim:

  • I am niklibrato on github.
  • I am niklibrato (https://keybase.io/niklibrato) on keybase.
  • I have a public key ASBOdjKAmlNN5YeS4QuRmiPMEAQ6BoyEYSDu1lXHegp0Ywo

To claim this, I am signing this object:

#!/usr/bin/env bash
#download a 5MB file from http://www.thinkbroadband.com/download.html
while true; do
curl --stderr test.txt http://ipv4.download.thinkbroadband.com/5MB.zip > 5MB.zip
speed=$(cat test.txt | awk '{gsub(/\r/,"\n")};1' | awk 'END{print $7}')
multiplier=$(echo $speed | awk '{print substr($1,length($1),1)}')
value=$(echo $speed | awk '{sub(/k/,"")};1')
if [[ "$multiplier" == "k" ]] ; then value=$value"000" ; elif [[ "$multiplier" == "M" ]] ; then value=$value"000000" ; fi
#delete the file
@niklibrato
niklibrato / red-node_librato-post.json
Created June 2, 2016 01:16
Use Node-Red http request to send metrics to Librato
[{"id":"cf452056.f2f35","type":"inject","z":"a2e7ef47.d8313","name":"measure_time","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":169.5,"y":119,"wires":[["71751e63.43b1c"]]},{"id":"71751e63.43b1c","type":"function","z":"a2e7ef47.d8313","name":"librato_payload","func":"function getRandomInt(min, max) { \n return Math.floor(Math.random() * (max - min +1)) + min; \n}\n\nvar value = getRandomInt(1, 10);\nvar measure_time = Math.round(msg.payload / 1000);\nmsg.payload = {\n \"gauges\": [\n {\n \"name\": \"random metric\",\n \"souce\": \"red-node-source\",\n \"value\": value,\n \"measure_time\": measure_time\n }\n ]\n};\nreturn msg;","outputs":1,"noerr":0,"x":427.5,"y":119,"wires":[["6d0496dc.fe1438"]]},{"id":"6d0496dc.fe1438","type":"http request","z":"a2e7ef47.d8313","name":"librato_post","method":"POST","ret":"txt","url":"https://metrics-api.librato.com/v1/metrics","x":718.5,"y":118,"wires":[[]]}]
@niklibrato
niklibrato / graylog2_librato.md
Last active May 24, 2016 15:29
Using Librato with Graylog2

#Using Librato with Graylog2

Graylog2 is able to send your message counts per stream, host and overall to Librato Metrics. You can also send system instrumentation of graylog2-server, but this is disabled by default.

The following configuration options in graylog2.conf control this output:

  • enable_libratometrics_output - true/false
  • enable_libratometrics_system_metrics - true/false Controls sending of internal graylog2-server instrumentation. Great for monitoring all internals of Graylog2, but a lot of metrics.
  • libratometrics_api_user - Your API user. Usually an email address.
  • libratometrics_api_token - Your API token
@niklibrato
niklibrato / old_sdk.md
Last active January 14, 2016 17:38
How to embed charts - old SDK

With our Javascript SDK you can embed Librato graphs in your own applications.

We've leveraged the power of HTML 5 data attributes to make the embedding completely unobtrusive. To get started you'll need to include the SDK and specify your authentication credentials (account name/token) with a <script> tag as follows:

<script type="text/javascript"
    src="https://sdk.librato.com/librato-sdk-v0.5.1-min.js"
    data-librato_email="foo@bar.com"
    data-librato_token="16eb7a5fa3...">
@niklibrato
niklibrato / UserVoiceCSV_html_to_rst.rb
Created January 7, 2016 00:58
Convert UserVoice content (exported to csv) to reStructuredText
#Extract all content from UserVoice - that produces a csv
#extracted two columns from the csv - the section and the article
#run this script on the file with those two columns
# uses https://github.com/alphabetum/pandoc-ruby
require 'pandoc-ruby'
require 'csv'
docs = CSV.read("kb.csv")
@niklibrato
niklibrato / write_http.config
Last active December 2, 2015 17:22
write_http config for CollectdWin pointing at Librato
<WriteHttp>
<Nodes>
<Node Name="collectdwin" Url="https://collectd.librato.com/v1/measurements" Timeout="10000" BatchSize="25" MaxIdleTime="600000" UserName="my@email.com" Password="09ee602bc0secret_tokenb5d5e3d15988f1" SafeCharsRegex="^[a-zA-Z0-9_-]*$" ReplaceWith="_">
<Proxy Enable="false" Url="" />
</Node>
</Nodes>
</WriteHttp>
@niklibrato
niklibrato / collectdWin.config
Last active December 2, 2015 17:22
CollectdWin configuration
<CollectdWinConfig>
<GeneralSettings Interval="60" Timeout="120" StoreRates="false" />
<Plugins>
<Plugin Name="Statsd" Class="BloombergFLP.CollectdWin.StatsdPlugin" Enable="false" />
<Plugin Name="WindowsPerformanceCounter" Class="BloombergFLP.CollectdWin.WindowsPerformanceCounterPlugin"
Enable="true" />
<Plugin Name="Amqp" Class="BloombergFLP.CollectdWin.AmqpPlugin" Enable="false" />
<Plugin Name="WriteHttp" Class="BloombergFLP.CollectdWin.WriteHttpPlugin" Enable="true" />