I released a package SQL-to-Graphite that aims to easily save the results of SQL queries into Graphite.
We use this and similar scripts (I'm going to move over to using this) at work
in order to collect global metrics about our systems. I typically count any table
that has a status
column and the average/max age of any records that should
be updated periodically.
I made this package once I hit the second repository where I would have to write a script to do this. It should be compatible with any database supported by SQLAlchemy.
After installing (pip install sql-to-graphite
) you can run the sql-to-graphite
command.
With a file like:
And start getting metrics into Graphite!
While investigating our MongoDB lock ratio I was asking around to see what common lock percentages were among those who I know use MongoDB. I discovered that despite having similar setups to what we are using that they didn't know how to get the lock percentage from Graphite.
Using Diamond you can easily get all
of the MongoDB server
status metrics into
Graphite but the globalLock.ratio
is a bit misleading in that it is based on
the total uptime of Mongo, which could be a while, and not on recent usage
patterns. And in 2.2 it disappears anyway!
The metrics that are included though that help are globalLock.totalTime
and
globalLock.lockTime
which can be used to find the lock ratio/percentage over
whatever sampling period you use.
The percentage winds up being
scale(divideSeries(derivative(servers.MONGOHOSTNAME.MongoDBCollector.globalLock.lockTime),derivative(servers.MONGOHOSTNAME.MongoDBCollector.globalLock.totalTime)),100)
.
You can remove the scale
function to get the ratio. This doesn't work with
globbing in Graphite though. You can scale the lockTime
though to be able to
get a globbable lock ratio for all of your Mongo servers, the exact value will
depend on the sampling period.
I noticed recently that my site didn't have the icon anymore. I'm
not sure when I lost it but to add it back I just added the
link
field that
lets browsers know where my Atom feed is. Simple enough to add <link type="application/atom+xml" rel="alternate" href="/atom.xml"/>
to the head
of the page.