Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save clonemeagain/846abb02c9507bdc62d4440ac37a2103 to your computer and use it in GitHub Desktop.
Save clonemeagain/846abb02c9507bdc62d4440ac37a2103 to your computer and use it in GitHub Desktop.
Monitoring osTicket unassigned and open ticket count with Nagios3
An example service definition for nagios that assumes you have the following information:
$DATABASE_{HOST,NAME,USER,PASS} for connecting to the database
$DOMAIN = to create a Nagios link
$PREFIX = what you used to prefix your db in osTicket (commonly ost)
Ensure check_mysql_query is installed and working, create a read-only db-user from your nagios host to your database,
tweak the open and unassigned ticket count to your liking, in this example 100 = warning, 250 = critical
define service {
host_name $DATABASE_HOST
service_description OsTickets Open Tickets
use generic-service
check_command check_mysql_query!"SELECT COUNT(*) FROM $PREFIX_ticket WHERE status='open' AND staff_id=0"!"$DATABASE_USER"!"$DATABASE_PASS"!"$DATABASE_NAME"!100!250
action_url https://$DOMAIN/support/scp/tickets.php
register 1
}
@clonemeagain
Copy link
Author

I'm a fan of both osTicket and Nagios, thought I'd share how I monitor one from tother.. I'm sure there is a way of creating tickets from nagios alerts too, but I haven't used that yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment