Killian,

Thanks for the patch! We'll look into this, although it may just miss the next release (3.7.2).

Ton

On 28 Jun 2010, at 12:26, Killian Faughnan wrote:

Hi List,

I was adding a few checks for oracle processes using check_snmp_runningproc and noticed a few problems.  It seems that when the check returns a list of processes from a remote host it lowercases them all and attempts to strips out .e .ex and .exe extensions.

The extensions used in the regular _expression_ weren't escaping the dot which resulted them in stripping out any character followed by an e, ex or exe.  In my case this meant it was matching against "orac" instead of oracle.

I also noticed that the user input wasn't undergoing the same translations as the returned processes (both the conversion to lower case and the stripping of extensions).  I fixed this by cleaning up the regexp and adding in a lc() function and the same regexp for user input.  Below is a diff that can be used to patch the issue.

If theres a different format that should be used for diff's please let me know.  The below was done with 'diff -ur'.

Thanks,

Killian


--- check_snmp_runningproc      2010-06-28 12:12:25.000000000 +0100
+++ check_snmp_runningproc-new  2010-06-25 16:36:54.000000000 +0100
@@ -76,7 +76,10 @@
     # print "Using community $community\n";
 }
 if ($opt_p) {
-    $processes = $opt_p;
+    $processes = lc($opt_p);
+    $processes =~ s/\.exe//g;    # removes .exe file extentions
+    $processes =~ s/\.ex//g;     # removes .ex file extentions
+    $processes =~ s/\.e//g;      # removes .e file extentions
 }
 else {
     print "No processes specified\n";
@@ -149,11 +152,10 @@
             $returnedprocess = $s->var_bind_list()->{$oid};
 
             $returnedprocess = lc($returnedprocess);
-            $returnedprocess =~ s/.exe//g;    # removes .exe file extentions
-            $returnedprocess =~ s/.ex//g;     # removes .ex file extentions
-            $returnedprocess =~ s/.e//g;      # removes .e file extentions
+            $returnedprocess =~ s/\.exe//g;    # removes .exe file extentions
+            $returnedprocess =~ s/\.ex//g;     # removes .ex file extentions
+            $returnedprocess =~ s/\.e//g;      # removes .e file extentions
             $counter = 0;
-
             foreach $line (@processes) {
                 if ( $returnedprocess =~ m/$line/ ) {
                     @matches[$counter] = @matches[$counter] + 1;
_______________________________________________
Opsview-users mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-users


Ton Voon
Product Architect



Global Headquarters: Unit 69 Suttons Business Park | Reading | Berkshire | RG6 1AZ | UK

UK:      +44 (0) 845 057 7887
USA:     +1 866 879 9184
Email:    [email protected]
Skype:   tonvoon
Web:     www.opsview.com

This e-mail is confidential, intended only for the named recipient(s) above and may contain information that is privileged and confidential. If you receive this message in error, or are not the named recipient(s), please notify the sender at the phone number above, do not copy this message, do not disclose its contents to anyone, and delete this e-mail message from your computer. Although we routinely screens for viruses, addressees should scan this e-mail and any attachments for viruses. Opsera makes no representation or warranty as to the absence of viruses in this e-mail or any attachments.

_______________________________________________
Opsview-users mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-users

Reply via email to