Text function create a tool
Questions and Suggestions for The Dude Network Monitor

9 posts   •   Page 1 of 1
Duduhandelman
Frequent Visitor
Frequent Visitor
 
Posts: 66
Joined: Wed Jan 04, 2012 6:30 pm

Text function create a tool

by Duduhandelman » Wed Jan 25, 2012 10:46 pm

Hi All,
Maybe you have an idea on how to accomplish that.
I have servers that the ip address of them is 1.140.X.X while the IPMI ip of those servers is 192.140.X.X.
I wonder if its possible to create a tool that will open https://192.140.X.X without configuring this IP on each server.
If I understand correctly I need to create a function that will return only the number after the first dot and concatenate it with 192 at the beginning,

Many thanks for the help.

fbsdmon
newbie
 
Posts: 28
Joined: Fri Dec 30, 2011 12:37 am

Re: Text function create a tool

by fbsdmon » Wed Jan 25, 2012 11:07 pm

Not sure if this is what you are looking for, but this

concatenate("192", string_substring(device_property("FirstAddress"), string_find(device_property("FirstAddress"), "."), 15))

will take the first address of the device and replace the everything before the first "." with "192"

Duduhandelman
Frequent Visitor
Frequent Visitor
 
Posts: 66
Joined: Wed Jan 04, 2012 6:30 pm

Re: Text function create a tool

by Duduhandelman » Wed Jan 25, 2012 11:24 pm

Thanks fbsdmon
That's exactly what I was looking for. I was able to add it in the device appearance and it working perfect.
One last thing is how do I add this to the tool?
What should be the tool syntax
Thanks Again.

fbsdmon
newbie
 
Posts: 28
Joined: Fri Dec 30, 2011 12:37 am

Re: Text function create a tool

by fbsdmon » Thu Jan 26, 2012 12:07 am

Not sure if you can. I have no experience with creating tools, but from the examples and my short test to implement your idea, I can say that it is impossible :)
Looks like you can only pass device variables/information to the tools. So, no functions available.

What you could do is, set the IPMI ip address of each device in one of the custom fields of the device settings. This way, you could access the ip address from the tool as a device variable.

Tool Example:
name: https
command: "https://[Device.CustomField3]"

Duduhandelman
Frequent Visitor
Frequent Visitor
 
Posts: 66
Joined: Wed Jan 04, 2012 6:30 pm

Re: Text function create a tool

by Duduhandelman » Thu Jan 26, 2012 12:14 am

Thanks,
Yeh this will work, Now I should find a way to update 200 Devices.
I was unable to find a way to edit the database directly.

Many Thanks

User avatar
geoffsmith31
Member Candidate
Member Candidate
 
Posts: 105
Joined: Fri Nov 05, 2010 7:08 am
Location: Toowoomba, Australia

Re: Text function create a tool

by geoffsmith31 » Thu Jan 26, 2012 12:21 am

I suggest making a tool that passes the IP address parameter into a VB script. Make a VB script that does the substitution of the first octet of the IP address and then calls whatever application you need using that address.

lebowski
Forum Guru
Forum Guru
 
Posts: 1452
Joined: Wed Aug 27, 2008 5:17 pm

Re: Text function create a tool

by lebowski » Thu Jan 26, 2012 12:40 am

Not the greatest solution but you could put the ip address in custom field 1 and put this as the command under your new tool...
http://[Device.CustomField1]
web192-Tool000160.png
web192-Tool000160.png (15.38 KiB) Viewed 1321 times


I tried adding that concatenate string to a function and then putting the function into the command but it didn't seem to work. The call to a vb script or .bat from a tool would probably be the fastest.

Lebowski

Duduhandelman
Frequent Visitor
Frequent Visitor
 
Posts: 66
Joined: Wed Jan 04, 2012 6:30 pm

Re: Text function create a tool

by Duduhandelman » Thu Jan 26, 2012 9:49 pm

Thank You all,
I made a short Python script and all is working perfect.

Thanks Again.

Doorhandles1
just joined
 
Posts: 1
Joined: Fri Jan 27, 2012 5:11 pm
Location: Glasgow, UK

Re: Text function create a tool

by Doorhandles1 » Fri Jan 27, 2012 5:15 pm

really good information guys. that's really help

Thanks
Door Furniture

9 posts   •   Page 1 of 1

Who is online

Users browsing this forum: No registered users and 10 guests

It is currently Wed Nov 26, 2014 4:45 pm