Community discussions

MikroTik App
 
masterphoton
just joined
Topic Author
Posts: 8
Joined: Mon Nov 22, 2010 2:20 pm

Create poller with external command

Mon Nov 22, 2010 2:26 pm

Hello,
This is my first question about The Dude.
I need to ping some devices on my network, which are not accesible directly from the Dude server. So I wrote a perl script that makes a connection (telnet) with a router, pings the specified devices and returns OK for responding devices and DOWN for the others.

What I need to do (and don't know how) is to create a custom poller that will call the perl script, read the results and set the state of the devices on my dude map to UP or DOWN accordingly.
Is there a way to do this in The Dude?

Thanks in advance,
MP
 
masterphoton
just joined
Topic Author
Posts: 8
Joined: Mon Nov 22, 2010 2:20 pm

Re: Create poller with external command

Wed Nov 24, 2010 11:11 pm

No one?
Is the question too vague?
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: Create poller with external command

Thu Nov 25, 2010 9:10 am

No one?
Is the question too vague?
It is not vague.
But you should first read "Probe Thread" and you will find the answer how to write function to execute external aplication and than you should create the probe based on it results.
 
masterphoton
just joined
Topic Author
Posts: 8
Joined: Mon Nov 22, 2010 2:20 pm

Re: Create poller with external command

Thu Nov 25, 2010 4:48 pm

Well...I've tried, but I don't get it to work!
Here's my implementation:
----
Function
Name: myping()
Code: array_element(execute("perl remote_telnet.pl"),1)

Probe
Type: function
Available: if(myping()>0, "up", "down")
Error: if(myping()<0, "", "down")
Value: 1
---

The script called "remote_telnet.pl" connects to a router, pings a machine and returns 1 in case of success and -1 in case of error.

Where's the mistake?
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: Create poller with external command

Fri Nov 26, 2010 8:54 am

Where's the mistake?
execute("perl remote_telnet.pl") - will not work.
The dude knows nothing about Windows PATH and nothing about where remote_telnet.pl is located.
You should use it like this
array_element(execute("cscript.exe",concatenate("//NoLogo C:\\dudescr\\loggeduser.vbs ",User_Pass()),"C:\\WINDOWS\\system32\\"),1) 
cscript.exe is located in C:\WINDOWS\system32\ and loggeduser.vbs is located in C:\dudescr\

Note: you should use doble \\ in The Dude v4.0 and \ in The Dude v < 4.0

Who is online

Users browsing this forum: No registered users and 5 guests