check_snmp_int.pl regex problems

Patrick Proy nagios-user at proy.org
Tue Jun 26 19:28:03 CEST 2007


Hi,

The big problem with Windows SNMP agent, is that is puts special caracters
you don't see in interface description, so putting "Network Connection$"
won't work because there are control caracters after "Connection". (maybe
"Connection[ [:cntrl:]]*$" would work).

Single or double quote don't matter by the way. It's just to be sure the
shell won't interpret caracters like ";" or "&"

Your idea to check interface without "#" in it was good but not the regexp.
Try :
"^Intel[^2#]*$" 

Which means : starts (^) with "Intel" and ends ($) with a string containing
any caracters that are not 2 or # ([^2#]*)

Patrick
http://nagios.manubulon.com

-----Message d'origine-----
De : nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] De la part de Jason
Woodward
Envoyé : mardi 26 juin 2007 17:26
À : nagios-users at lists.sourceforge.net
Objet : Re: [Nagios-users] check_snmp_int.pl regex problems

Hi Dan,

Thanks for the suggestion.  That did not work, it still doesn't like the $.
I have gone ahead and modified one of the check_snmp scripts to check it
based on each interfaces oid.  I can get the info I need now, just takes a
bit more work.

Jason

_________________________________ 

Dan Eriksson wrote:
> Hi Jason,
>
> According to this,
> http://www.mail-archive.com/nagios-users@lists.sourceforge.net/msg0269
> 8.html
>
> It seems like you need to put single quotes instead of double quotes 
> like, as you want to match on "Intel(R) PRO/1000 MT Network Connection"
and only this.
>
> Then I guess your check_command should look something like:
>
> /check_command check_snmp_int!'PRO/1000 MT Network Connection$'
>
> Hope this helps,
>
> Best regards,
> Dan
>
> -----Ursprungligt meddelande-----
> Från: nagios-users-bounces at lists.sourceforge.net 
> [mailto:nagios-users-bounces at lists.sourceforge.net] För Jason Woodward
> Skickat: den 26 juni 2007 16:08
> Till: nagios-users at lists.sourceforge.net
> Ämne: [Nagios-users] check_snmp_int.pl regex problems
>
> I have 2 interfaces:
>
> Intel(R) PRO/1000 MT Network Connection
> Intel(R) PRO/1000 MT Network Connection #2
>
>
> I need to filter out " Intel(R) PRO/1000 MT Network Connection #2" . 
> The following are some of the commands I have tried.
>
> /check_command check_snmp_int!""
> MS TCP Loopback interface:UP, Intel(R) PRO/1000 MT Network Connection 
> #2:DOWN, Intel(R) PRO/1000 MT Network Connection:UP: 1 int NOK : 
> CRITICAL/
>
> this cuts out anything that matches MT, so I know that if I cut out 
> any interface with #, I will get what I want /check_command 
> check_snmp_int!"^[MT]"
> MS TCP Loopback interface:UP:1 UP: OK/
>
> But # doesn't work...
> /check_command check_snmp_int!"^[#]"
> ERROR : Unknown interface ^[#]/
>
> maybe if I cut out any interface with 2 in it?
> /check_command check_snmp_int!"^[2]"
> ERROR : Unknown interface ^[2]/
>
> this doesn't cut out anything that matches Intel, I assume something 
> to do with the / /check_command check_snmp_int!"^[Intel]"
> Intel(R) PRO/1000 MT Network Connection #2:DOWN, Intel(R) PRO/1000 MT 
> Network Connection:UP: 1 int NOK : CRITICAL/
>
> I can isolate "Intel(R) PRO/1000 MT Network Connection #2"
> /check_command check_snmp_int!"#2"
> Intel(R) PRO/1000 MT Network Connection #2:DOWN: 1 int NOK : CRITICAL/
>
> /check_command check_snmp_int!"Intel(R) PRO/1000 MT Network Connection"
> ERROR : Unknown interface Intel(R) PRO/1000 MT Network Connection/
>
> /check_command check_snmp_int!"1000 MT Network Connection"
> Intel(R) PRO/1000 MT Network Connection #2:DOWN, Intel(R) PRO/1000 MT 
> Network Connection:UP: 1 int NOK : CRITICAL /
>
>
> I can use "^Intel" to get Intel at the beginning /check_command 
> check_snmp_int!"^Intel"
> Intel(R) PRO/1000 MT Network Connection #2:DOWN, Intel(R) PRO/1000 MT 
> Network Connection:UP: 1 int NOK : CRITICAL/
>
> Since ^ works, I figured $ would work as well. $ does not seem to work 
> to match at the end, and it returns with 2 $?
> /check_command check_snmp_int!"Connection$"
> ERROR : Unknown interface Connection$$/
>
> \Z does not work
> /check_command check_snmp_int!"Connection\Z"
> ERROR : Unknown interface Connection\Z/
>
>
> I am at a loss for what to do. There seems to be an issue with #, and $. 
> Anyone have a solution to this? I have 15 servers with this issue. 
> Thanks in advance,
>
> Jason Woodward
>
>
> ----------------------------------------------------------------------
> --- This SF.net email is sponsored by DB2 Express Download DB2 Express 
> C - the FREE version of DB2 express and take control of your XML. No 
> limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the
FREE version of DB2 express and take control of your XML. No limits. Just
data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list