Community discussions

MikroTik App
 
ErikSR
just joined
Topic Author
Posts: 2
Joined: Tue Aug 21, 2018 1:01 pm

Dude notifications, execute on server, ssh

Tue Aug 21, 2018 1:18 pm

Created new notification in Dude (6.42.7), set it's type to "execute on server" and I'm trying to use ssh to connect to linux box and run a command.

In notification command window I have command:
/system ssh address=a.b.c.d user=xxx command="/bin/command/here"

I've set up ssh keys; when connecting to Dude with winbox and running same command from terminal, it works perfectly.
Clicking 'Test' in notification window yields nothing. If I start remote host's ssh in debugging mode, I see that there's no incoming
connection (when clicking 'Test'). '/tool fetch' in command window works.

What am I doing wrong?
 
awonglk
newbie
Posts: 33
Joined: Sat Oct 31, 2015 3:43 pm

Re: Dude notifications, execute on server, ssh

Tue Aug 31, 2021 12:10 pm

Did you ever find the solution to this?
I have the same issue now 3 years later!

Leads me to think that perhaps Dude does not actually use the same key as the underlying RouterOS.
Anyone else tried this?
 
ErikSR
just joined
Topic Author
Posts: 2
Joined: Tue Aug 21, 2018 1:01 pm

Re: Dude notifications, execute on server, ssh

Tue Aug 31, 2021 12:27 pm

Did you ever find the solution to this?
Sadly, no.
 
eddieb
Member Candidate
Member Candidate
Posts: 294
Joined: Thu Aug 28, 2014 10:53 am
Location: Netherlands

Re: Dude notifications, execute on server, ssh

Wed Sep 01, 2021 9:00 am

if you have doubts about the keyfile used by the ssh command you could try to specify the name on the commandline ...
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 9596
Joined: Tue Feb 25, 2014 12:49 pm
Location: 🇮🇹, my 💔 is in 🇺🇦

Re: Dude notifications, execute on server, ssh

Wed Sep 01, 2021 10:14 am

For non-interactive session use ssh-exec
/system ssh-exec address=127.0.0.1 port=22  user=admin src-address=127.0.0.1 command="/print" output-to-file=file.txt
 
User avatar
stmx38
Long time Member
Long time Member
Posts: 582
Joined: Thu Feb 14, 2008 4:03 pm
Location: Moldova, Chisinau

Re: Dude notifications, execute on server, ssh

Sat Apr 02, 2022 6:33 pm

We solved this by run script on ROS from Dude, and script can then SSH to the remote server and execute required commands. We also can pass variables from Dude to the script.

Dude
# Define Subject
:global notificationtext "Service [Probe.Name] on [Device.Name] is now [Service.Status]"

# Run script
system script run sms

ROS script
# Define subject
:global notificationtext "$notificationtext"

# Define IP of ROS with SMS access
:local rossms "192.168.64.4"

# Firstname Lastname
:local phonenumber "+xxxxxxxxxxx"

# Send SMS
system ssh-exec address="rossms" user=sms-sender command="/tool sms send usb1 \"$phonenumber\" message=\"$notificationtext\""

More detailed description can be found in the topic - Dude v6 - SMS notification through another ROS - using ssh-exec.

We also got a confirmation from support - 'Private key is not supported in dude' and created a Feature request - Add Dude access to SSH private keys for ssh-exec.

Who is online

Users browsing this forum: No registered users and 1 guest