Hallo Community ich hab folgende frage, bekomme im Nagios-Interface folgenden Output zu dem Unknown Status meines Service
 |
Quellcode
|
1
|
**ePN /usr/local/nagios/libexec/check_snmp_traps: "Use of uninitialized value in concatenation (.) or string at (eval 7) line 230,".
|
Frage 1 )) Empfangen kann ich traps ganz normal und die werden dann in die MySQL Datenbank geschrieben und nun möchte ich über das plugin check_snmp_traps die Datenbank abfragen und bekomme die Meldung oben statt wie in der shell unten.
command
 |
Quellcode
|
1
2
3
4
5
|
define command {
command_name check_snmp_traps
command_line $USER1$/check_snmp_traps -H $HOSTADDRESS$
register 1
}
|
service
 |
Quellcode
|
1
2
3
4
5
6
7
|
define service {
host_name cisco_switch_x.x.x.x
service_description check_snmp_traps
use service-standard
check_command check_snmp_traps
register 1
}
|
host
 |
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
define host {
host_name cisco_switch_x.x.x.x
alias Cisco 2960
address x.x.x.x
check_command check-host-alive
use host-standard
max_check_attempts 3
contacts praktikant_x
contact_groups praktikant_grp
notification_interval 10
notification_period 24x7
notification_options d,u,r
notifications_enabled 0
register 1
}
|
auf der shell funktioniert es
 |
Quellcode
|
1
|
[nagios libexec]$ ./check_snmp_traps -H x.x.x.x OK - No warning Traps and no critical traps in the database|'warning trap'=0;;;; 'critical trap'=0;;;;
|
Frage 2 )) die Anzeige hätte ich auch gerne die mir ja dann sagt das in der Datenbank kein Trap mit warning oder critical ist oder liege ich da falsch??
Auszug aus dem Plugin
 |
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# Read warning-Traps from database
if ($opt_w) {
$dbQuery = $dbConnect->prepare("SELECT formatline FROM $dbTable WHERE hostname='$opt_H' AND severity='WARNING' $queryCategory $queryTrapOid $queryTrapRead $querySearchString");
&debug(1,"Query: SELECT formatline FROM ".$dbTable." WHERE hostname='".$opt_H."' AND severity='WARNING' ".$queryCategory." ".$queryTrapOid." ".$queryTrapRead." ".$querySearchString);
$dbQuery->execute();
while ( = $dbQuery->fetchrow_array) {
$countWarning++;
$lastWarningTrapMessage = $resultWarning['0'];
}
&debug(1,"Count warnings: ".$countWarning);
&debug(1,"Last trap message: ".$lastWarningTrapMessage);
} <<<<-------------- """ line 230 """
# Read critical-Traps from database
if ($opt_c) {
$dbQuery = $dbConnect->prepare("SELECT formatline FROM $dbTable WHERE hostname='$opt_H' AND severity='CRITICAL' $queryCategory $queryTrapOid $queryTrapRead $querySearchString");
&debug(1,"Query: SELECT formatline FROM ".$dbTable." WHERE hostname='".$opt_H."' AND severity='CRITICAL' ".$queryCategory." ".$queryTrapOid." ".$queryTrapRead." ".$querySearchString);
$dbQuery->execute();
while ( = $dbQuery->fetchrow_array) {
$countCritical++;
$lastCriticalTrapMessage = $resultCritical['0'];
}
&debug(1,"Count critical: ".$countCritical);
&debug(1,"Last trap message: ".$lastCriticalTrapMessage);
}
|
Hoffe einer durchschaut mein vorgehen und kann mir helfen danke !!
Mfg Arni