Open SvenPausH opened 9 months ago
Hi Sven,
/system/script/run ddns-hetzner
:log error "[Hetzner DDNS] DEBUG"
command starting in the 1st line
b. Run the script
c. Check the log can find the log message Hetzner DDNS] DEBUG
d. If you CAN see the message, move it part, by part down the script and check when you don't get a message anymore.
e. If you CAN'T see the message, check your logging configuration. Mine is configured as following:
[xxx@xxx] > /system/logging/print
Flags: * - DEFAULT
Columns: TOPICS, ACTION
# TOPICS ACTION
0 * info memory
1 * error memory
2 * warning memory
3 * critical echo
Hi, i have 4 Lines whith errors.
Line 134:
:set apiResponse ([/tool/fetch "$apiUrl/zones?page=$apiNextPage&search_name=$configZone" http-method=get http-header-field="Auth-API-Token:$apiKey" output=user as-value]->"data");
Line 162
:local records ([$JSONLoads ([/tool/fetch "$apiUrl/records?zone_id=$zoneId" http-method=get http-header-field="Auth-API-Token:$apiKey" output=user as-value]->"data")]->"records");
Line 171
:set apiResponse ([/tool/fetch "$apiUrl/records/$recordId" http-method=put http-header-field="Content-Type:application/json,Auth-API-Token:$apiKey" http-data=$payload output=user as-value]->"status");
Line 173
:set apiResponse ([/tool/fetch "$apiUrl/records" http-method=post http-header-field="Content-Type:application/json,Auth-API-Token:$apiKey" http-data=$payload output=user as-value]->"status");
If I comment this out then the script runs. Do you see the error?
Hi, ok i understand.
:set apiResponse ([/tool/fetch "$apiUrl/zones?page=$apiNextPage&search_name=$configZone" http-method=get http-header-field="Auth-API-Token:$apiKey" output=user as-value]->"data");
There ist a slash to much /tool fetch is better
:set apiResponse ([/tool fetch "$apiUrl/zones?page=$apiNextPage&search_name=$configZone" http-method=get http-header-field="Auth-API-Token:$apiKey" output=user as-value]->"data");
Hmm /tool fetch
and /tool/fetch
should work both the same (you can test this also in the terminal).
What I think is that the JParseFunctions are not loaded correctly.
Please try to load the JParseFuctions from your Terminal (so they are available for the whole system)
/system script run "JParseFunctions"; global JSONLoad; global JSONLoads; global JSONUnload
And run the script again afterwards.
If this works for you I would suggest to run the JParseFuctions via the Scheduler on startup.
[xxx@xxx] > /system/scheduler/print
Columns: NAME, START-DATE, START-TIME, INTERVAL, ON-EVENT, RUN-COUNT
# NAME START-DATE START-TIME INTERVAL ON-EVENT RUN-COUNT
0 xxx startup 0s xxx 0
1 JParseFunctions startup 0s JParseFunctions 0
2 ddns-hetzner 2023-11-10 00:00:00 5m ddns-hetzner 21810
[xxx@xxx] > /system/scheduler/print detail value-list from=JParseFunctions
name: JParseFunctions
start-time: startup
interval: 0s
on-event: JParseFunctions
owner: xxx
policy: read,write,test
run-count: 0
Hello, No, unfortunately it's not what you think. Which ROS version do you have? I still have v6. Has anything changed in v7?
[admin@MikroTik4011] > /tool fetch failure: required parameters missing
[admin@MikroTik4011] > /tool/fetch
expected command name (line 1 column 6)
I'm on ROS 7, since it was the default for my device (RB5009). Don't know if anything has changed, but I guess since both options (with slashes or spaces as seperators) are working on v7. But haven't looked into it detailed, so you have to check it by yourself. I'm sorry.
When you've fixed it for v6 (and it's also working for v7, without using deprecated options and/or behavior). I'm happy to merge a PR :)
Hello, in ROS7 both spellings are permitted. If you adapt your script it will run with ROS6 and ROS7.
MMM MMM KKK TTTTTTTTTTT KKK
MMMM MMMM KKK TTTTTTTTTTT KKK
MMM MMMM MMM III KKK KKK RRRRRR OOOOOO TTT III KKK KKK
MMM MM MMM III KKKKK RRR RRR OOO OOO TTT III KKKKK
MMM MMM III KKK KKK RRRRRR OOO OOO TTT III KKK KKK
MMM MMM III KKK KKK RRR RRR OOOOOO TTT III KKK KKK
MikroTik RouterOS 7.12.1 (c) 1999-2023 https://www.mikrotik.com/
Press F1 for help
[admin@MikroTik] > /tool/fetch
failure: required parameters missing
[admin@MikroTik] > /tool fetch
failure: required parameters missing
[admin@MikroTik] >
Seems like: https://mikrotik.com/download/changelogs#show-tab-tree_1-id-7cd31cf6820896d838535a73cafb15ca
But they state:
!) new Command Line Interface (CLI) style (RouterOS v6 commands are still supported);
They state, it's still supported, I don't know how long they will carry the old CLI version with them and I don't want to downgrade my script to an "old" cli version.
Also I don't plan to build a v6 compatible version by myself, since 1st I'm not interested in and 2nd I currently don't have to time to do so.
However, as I wrote previously I'm happy to accept a PR with a RouterOS v6 compatible version of the script.
Hello Philipp, I created the script with the mikrotik json parser. Unfortunately the script doesn't work. No message appears in the log and I don't understand why.