Thursday, May 23rd 2013, 2:13am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to Monitoring-Portal.
Although this is a german monitoring forum, please don't hesitate to post in English. Nearly everybody here understands you and will answer in English as well.
If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form to register here or read more information about the registration process. If you are already registered, please login here.

HiPHil

Beginner

Posts: 20

Number of monitoring servers: 1

Nagios Version: 3

Distributed monitoring: Nein

Redundant monitoring: Nein

Number of hosts: 1200+

Number of services: 4000+

OS: RHEL 5.8

Plugin Version: 1.4.15

NDO Version: 1

1

Tuesday, May 15th 2012, 5:25pm

illegale chars in check_nrpe output loswerden?

Hallo zusammen!

Ich verwende NSClient um einen Exchange2010 Datenbank-Server zu überwachen, unter anderem auch diesen Counter:

Counter=\\MSExchange Database ==> Instances(*)\\Log Generation Checkpoint Depth"

Das ganze läuft in einem check_multi:

Source code

1
2
3
4
5
command[ DB_LogGenCheckpointDepth ] = check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a "Counter=\\MSExchange Database ==> Instances(*)\\Log Generation Checkpoint Depth" ShowAll MaxWarn=30 MaxCrit=40

command[ DB_PageFaultsStalls ] = check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a "Counter=\\MSExchange Database(Information Store)\\Database Page Fault Stalls/sec" ShowAll MaxWarn=5 MaxCrit=10

command[ DB_LogRecordsStalls ] = check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a "Counter=\\MSExchange Database(Information Store)\\Log Record Stalls/sec" ShowAll MaxWarn=10 MaxCrit=100


Jetzt hab ich nur das Problem, dass mir pnp4nagios die Performancedaten verwirft (wahrscheinlich wegen dem "==>" im string, oder dem *. Ich hab mir gedacht, ich könnte einfach den output des Plugins etwas umschreiben, aber so wie ich mir das vorstelle haut das nicht hin. Ich habs geschafft ein kurzes perl script zu schreiben dass das tut was ich will (fast), aber da kommt 1.) der falsche exit code zurück, zweitens hilft mir das nix wenns in der bash läuft, es muss ja im Nagios funktionieren. Wie kann ich in dem command file festlegen, was exit code sein soll bzw. was als perfdata ausgegeben wird? Ich sag gleich vorweg, ich hab einen Crash-Kurs mit Nagios hintermir und mit Perl noch garnichts am Hut!

Hier ist mal das Perl Dings.

Source code

1
2
3
4
5
6
7
8
9
#!/usr/bin/perl

my $i = qx(./check_nrpe -H xxx.xxx.xxx.xxx -p 5666 -c CheckCounter -a "Counter=\\MSExchange Database ==> Instances(*)\\Log Generation Checkpoint Depth" ShowAll MaxWarn=30 MaxCrit=40);

$i =~ s/==\>/--/g;

$i =~ tr/\/\#()*/./;

print $i;


Mit diesem command file hab ich es probiert, aber das funktioniert noch nicht so ganz.

Source code

1
2
3
4
5
6
7
8
9
10
11
command [ DB_LogGenCheckpointDepth ] = check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a "Counter=\\MSExchange Database ==> Instances(*)\\Log Generation Checkpoint Depth" ShowAll MaxWarn=30 MaxCrit=40



eeval [ clean_out ] = \

		$DB_LogGenCheckpointDepth$ =~ s/==\>/--/g; \

		$DB_LogGenCheckpointDepth$ =~ tr/\/\#()*/./; \

 	return $DB_LogGenCheckpointDepth$;


Bin über jede hilfe dankbar!

Lg, Phil

mess

Master

Posts: 2,164

Location: Esslingen

Number of monitoring servers:

Nagios Version:

Distributed monitoring: Nein

Redundant monitoring: Nein

Number of hosts:

Number of services:

OS:

Plugin Version:

NagVis Version:

NDO Version:

Perfparse Version:

Other Addons:

2

Wednesday, May 16th 2012, 10:26am

Hi Phil,


command [ DB_LogGenCheckpointDepth ] = check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a "Counter=\\MSExchange Database ==> Instances(*)\\Log Generation Checkpoint Depth" ShowAll MaxWarn=30 MaxCrit=40

eeval [ clean_out ] = \

$DB_LogGenCheckpointDepth$ =~ s/==\>/--/g; \

$DB_LogGenCheckpointDepth$ =~ tr/\/\#()*/./; \

return $DB_LogGenCheckpointDepth$;


Das kann so nicht funktionieren, denn du versuchst, read-only Makros als Variablen zu verwenden.

Ich wuerde da eher die Output-Anweisung ein bisschen missbrauchen, um das Script-Snippet unterzubringen:

Quoted

command [ DB_LogGenCheckpointDepth ] = check_nrpe ...
output [ DB_LogGenCheckpointDepth ] = "", my $s="$DB_LogGenCheckpointDepth$"; $s=~s/==>/--/g; $s=~ tr/\/\#\(\)\*/./; printf "\n%s", $s;

Normalerweise funktioniert die Output-Anweisung wie ein printf mit einem Formatstring, um den Output von check_multi-Kommandos noch anpassen zu koennen.
Wenn man komplette Anweisungen unterbringen muss, setzt man einfach den Formatstring auf leer (""), und bringt danach die Anpassung unter.

Gruss - Matthias
-> check_multi und check_generic
Problem solved? Dann einfach mal flattrn, das hilft dem Forum!

HiPHil

Beginner

Posts: 20

Number of monitoring servers: 1

Nagios Version: 3

Distributed monitoring: Nein

Redundant monitoring: Nein

Number of hosts: 1200+

Number of services: 4000+

OS: RHEL 5.8

Plugin Version: 1.4.15

NDO Version: 1

3

Wednesday, May 23rd 2012, 1:14pm

Leider, wenn ich deinen Code verwende bekomm ich nur:

Source code

1
2
3
4
5
	(No output returned from plugin)



CRITICAL: MSExchange Database -- Instances(*)og generation checkpoint depth: 67 > criticalcheck_multi CRITICAL - 1 plugins checked, 2 critical (DB_LogGenCheckpointDepth, DB_LogGenCheckpointDepth) [Unrecognized escape \M passed through at (eval 17) line 1. generated at line 3413 in /usr/local/nagios/libexec/check_multi ((eval))]
Überseh ich da was? Woher kommt überhaupt das output-Keyword? Finde das in keiner Doku.

This post has been edited 2 times, last edit by "HiPHil" (May 23rd 2012, 1:42pm)


bern

Master

Posts: 2,939

Number of monitoring servers: 2-5

Nagios Version: 3.x

Distributed monitoring: Nein

Redundant monitoring: Nein

Number of hosts: 80-200

Number of services: 1400-2000

OS: Linux

Plugin Version: Whatever I can download, patch, or cobble together myself :-)

Other Addons: n2rrd, PNP, livestatus

4

Wednesday, May 23rd 2012, 3:53pm

Woher kommt überhaupt das output-Keyword? Finde das in keiner Doku.
Wenn Du das meinen solltest, "No output returned from ..." bügelt Nagios selbst drüber, wenn das Plugin (Trommelwirbel!) keinen (Text-)Output zurückgegeben hat.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
# grep -n 'plugin_output=[^=].*"' ~/nagios-3.2.3/base/checks.c
1003:       	temp_service->plugin_output=(char *)strdup("(Service check did not exit properly)");
1028:               	temp_service->plugin_output=(char *)strdup("(No output returned from plugin)");
2740:       	hst->plugin_output=(char *)strdup("(Host assumed to be UP)");
2747:       	hst->plugin_output=(char *)strdup("(No output returned from host check)");
3318:       	temp_host->plugin_output=(char *)strdup("(No output returned from host check)");
3348:               	temp_host->plugin_output=(char *)strdup("(Host check did not exit properly)");
3370:               	temp_host->plugin_output=(char *)strdup("(Host assumed to be UP)");

# grep -n '>plugin_output,.*[^"]"[^"]' ~/nagios-3.2.3/base/checks.c
1015:       	asprintf(&temp_service->plugin_output,"(Return code of %d is out of bounds%s)",queued_check_result->return_code,(queued_check_result->return_code==126 ? " - plugin may not be executable" : (queued_check_result->return_code==127 ?" - plugin may be missing":"")));
3362:               	asprintf(&temp_host->plugin_output,"(Return code of %d is out of bounds%s)",queued_check_result->return_code,(queued_check_result->return_code==126 || queued_check_result->return_code==127)?" - plugin may be missing":"");

HiPHil

Beginner

Posts: 20

Number of monitoring servers: 1

Nagios Version: 3

Distributed monitoring: Nein

Redundant monitoring: Nein

Number of hosts: 1200+

Number of services: 4000+

OS: RHEL 5.8

Plugin Version: 1.4.15

NDO Version: 1

5

Thursday, May 24th 2012, 9:07am

Na ich meinte das output [] keyword im command file. Und ganz haut das so nicht hin, ich stelle fest, am ende es Outputs in den Performance Daten steht alles nochmal, nur ohne dass es sich von meinen String-Operations beeindrucken lasst.

Source code

1
2
3
[root@grzslx007 ~]# cat /usr/local/nagios/etc/check_multi/check_multi_db_test.cmd
command [ DB_LogGenCheckpointDepth ] = check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckCounter -a "Counter=\\MSExchange Database ==> Instances(*)\\Log Generation Checkpoint Depth" ShowAll MaxWarn=30 MaxCrit=40
output [ DB_LogGenCheckpointDepth ] = "", my $s="$DB_LogGenCheckpointDepth$"; $s=~s/\=\=/--/g; $s=~s/\(\*\)/xxx/g; printf "\n%s", $s;

Source code

1
2
CRITICAL: MSExchange Database --> Instancesxxxog generation checkpoint depth: 66 > criticalcheck_multi CRITICAL - 1 plugins checked, 2 critical (DB_LogGenCheckpointDepth, DB_LogGenCheckpointDepth) [please don't run plugins as root!,Unrecognized escape \M passed through at (eval 17) line 1. generated at line 3413 in /usr/local/nagios/libexec/check_multi ((eval))]
<div><table style='border-left-width:1px; border-right-width:0px; border-left-style:dotted' id=multi_table><tr style='font-size:8pt'><td nowrap><table style='background-color:#F83838'><tr style='vertical-align:middle'><td style='font-size:6pt'> 1</td></tr></table></td><td nowrap><A TARGET='_self' HREF='/pnp4nagios/graph?host=GRZSMS580&srv=DB_LogGenCheckpointDepth'> <img src='/nagios/images/action.gif' width=20 height=20 border=0 align=top alt='Show performance chart for GRZSMS580 / check_nrpe'></A></td><td></td><td>DB_LogGenCheckpointDepth</td><td>1</td></tr></table></div>|check_multi::check_multi::plugins=1 time=1.434218 'DB_LogGenCheckpointDepth::check_nrpe::\MSExchange Database ==> Instances(*)\Log Generation Checkpoint Depth'=66;30;40

HiPHil

Beginner

Posts: 20

Number of monitoring servers: 1

Nagios Version: 3

Distributed monitoring: Nein

Redundant monitoring: Nein

Number of hosts: 1200+

Number of services: 4000+

OS: RHEL 5.8

Plugin Version: 1.4.15

NDO Version: 1

6

Wednesday, May 30th 2012, 1:53pm

Hello Again!
Der einzige Hinweis auf das output [] keyword war in diesem Thread. Leider funktioniert das noch immer nicht. Ich bekomm zwar als plugin output den veränderten String, aber nicht bei den Perfdaten.

Source code

1
2
3
4
5
Status Information:	(No output returned from plugin)
CRITICAL: MSExchange Database --> Instancesxxxog generation checkpoint depth: 67 > criticalcheck_multi CRITICAL - 1 plugins checked, 2 critical (DB_LogGenCheckpointDepth, DB_LogGenCheckpointDepth) [Unrecognized escape \M passed through at (eval 17) line 1. generated at line 3413 in /usr/local/nagios/libexec/check_multi ((eval))]		 1
			DB_LogGenCheckpointDepth	1

Performance Data:	check_multi::check_multi::plugins=1 time=1.383206 'DB_LogGenCheckpointDepth::check_nrpe::\MSExchange Database ==> Instances(*)\Log Generation Checkpoint Depth'=67;30;40

HiPHil

Beginner

Posts: 20

Number of monitoring servers: 1

Nagios Version: 3

Distributed monitoring: Nein

Redundant monitoring: Nein

Number of hosts: 1200+

Number of services: 4000+

OS: RHEL 5.8

Plugin Version: 1.4.15

NDO Version: 1

7

Thursday, June 21st 2012, 10:47am

So, da bin ich wieder.
Ich hab jetzt ein wrapperscript gebaut, dass sowohl "==>" als auch "(*)" aus dem perfdata-string entfernt (obwohl ich in der Doku gelesen habe, dass sonderzeichen enthalten sein können, solang der label in single quotes eingefasst ist.
Das Script liefert jetzt folgenden output:

Source code

1
2
[root@grzslx007 libexec]# ./check_nrpe_db_perf.sh -H grzsms580 -p 5666 -c CheckCounter -a "Counter=\\9144(*)\\3298" index ShowAll MaxWarn=30 MaxCrit=40
CRITICAL: \MSExchange Database Instances\Log Generation Checkpoint Depth: 43 > critical|'\MSExchange Database Instances\Log Generation Checkpoint Depth'=43;30;40

Jetzt wird wenigstens schon die RRD und die XML Datei angelegt, aber die Graphen bleiben leer?
Im Log von PNP4Nagios ist nur folgende Zeile zu finden:

Source code

1
2012-06-21 10:40:50 [7741] [1] Found Performance Data for GRZSMS580 / Exchange2010_DB_Perf_TEST2 (\MSExchange Database Instances\Log Generation Checkpoint Depth=45;30;40)


Jetzt weiss ich wirklich nicht mehr weiter.

HiPHil

Beginner

Posts: 20

Number of monitoring servers: 1

Nagios Version: 3

Distributed monitoring: Nein

Redundant monitoring: Nein

Number of hosts: 1200+

Number of services: 4000+

OS: RHEL 5.8

Plugin Version: 1.4.15

NDO Version: 1

8

Thursday, June 21st 2012, 11:47am

So und nochmal das ganze.

Ich hab den dummen Graphen jezt zum laufen gebracht.

Wrapper script:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash

LINE=`/usr/local/nagios/libexec/check_nrpe $*`

RC=$?

LINE=`echo $LINE | sed 's/==>//g'` 
LINE=`echo $LINE | sed 's/*//g'` 
LINE=`echo $LINE | sed 's/(//g'` 
LINE=`echo $LINE | sed 's/)//g'` 
echo $LINE

exit $RC


Command:

Source code

1
check_nrpe_db_perf.sh -H grzsms580 -p 5666 -c CheckCounter -a "Counter=\\9144(*)\\3298" index ShowAll MaxWarn=30 MaxCrit=40


Allerdings funktioniert dieses command nur auf einem host, weil offenbar die Counter-IDs von host zu host unterschiedlich sind. Leider kann ich das wrapper-script nicht für den vollen command verwenden, weil da innerhalb der double quotes Leerzeichen vorkommen.

Source code

1
2
3
[root@grzslx007 libexec]# ./check_nrpe_db_perf.sh -H grzsms580 -p 5666 -c CheckCounter -a "Counter=\\MSExchange Database ==> Instances(*)\\Log Generation Checkpoint Depth" ShowAll MaxWarn=30 MaxCrit=40

CRIT: Counter not found: \MSExchange: Unable to parse the counter path. Check the format and syntax of the specified path. (C0000BC0)


*grml* kann mir jemand sagen, was ich tun muss, damit das wrapper-script das richtig weitergibt?

bern

Master

Posts: 2,939

Number of monitoring servers: 2-5

Nagios Version: 3.x

Distributed monitoring: Nein

Redundant monitoring: Nein

Number of hosts: 80-200

Number of services: 1400-2000

OS: Linux

Plugin Version: Whatever I can download, patch, or cobble together myself :-)

Other Addons: n2rrd, PNP, livestatus

9

Thursday, June 21st 2012, 10:28pm

kann mir jemand sagen, was ich tun muss, damit das wrapper-script das richtig weitergibt?
Ja, für solche Zwecke gibt's neben "$*" noch das "$@":

Source code

1
2
3
4
5
6
7
8
[root@nagios AMC]# ~/JoB/TMP.sh AMC_Load.rrd "AMC_CPU Usage.rrd" AMC_PING.rrd
-rw-r--r-- 1 nagios nagios 552412 21. Jun 22:12 AMC_CPU Usage.rrd       	 
-rw-r--r-- 1 nagios nagios 185116 21. Jun 22:15 AMC_Load.rrd            	 
-rw-rw-r-- 1 nagios apache 246328 21. Jun 22:16 AMC_PING.rrd            	 
[root@nagios AMC]# cat ~/JoB/TMP.sh
#!/bin/sh
OUTPUT=`ls -l "$@"`
echo "$OUTPUT"


Noch ein Hinweis: Da Du PNP verwendest, kannst Du die DS-Namen im Notfall auch komplett zusammenstreichen, solange sie nur eindeutig sind. Zwischen RRDs und Graphen sind die DS bei PNP eh' nur mit laufenden Nummern unterwegs und dem, daß über den Graphen mit "Datasource: ..." Unsinn zu stehen kommt, kann man später in den Templates entgegensteuern.