-
-
Save sax/7663192 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"alias":"graphite", | |
"brand": "joyent", | |
"image_uuid": "84cb7edc-3f22-11e2-8a2a-3f2a7b148699", | |
"max_physical_memory": 512, | |
"resolvers": [ | |
"8.8.8.8", | |
"8.8.4.4" | |
], | |
"nics": [ | |
{ | |
"interface": "net0", | |
"nic_tag": "admin", | |
"gateway": "192.168.2.254", | |
"ip": "192.168.2.203", | |
"netmask": "255.255.255.0" | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0'?> | |
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'> | |
<!-- put in /opt/custom/smf and import using svccfg import /opt/custom/smf/graphite.xml --> | |
<service_bundle type='manifest' name='export'> | |
<service name='graphite/carbon-cache' type='service' version='0'> | |
<create_default_instance enabled='true'/> | |
<single_instance/> | |
<dependency name='net-physical' grouping='require_all' restart_on='none' type='service'> | |
<service_fmri value='svc:/network/physical'/> | |
</dependency> | |
<dependency name='filesystem' grouping='require_all' restart_on='none' type='service'> | |
<service_fmri value='svc:/system/filesystem/local'/> | |
</dependency> | |
<exec_method name='start' type='method' exec='/opt/custom/share/svc/carbon-cache.sh %m' timeout_seconds='0'/> | |
<exec_method name='stop' type='method' exec='/opt/custom/share/svc/carbon-cache.sh %m' timeout_seconds='60'/> | |
<property_group name='startd' type='framework'> | |
<propval name='duration' type='astring' value='transient'/> | |
</property_group> | |
<stability value='Unstable'/> | |
<template> | |
<common_name> | |
<loctext xml:lang='C'>Carbon Cache Default Script</loctext> | |
</common_name> | |
</template> | |
</service> | |
</service_bundle> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imgadm import 84cb7edc-3f22-11e2-8a2a-3f2a7b148699 | |
# adjust ip and stuff in graphite.json | |
vmadm create -f graphite.json | |
zlogin <uuid of machine just created> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### GRAPHITE | |
pkgin in py27-carbon-0.9.10 | |
pkgin in py27-graphite-web-0.9.10 | |
cd /opt/local/lib/python2.7/site-packages/graphite | |
cp local_settings.py.example local_settings.py | |
# | |
# change local_settings.py: | |
# | |
# TIME_ZONE = 'Europe/Berlin' # (timezone based on whatever you need) | |
# | |
# CONF_DIR = '/opt/local/graphite/conf' | |
# STORAGE_DIR = '/opt/local/graphite/storage' | |
# CONTENT_DIR = '/opt/local/graphite/webapp/content' | |
# | |
# also comment in the DATABASE={ ... } part | |
# and change NAME to /opt/local/graphite/storage/graphite.db | |
# | |
# | |
# Note: I read on http://www.spacevatican.org/2012/9/18/using-statsd-and-graphite-from-a-rails-app/ | |
# that | |
# | |
# "When using statsd with its default settings it’s crucial that you keep at least | |
# some 10 second data (the default graphite config keeps 1min resolution data only). | |
# If you don’t then the mismatch between statsd’s flush rate and graphite’s | |
# flush rate will cause you to lose data. " | |
# | |
# That means storage-schemas.conf in /opt/local/etc/graphite should be edited like this: | |
# Add the following to storage-schemas.conf, above the [default_1min_for_1day] section | |
# | |
# [stats] | |
# pattern = ^stats\..* | |
# retentions = 10:2160,60:10080,600:262974 | |
# | |
# [stats_count] | |
# pattern = ^stats_counts\..* | |
# retentions = 10:2160,60:10080,600:262974 | |
# | |
# and edit storage-aggregation.conf by adding before the default entry | |
# | |
# [stats_counts] | |
# pattern = ^stats_counts\. | |
# xFilesFactor = 0 | |
# aggregationMethod = sum | |
# | |
# CONFIGURING CARBON | |
# change the carbon.conf (/opt/local/etc/graphite/carbon.conf) like this | |
# | |
# STORAGE_DIR = /opt/local/graphite/storage | |
# CONF_DIR = /opt/local/etc/graphite | |
# LOG_DIR = /opt/local/graphite/storage/log/carbon-cache | |
# PID_DIR = /opt/local/graphite/storage | |
# | |
# LOCAL_DATA_DIR = /opt/local/graphite/storage/whisper | |
# | |
# STARTING CARBON | |
carbon-cache.py --config=/opt/local/etc/graphite/carbon.conf start | |
cd /opt/local/graphite | |
export LC_ALL="en_US.UTF-8" # imporant for syncdb (otherwise the user creation will fail) | |
#will ask for username and password | |
python /opt/local/lib/python2.7/site-packages/graphite/manage.py syncdb | |
mkdir /opt/local/graphite/storage/log/webapp | |
run-graphite-devel-server.py --libs=/opt/local/lib/python2.7/site-packages/graphite /opt/local/graphite & | |
### STATSD | |
# I INSTALLED IT IN A DIFFERENT MACHINE (with git) and then copied it over to /opt/local/statsd | |
# git clone https://github.com/etsy/statsd | |
# then copy exampleConfig.js into config.js and update ip to 127.0.0.1 | |
cd /opt/local/statsd | |
node stats.js config.js & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var StatsdClient = new require('statsd-client'); | |
console.dir(StatsdClient) | |
var sdc = new StatsdClient({host: '<IP?', port:8125, prefix:"test"}); | |
console.dir(sdc) | |
var timer = new Date(); | |
for (var i = 0; i < 100; i++) { | |
sdc.increment('counter'); // Increment by one. | |
}; | |
sdc.increment('counter'); // Increment by one. | |
sdc.gauge('gauge', 10); // Set gauge to 10 | |
sdc.timing('timer', timer); // Calculates time diff | |
sdc.close(); // Optional - stop NOW |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
forward port 8080 and port 8125 to that machines ip if necessary | |
create a folder for statsd | |
npm install statsd-client | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment