Passive Überwachung: Unterschied zwischen den Versionen
Aus MeinWiki
(→Konfiguration) |
(→Konfiguration) |
||
Zeile 49: | Zeile 49: | ||
SendNagios "$(SetReturnCode $hostName 'Diskspace' "`/usr/local/nagios/libexec/check_disk -w 5% -c 2% -M /`")" | SendNagios "$(SetReturnCode $hostName 'Diskspace' "`/usr/local/nagios/libexec/check_disk -w 5% -c 2% -M /`")" | ||
SendNagios "$(SetReturnCode $hostName 'TABLESPACE-USERS' "`/usr/local/nagios/libexec/custom/check_oracle_health --connect shel-db1 --user nagios --password 2008nag! --mode tablespace-usage -name USERS`")" | SendNagios "$(SetReturnCode $hostName 'TABLESPACE-USERS' "`/usr/local/nagios/libexec/custom/check_oracle_health --connect shel-db1 --user nagios --password 2008nag! --mode tablespace-usage -name USERS`")" | ||
− | *Cronjob | + | *Cronjob einrichten. |
+ | */5 * * * * /usr/local/nagios/script/check.sh |
Version vom 18. Mai 2016, 11:24 Uhr
Die passive Überwachung erfolg über NSCA.
Konfiguration Nagios-Host
Konfiguration
- nagios-plugin installierten.
- Script anpassen.
#!/bin/bash # cron export ORACLE_BASE=/opt/oracle export ORACLE_HOME=/opt/oracle/product/10.2/db_1 export ORACLE_SID=heldb # PARAMETER hostName='shel-db1' #Nagiosconfig SetReturnCode() { # $1 Hostname # $2 NSA Name # $3 Return Check funcReturn=3 if [ $# -eq 3 ]; then case "$3" in *OK*) funcReturn=$1";"$2"; 0; "$3 ;; *WARNING*) funcReturn=$1";"$2"; 1; "$3 ;; *CRITICAL*) funcReturn=$1";"$2"; 2; "$3 ;; *) funcReturn=$1";"$2"; 3; "$3 ;; esac fi echo $funcReturn } SendNagios() { if [ $# -eq 1 ]; then /bin/echo $1 |LD_PRELOAD=/usr/local/nagios/nsca/libmcrypt.so.4 /usr/local/nagios/nsca/send_nsca -H 172.16.2.106 -d ';' -c /usr/local/nagios/nsca/send_nsca.cfg fi } #MAIN SendNagios "$(SetReturnCode $hostName 'Diskspace' "`/usr/local/nagios/libexec/check_disk -w 5% -c 2% -M /`")" SendNagios "$(SetReturnCode $hostName 'TABLESPACE-USERS' "`/usr/local/nagios/libexec/custom/check_oracle_health --connect shel-db1 --user nagios --password 2008nag! --mode tablespace-usage -name USERS`")"
- Cronjob einrichten.
*/5 * * * * /usr/local/nagios/script/check.sh