This presentation discusses how you can use a script to synchronize ticket due dates from the Spiceworks database into a more meaningful format, i.e. Outlook or other iCAL supporting applications.
Citation preview
1. Using Scheduled Tasks and ICALto keep track of ticket due
dates
2. Set your due now what?dates
3. Using due dates can help you keep track of upcoming
oroverdue tickets.The biggest problem people face with due dates
inSpiceworks: you must be working within the Spiceworksapplication
to view these ticket due dates and act uponthem.
4. The best way would be to somehow import these dates
intoOutlook, PHPiCalendar, iCal, etc
5. Due dates can be queried from the Spiceworks
databaseSpiceworks (since 5.0) locks the entire database
frequentlyduring normal operation, so a direct DB query isnt
viable.We must then make a copy of the spiceworks_prod.db fileto
query from instead.
6. Make a copy of the spiceworks_prod.db database to
analternate locationQuery the database copy for any open tickets
with duedatesWrite ticket information as calendar events into
aniCalendar (*.ICS) fileCopy calendar file to another location to
be viewed byadmin staff or used by other applications
7. iCalendar is a computer file format which allows
Internetusers to send meeting requests and tasks to other
Internetusers, via email, or sharing files with an extension of
.ics.iCalendar is used and supported by a large number ofproducts,
including Google Calendar, Apple Calendar(formerly iCal), GoDaddy
Online Group Calendar, IBMLotus Notes, Yahoo! Calendar, Evolution
(software), eMClient, Lightning extension for Mozilla Thunderbird
andSeaMonkey, and partially by Microsoft Outlook and
NovellGroupWise. http://en.wikipedia.org/wiki/Icalendar
8. Disk space for copy of the Spiceworks database
(spiceworks_prod.db) SQLite3 ODBC Driver (64 or 32-bit, depending
on server architecture) Sync due dates to ICS script from
Spiceworks Community Folder for calendar file to be accessed by
people who care about due dates(!) A scheduled task which will copy
your database and then run the synchronization script
9. 1. Create two folders, one for the copy of the Spiceworks
database, another for the sync script2. Create a batch file which
copies the database this will be used in a scheduled task later.3.
Perform a one-time manual copy of spiceworks_prod.db to destination
folder so we can create an ODBC connection later (DSN).
10. On your Spiceworks server, create c:scripts and
c:sqlitedbdb
11. Create a new batch file to copy your database, well use it
in a scheduled tasklater. Save this file in the c:scripts
folder.
12. Copy your spiceworks_prod.db file to c:sqlitedbdb, this is
where well point ourOBDC Connector (aka DSN) later
13. Where the magic happens
14. The script queries your offline copy of spiceworks_prod.db
for any open tickets from the last 30 days with due dates
(configurable). The script then writes individual calendar entries
to a text file called spiceworks.ics in the same folder where the
script resides. Once all tickets with due dates have processed, the
calendar file will be moved to the destination folder. If the
folder is shared, admin staff can import the calendar into their MS
Outlook (2007 and above), Thunderbird or iCal clients to view. Note
the calendar is read-only.
15. 1. Download and install SQLite ODBC drivers (respecting CPU
architecture)2. Prepare a folder where your calendar (ICS) file
will end up (this can be on the same server), i.e. c:scriptsics3.
Download and tweak the Synchronization script (tell it where to
write the calendar file)4. Create new SQLite3 ODBC Connection (DSN)
pointing at our new copy of the offline spiceworks_prod.db file5.
Test the script
16. Download and install the SQLite3 ODBC driver
fromhttp://www.ch-werner.de/sqliteodbc/
17. From the Administrative Tools in the Control Panel, open
DataSources, click the System DSN tab, then click Add
18. Name this DSN Spiceworks, then under Database Name,browse
to the offline copy of spiceworks_prod.db underc:sqlitedbdb, click
OK.
19. Download the sync script from http://goo.gl/lMf0N
(SpiceworksScript Center)
20. When downloaded, the file will save with a .txt
extension.Rename it to synctickets.vbs in your c:scripts
folder.
21. Open the synctickets.vbs file with a text editor, youll
need to edit thevariables sPathToSpiceworks and sPublishToPath any
others areoptional.
22. Open your database copy batch file from c:scripts. Lets add
a line to run thenewly downloaded synctickets.vbs script after the
database copy is executed(you will want to call it with
cscript.exe).Add Call cscript.exe c:scriptssynctickets.vbs to your
batch file and save.
23. From Accessories > System Tools, open the Task
Scheduler.Note this is called Scheduled Tasks on Windows
XP/2003
24. Make sure the account you use to run the task has
appropriatepermissions to get to the original Spiceworks database
and to thefolder where you will write the ICS file.
25. From the Triggers tab, set up your schedule to execute
oncedaily, repeating every 10 or 30 minutes (your time may
differdepending on your needs)
26. Under the Actions tab, select your batch file you created
earlier.
27. Right click your new scheduled task and select Run. Wait
aminute or so.Look at the output folder where you told the script
to write the ICSfile.
28. Look in your c:sqlitedbdb folder. You should see a
recentlyupdated version of the Spiceworks_prod.db file.
29. 1. From a computer where MS Outlook 2007 or newer is
installed, browse to the folder where the calendar file is stored2.
Double-click the file, Outlook should recognize it and import it as
a calendar3. Added bonus: If you have a relatively modern
smartphone synchronizing with your Exchange server (if you have
one), the calendar should also show up on your mobile device!
30. Not only can you use this database copy to retrieve due
dates, but you can query the data for external reporting like
Excel, Crystal Reports, MS Access, etc. You can set up other web
services internally that utlize ICS files like PHPiCalendar so
non-Spiceworks users can view the calendar through a web browser As
an alternative to using Windows file copy, you could use DeltaCopy,
a Windows port of rsync, which is very efficient at copying larger
files
31. Rob Dunn Rob Dunn in the Spiceworks CommunityEmail:
[email protected]