Business categorization for your virtual environment
Post Reply
caryabend
Novice
Posts: 3
Liked: never
Joined: Jan 30, 2013 5:17 pm
Full Name: Cary Abend
Contact:

Grouping Expression Question

Post by caryabend »

I'm trying to categorize my servers by name, but our naming convention changed.

Our convention follows the general rules of WWWW-XYYY-ZZZ where the string of W's is usually 2 or 4 characters, X may or may not exist, the string of Z's will always be three characters, and the string of Y's may be any length, with dashes to separate the sections.

Just to start, I wanted to group on the substring between the two dashes, and I could figure out how to remove the leading X later.

I discovered that the Grouping Expression Substring(Name,IndexOf(Name,"-") [Note: No closing paren!] evaluated as valid, and returned a number, where I was expecting a string.

My grasp of regular expressions is weak, but this looks there are both parsing and context problems. First, the expression isn't valid, but even adding a length and closing paren doesn't change the output. Second, while I saw that I can't nest CASEs, there's no indication I can't nest operators or methods. The documentation on p255. provides a few examples, but no clear usage or explanation of syntax.

Ideas?

Thanks

Cary
Vitaly.Mzokov
Expert
Posts: 173
Liked: 25 times
Joined: Aug 23, 2010 8:30 am
Full Name: Vitaliy Mzokov
Contact:

Re: Grouping Expression Question

Post by Vitaly.Mzokov » 2 people like this post

Hi Cary,

Hope my example will give you a hint on how to get all done the right way...

I've got several VMs in my lab which have names like "vm-one-65", "at-one-65", "shared-one-65", etc.
So my need is to separate "SHARED" servers from a rest of my lab VMs. I am simply using something like this construction:

Code: Select all

CASE
WHEN IndexOf(Name, "shared") = 0 THEN "Shared servers for all techs"
WHEN IndexOf(Name, "one") >= 0 THEN "Veeam ONE servers"
ELSE "Not even a Veeam ONE machine"
END
The idea is to see if a substring exists in a full VM's name or not. If it does then "IndexOf" function returns something which is greater than 0.
NOTE: "IndexOf" function returns 0 if a substring is actually a beginnings of a string.

Using the construction mentioned above I get:
1) All VMs which names are started with substring "shared" go to "Shared servers for all techs" group.
2) All other VMs which names have substring "one" in any given position go to "Veeam ONE servers" group.
3) Everything which is not related to Veeam ONE goes to "Not even a Veeam ONE machine" group :)

Hope it gave you some insight on how you can get what you need, Cary. Nevertheless, should any further help be required, please contact our support team via Customer Portal so our techs can assist you on creating a complex Grouping Expression.

- VM.

p.s. Btw, your document improvement request has been noticed ;)
caryabend
Novice
Posts: 3
Liked: never
Joined: Jan 30, 2013 5:17 pm
Full Name: Cary Abend
Contact:

Re: Grouping Expression Question

Post by caryabend »

Vitaliy -

Thanks for the quick response. I very well may have to contact the support team, but I hope it won't be necessary.
I might be able to use case statements, but I was hoping to avoid that.

Through more testing, I've discovered that the way spaces get parsed isn't clear.
Substring(Index(Name,"-")+1,4) returns different results than Substring(Index(Name, "-")+1, 4).
Clearly, nesting isn't an option for any types of evaluation. This is too bad, it would have really reduced the logic needed in certain circumstances.

Consider an environment where servers are named:

OWNER-FUNCTION, but neither field has a defined structure. An admin would need to craft a unique case statement for each owner and/or each function, which could be cumbersome in a large enterprise, whereas nesting operators reduces this to one or two statements.

I can handle that the editor doesn't use a true RegEx evaluation, but I'd like to see that documented better.
The spacing issue needs a check, that could be a bear to troubleshoot.

Cary
Vitaly.Mzokov
Expert
Posts: 173
Liked: 25 times
Joined: Aug 23, 2010 8:30 am
Full Name: Vitaliy Mzokov
Contact:

Re: Grouping Expression Question

Post by Vitaly.Mzokov »

Thanks for your reply Cary,

You're right regarding "spacing" issue - it was confirmed and now went to improvements list for our future versions.
As for original request, unfortunately, using math statements within currently available operators is not possible yet.
But this is a very good feature request, and it's been already forwarded to Product Management team :)

- VM.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest