• MikroTik.com
  • RouterBOARD
  • User Meeting
  • Training
  • User Manual
  • Support
  • Downloads
  • Videos
Register |   * Login | HOME

View unanswered posts | View active topics

Text function create a tool  Page 1 of 1
 [ 9 posts ]  Post new topic Reply to topic
  Print view Previous topic | Next topic 
Author Message
Duduhandelman
 Post subject: Text function create a tool
PostPosted: Wed Jan 25, 2012 9:46 pm 
Offline
newbie

Joined: Wed Jan 04, 2012 5:30 pm
Posts: 32
Karma: 0
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.


Top
 Profile  
 
fbsdmon
 Post subject: Re: Text function create a tool
PostPosted: Wed Jan 25, 2012 10:07 pm 
Offline
newbie

Joined: Thu Dec 29, 2011 11:37 pm
Posts: 28
Karma: 0
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"


Top
 Profile  
 
Duduhandelman
 Post subject: Re: Text function create a tool
PostPosted: Wed Jan 25, 2012 10:24 pm 
Offline
newbie

Joined: Wed Jan 04, 2012 5:30 pm
Posts: 32
Karma: 0
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.


Top
 Profile  
 
fbsdmon
 Post subject: Re: Text function create a tool
PostPosted: Wed Jan 25, 2012 11:07 pm 
Offline
newbie

Joined: Thu Dec 29, 2011 11:37 pm
Posts: 28
Karma: 0
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]"


Top
 Profile  
 
Duduhandelman
 Post subject: Re: Text function create a tool
PostPosted: Wed Jan 25, 2012 11:14 pm 
Offline
newbie

Joined: Wed Jan 04, 2012 5:30 pm
Posts: 32
Karma: 0
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


Top
 Profile  
 
geoffsmith31
 Post subject: Re: Text function create a tool
PostPosted: Wed Jan 25, 2012 11:21 pm 
Offline
Member Candidate
Member Candidate
User avatar

Joined: Fri Nov 05, 2010 6:08 am
Posts: 103
Karma: 2

Location: Toowoomba, Australia
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.


Top
 Profile  
 
lebowski
 Post subject: Re: Text function create a tool
PostPosted: Wed Jan 25, 2012 11:40 pm 
Offline
Forum Guru
Forum Guru

Joined: Wed Aug 27, 2008 4:17 pm
Posts: 1310
Karma: 26
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]
Attachment:
web192-Tool000160.png
web192-Tool000160.png [ 15.38 KiB | Viewed 885 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


Top
 Profile  
 
Duduhandelman
 Post subject: Re: Text function create a tool
PostPosted: Thu Jan 26, 2012 8:49 pm 
Offline
newbie

Joined: Wed Jan 04, 2012 5:30 pm
Posts: 32
Karma: 0
Thank You all,
I made a short Python script and all is working perfect.

Thanks Again.


Top
 Profile  
 
Doorhandles1
 Post subject: Re: Text function create a tool
PostPosted: Fri Jan 27, 2012 4:15 pm 
Offline
just joined

Joined: Fri Jan 27, 2012 4:11 pm
Posts: 1
Karma: 0

Location: Glasgow, UK
really good information guys. that's really help

Thanks
Door Furniture


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  Page 1 of 1
 [ 9 posts ] 

Board index » Other topics » The Dude

All times are UTC + 2 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Karma functions powered by Karma MOD © 2007, 2009 m157y