Você pode obter o uso adequado de memória com o SQL usando os contadores de desempenho, em especial a memória total do servidor. Com o Nagios você poderia usar o NSClient ++ e o nrpe para pesquisar estes contadores. Aqui estão alguns contadores SQL para sua referência (com aviso bobo e níveis críticos):
define service {
service_description SQL Buffer Cache Hit Ratio
use generic-service
hostgroup_name database_servers
check_command check_nrpe_counter!BufferCacheHitRatio!\SQLServer:Buffer Manager\Buffer cache hit ratio!100!200
}
define service {
service_description SQL Full Scans Per Sec
use generic-service
hostgroup_name database_servers
check_command check_nrpe_counter!scans!\SQLServer:Access Methods\Full Scans/sec!100!200
}
define service {
service_description SQL Latch Wait Time in MS
use generic-service
hostgroup_name database_servers
check_command check_nrpe_counter!ms!\SQLServer:Latches\Total Latch Wait Time (ms)!100!200
}
define service {
service_description SQL Batch Req Per Sec
use generic-service
hostgroup_name database_servers
check_command check_nrpe_counter!req!\SQLServer:SQL Statistics\Batch Requests/sec!100!200
}
define service {
service_description SQL Re-Compilations Per Sec
use generic-service
hostgroup_name database_servers
check_command check_nrpe_counter!req!\SQLServer:SQL Statistics\SQL Re-Compilations/sec!100!200
}
define service {
service_description SQL Total Memory in KB
use generic-service
hostgroup_name database_servers
check_command check_nrpe_counter!mem!\SQLServer:Memory Manager\Total Server Memory (KB)!100!200
}
define service {
service_description SQL Memory Grants Pending
use generic-service
hostgroup_name database_servers
check_command check_nrpe_counter!PenMemGrant!\SQLServer:Memory Manager\Memory Grants Pending!100!200
}
#define service {
# service_description SQL Mirror Log Remaining For Undo
# use generic-service
# check_command check_nrpe_counter!kb!\SQLServer:Database Mirroring(StackOverflow)\Log Remaining for Undo KB!100!200
#}
#define service {
# service_description SQL Mirror Log Send Queue
# use generic-service
# check_command check_nrpe_counter!kb!\SQLServer:Database Mirroring(StackOverflow)\Log Remaining for Undo KB!100!200
#}
#define service {
# service_description SQL Mirror Redo Queue
# use generic-service
# check_command check_nrpe_counter!kb!\SQLServer:Database Mirroring(StackOverflow)\Log Remaining for Undo KB!100!200
#}
define service {
service_description SQL Number of Connected Users
use generic-service
hostgroup_name database_servers
check_command check_nrpe_counter!UserCon!\SQLServer:General Statistics\User Connections!100!200
}
Exemplo de comando:
define command {
command_name check_nrpe_counter
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckCounter -a "Counter:$ARG1$=$ARG2$" ShowAll MaxWarn=$ARG3$ MaxCrit=$ARG4$
}
Por último, você pode estar interessado nos contadores recomendados de Brent Ozar para SQL Perfmon: