NetXMS Support Forum
July 30, 2010, 04:04:25 am
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Binary packages for you favorite OS / Distribution. Which OS should go first? Help us decide!
Home
Help
Search
Tags
Login
Register
NetXMS Support Forum
>
English Support
>
Configuration
>
RegEx in DCI
Pages: [
1
]
« previous
next »
Print
Author
Topic: RegEx in DCI (Read 148 times)
jdl
Jr. Member
Posts: 52
RegEx in DCI
«
on:
March 10, 2010, 07:24:11 pm »
Quick one...
How would you handle regex in the DCI transformation?
Let's say you poll an SNMP OID which returns a string similar to "MyVal=18#-99#AB_01".
You want to extract the "-99" and return an integer to graph it...
In Perl it would sth like $1 ~=/#(.+)#/ - if I'm right.
Regards,
Jdamien
«
Last Edit: March 10, 2010, 07:46:05 pm by jdl
»
Logged
jdl
Jr. Member
Posts: 52
Re: RegEx in DCI
«
Reply #1 on:
March 10, 2010, 07:44:21 pm »
Well I'm glad I can answer myself this time ;-)
Solution is...
sub main()
{
$1~="#(.*)#";
return $1;
}
This script will return "
-99
" if I give it as input "
MyVal=18#-99#AB_01
".
And for those interested...
sub main()
{
$1~="#(.*)#(.*)$";
return $2;
}
This one will return "
AB_01
"
PS.: "main" not "Main"!!! Otherwise -> Error
JDamien
«
Last Edit: March 10, 2010, 07:48:51 pm by jdl
»
Logged
Tags:
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> Announcements
=> Polls
-----------------------------
English Support
-----------------------------
=> Installation
=> Configuration
=> General Support
=> Feature Requests
-----------------------------
Russian Support
-----------------------------
=> Общие вопросы
=> Идеи и предложения по функциональности NetXMS
-----------------------------
Development
-----------------------------
=> General
=> Windows
Loading...