Hi,
Is there a plugin available or a method to trigger an alarm when a new database is created in sql server ?
Thank you!
Hi,
Is there a plugin available or a method to trigger an alarm when a new database is created in sql server ?
Thank you!
Hi,
never heard of triggers for this. Which RDBMS are you inspecting here? Maybe it has a hookable system. On the other hand, it sounds too complicated. I would rather use a simple check which attempts to look for a specific database and fails then. One could use the exists check, and negate that result.
Cheers,
Michael
Hi,
I succeed to make a service-check to count databases older than 24 hours; it’s not exactly what i want but it’s the easier solution .
The result of the query is an integer and i set warning and critical thresholds to 0, which means that every result of the query, 1 or much, will send an critical alarms for 24 hours; then the service-check will be GREEN again.
This is the command of the service-check:
./check_mssql_health --commit --server XXXXX --username XXXxxx --password xxxxxx --mode sql --name ‘SELECT COUNT(*) FROM sys.databases where datediff(hour,create_date,getdate())<24’ --report short --timeout 30 --warning 0 --critical 0 .
The output is not very nice:
CRITICAL - select count(*) from sys.databases where datediff(hour, create_date, getdate())<24: 1
Some “nice to have” is to adjust the output of the service, like :
“OK – No database was created within the last 24 hours.”
“CRITICAL – [value of sql-statement] databases have been created during the last 24 hours.”
Cheers,
Petre
Hehe, I remembered that there was an option for this. Check the docs and look for --name2
.
- –name2 <string>
If you use –mode=sql, the SQL-statement will be shown in the plugin output and the performance data (which looks ugly). The parameter name2 can be used to provide a used-defined string.
Next time, please add the details about the RDBMS and your check plugin in your initial question. That makes it easier to help
Cheers,
Michael
Hello,
Yes, the option “–name2” it’s working but unfortunately i can’t put 2 different outputs , one for OK state and another for CRITICAL state .
Cheers,
Petre
Hi,
then I’d say you’ll need to look into a plugin wrapper, as shown in this topic: How to write a bash script wrapper (newbie script for ITL check_yum plugin)
You’ll need to detect the different outputs from your plugin, and change that accordingly then.
Cheers,
Michael