Your SlideShare is downloading. ×
0
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Graphite
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Graphite

118

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
118
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. When In Doubt, Graph It Out
  • 2. Agenda»Why should we graph data?»Overview of Graphite»Shell script example»Java example»Additional tools
  • 3. Why should we graph stuff?
  • 4. Alternatives to Graphite
  • 5. Log filesDEBUG [01-Mar-12 10:36:03] [pool-10-thread-2] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1201584957-8316815-0_mbsDEBUG [01-Mar-12 10:36:03] [pool-10-thread-1] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1306883462-9748970-0-o_mesDEBUG [01-Mar-12 10:36:03] [pool-10-thread-3] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1284651005-4763277-0-8-bmx_mesDEBUG [01-Mar-12 10:36:03] [pool-10-thread-2] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1196567997-8624786d-0_mesDEBUG [01-Mar-12 10:36:03] [pool-10-thread-3] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1284649502-3873052-80503-bmx_mesDEBUG [01-Mar-12 10:36:03] [pool-10-thread-2] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1211339455-1237643d-0_mpsDEBUG [01-Mar-12 10:36:03] [pool-10-thread-1] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1300850840-2087124-0-p_mbsDEBUG [01-Mar-12 10:36:03] [pool-10-thread-1] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1294954750-9188506-0-p_mesDEBUG [01-Mar-12 10:36:03] [pool-10-thread-2] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1196873161-5673618d-0_mpsDEBUG [01-Mar-12 10:36:03] [pool-10-thread-2] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1257526947-2361816-0_mpsDEBUG [01-Mar-12 10:36:03] [pool-10-thread-2] com.pronto.sem.job.BidUpdateRunnable :Processed Row[1700]DEBUG [01-Mar-12 10:36:03] [pool-11-thread-1] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1296091717-9634933-0-md_ysDEBUG [01-Mar-12 10:36:03] [pool-11-thread-3] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1292018269-8694964-0-md_ysDEBUG [01-Mar-12 10:36:04] [pool-10-thread-2] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1189412336-672954-0_mesDEBUG [01-Mar-12 10:36:04] [pool-10-thread-1] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1196829650-9210295d-0-p_mesDEBUG [01-Mar-12 10:36:04] [pool-11-thread-2] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1299102528-4698537-0-md_ysDEBUG [01-Mar-12 10:36:04] [pool-10-thread-1] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1295153899-6527254-0-p_mesDEBUG [01-Mar-12 10:36:04] [pool-10-thread-2] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1257523345-7680668-0_mbsDEBUG [01-Mar-12 10:36:04] [pool-10-thread-3] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1191889434-6754217-0_mpsDEBUG [01-Mar-12 10:36:04] [pool-10-thread-1] com.pronto.sem.manager.impl.BidManagerImpl :Updated keyword bid for: 1292858452-5997889-0-p_mps
  • 6. Cacti (http://report01/dashboard/)
  • 7. Enough talk.What is this Graphite you speak of?
  • 8. http://graphite101/
  • 9. How do we get data into Graphite?»telnet to port 2003»Enter 3 valuesmetric.name value unixtime
  • 10. Example in bash#!/bin/bash# Set this hostnameHOSTNAME=`/bin/hostname --short`# Set Graphite hostGRAPHITE=graphite101GRAPHITE_PORT=2003# Get epochDATE=`/bin/date +%s`# Collect some dataMY_DATA=`/usr/sbin/lsof -u tomcat | /usr/bin/wc -l`# Send data to Graphiteecho "stats.${HOSTNAME}.file_handle.count ${MY_DATA} ${DATE}" | /usr/bin/nc $GRAPHITE $GRAPHITE_PORT
  • 11. Example in Javaimport java.io.OutputStreamWriter;import java.io.Writer;import java.net.Socket;public class GraphiteLogger { private static String GRAPHITE_HOST = "graphite101"; private static int GRAPHITE_PORT = 2003; public static void logToGraphite(String metric, int value) throws Exception { Long timeInSeconds = System.currentTimeMillis() / 1000; Socket socket = new Socket(GRAPHITE_HOST, GRAPHITE_PORT); try { Writer writer = new OutputStreamWriter(socket.getOutputStream()); writer.write(metric + " " + value + " " + timeInSeconds + "n"); writer.flush(); writer.close(); } finally { socket.close(); } } public static void main(String[]args) throws Exception { GraphiteLogger.logToGraphite("stats.test.example.count", 100); }}
  • 12. Where is data stored?/opt/graphite/storage/whisper
  • 13. Other tools
  • 14. logster
  • 15. StatsD
  • 16. graphitejs
  • 17. graphios
  • 18. jmxtrans
  • 19. For more informationhttp://graphite.readthedocs.org/en/1.0/index.html

×