[rt-users] A MRTG script for Request Tracker : MySQL
THAUVIN Blaise (Dir. Informatique FRP)
bthauvin at clearchannel.fr
Mon Apr 29 16:25:49 EDT 2002
Thanks Stephane for your MRTG script.
I have ported it to MySQL quite easily. The steps are :
Install MySQL-python.0.9.1 (can be found at www.mysql.com)
Install Distutils.1.0.2 if your Python version is too old (can be found any
Python archive)
Use the modified script below. Note that SQL statements are case sensitive.
#!/usr/bin/python
# $Id: rt2mrtg.py,v 1.1 2002/04/29 10:59:46 bortzmeyer Exp $
import string
import MySQLdb
dsn = "rt2"
db = MySQLdb.connect(user="rt_user", passwd="xxxx", db=dsn)
st = db.cursor()
st.execute("SELECT count(id) FROM Tickets WHERE status = 'open' OR status =
'new'")
res = st.fetchone()
all_tickets = res[0]
# If you are not using priorities, display something else, such as
# tickets older than a month.
st.execute("SELECT count(id) FROM Tickets WHERE (status = 'open' OR status =
'new') AND priority > 0")
res = st.fetchone()
high_pri_tickets = res[0]
print high_pri_tickets
print all_tickets
print "uptime is not meaningful for Request Tracker"
print "database " + dsn
-----------------------------------------------
The MRTG script provided with the Postgres version does not need any change.
Blaise Thauvin
Blaise at fdn.Fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20020429/16d4000d/attachment.htm>
More information about the rt-users
mailing list