Community discussions

MikroTik App
 
upnort
newbie
Topic Author
Posts: 49
Joined: Wed Aug 15, 2018 2:03 am

Sending output of multiple commands to a file

Tue Sep 17, 2019 12:15 am

I want to collect some basic device data and save the information to a file that can be used off device. The information I want to store is something like this:
:local Resource [/system resource print]
:local Routerboard [/system routerboard print]
:local Identity [system identity print]
:local Service [/ip service print]
I want to concatenate the information with something like this:
:local DeviceInfo ($Resource $Routerboard $Identity $Service)
Then paste that information into a file.

do something with "$DeviceInfo" file=DeviceInfo.txt

Thanks again. )
 
upnort
newbie
Topic Author
Posts: 49
Joined: Wed Aug 15, 2018 2:03 am

Re: Sending output of multiple commands to a file

Mon Sep 23, 2019 6:33 pm

I'm still looking for some coaching. :)
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Sending output of multiple commands to a file

Tue Sep 24, 2019 7:57 am

In my project Mikrotik for Splunk, I do get this information using syslog to send it out of all routers. See example here: viewtopic.php?f=23&t=137338#p698803
 
upnort
newbie
Topic Author
Posts: 49
Joined: Wed Aug 15, 2018 2:03 am

Re: Sending output of multiple commands to a file

Thu Sep 26, 2019 6:44 pm

In my project Mikrotik for Splunk, I do get this information using syslog to send it out of all routers.
Not what I was looking for, but I see what you did. Thanks. I'm looking to store the information directly into a file rather than a remote log server.
 
crowfeatherjoe
just joined
Posts: 11
Joined: Mon Jan 07, 2019 8:09 pm
Location: California

Re: Sending output of multiple commands to a file

Fri Oct 07, 2022 9:14 pm

did you ever get this working? im trying to figure something out as well in the same vein now
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Sending output of multiple commands to a file

Sat Oct 08, 2022 8:41 am

Remember that high write counts of file may wear out the routers flash.
 
BrookXVll
just joined
Posts: 7
Joined: Sat Jul 23, 2022 1:13 pm

Re: Sending output of multiple commands to a file

Tue Oct 11, 2022 5:24 pm

:local Resource [/system resource print]
:local Routerboard [/system routerboard print]
:local Identity [system identity print]
:local Service [/ip service print]

:local DeviceInfo ($Resource . "\r" . $Routerboard . "\r" . $Identity . "\r" . $Service)

:execute script=":put $DeviceInfo" file=DeviceInfo.txt
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11968
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Sending output of multiple commands to a file

Tue Oct 11, 2022 7:44 pm

Better this...
:execute script="/system resource print; /system routerboard print; /system identity print; /ip service print;" file=DeviceInfo.txt

Who is online

Users browsing this forum: diamuxin and 28 guests