Open BeecherNetworks opened 2 years ago
Hi
I had exactly the same issue. I managed to import all my monitors thanks to this little (unoptimized at all ^^) php script.
First I used a csv to json converter somewhere online, then I stored my json in a variable (called $json in my script) I didn't need a lot of informations but you can complete this to your use.
$array = json_decode($json,true);
$servs = array();
foreach ($array as $elt){
$item=array(
"id"=> $elt["ID"],
"name"=> $elt["Friendly Name"],
"url"=> $elt["URL/IP"],
"method"=> "GET",
"body"=> null,
"headers"=> null,
"hostname"=> null,
"port"=> null,
"maxretries"=> 0,
"weight"=> 2000,
"active"=> 1,
"type"=> "keyword",
"interval"=> 60,
"retryInterval"=> 60,
"keyword"=> $elt["Keyword Value"],
"ignoreTls"=> false,
"upsideDown"=> false,
"maxredirects"=> 10,
"accepted_statuscodes"=> '["200-299"]',
"dns_resolve_type"=> "A",
"dns_resolve_server"=> "1.1.1.1",
"dns_last_result"=> null,
"pushToken"=> null,
"notificationIDList"=> '{}',
"tags"=> '[]'
);
$servs[] = $item;
}
$out = json_encode($servs);
$out = str_replace("\/\/","//",$out);
$out = str_replace('"tags":"[]"','"tags": []',$out);
$out = str_replace('"notificationIDList":"{}",','"notificationIDList": {},',$out);
$out = str_replace('"accepted_statuscodes":"[\"200-299\"]",','"accepted_statuscodes": ["200-299"],',$out);
echo $out;
I was only able to get one to import at a time with this, couldn't explain why as it looked right, however I got there in the end, thanks.
For anyone else trying this, you'll need to do an export from Kuma first and enter the output from this into the export, as it only includes the monitors. Also note that the array above uses a "keyword" monitor type rather than the default "http"; you may want to review the other settings too.
I have also created a simple script which uses Socket.io to add monitors from a csv file. It's not an Uptime Robot csv, but I'm adding it here for anyone who may need such functionality.
For anyone who need it now, there is a tool made 2 month ago:
+1 Here, it would be really useful being able to import in any serial way multiple monitors. Not only from Uptime Robot.
Is the current import feature on Uptime Kuma functioning? what's absolutely necessary I can manually massage the .csv if I have to from Uptime Robot.
Is the current import feature on Uptime Kuma functioning?
We currently have no feature to import csv's from Uptime Robot.
I don't know what you mean by I can manually massage the .csv if I have to from Uptime Robot
.
See the other messages in this thread for instructions on how to initialise from such csv file. We have not verified if they work nor checked their security => do your duediligance.
For anyone who need it now, there is a tool made 2 month ago:
I submitted a PR for your repo with some fixes for the Documentation and dockerized a fork of your suggestion on https://git.nixc.us/Nixius/UptimeRobot-Migrator I have no idea if any of this works yet but it made more sense to make it docker in my mind it makes it a touch easier to ensure there's no technical debt accrued once it works.
⚠️ Please verify that this feature request has NOT been suggested before.
🏷️ Feature Request Type
UI Feature
🔖 Feature description
Uptime Kuma imports and exports in CSV format, however Uptime Robot uses CSV. I'd like to be able to import an Uptime Robot CSV file so I can migrate quickly to Kuma, please.
✔️ Solution
Make CSV an accepted format for import, and add code to convert CSV to JSON before importing using the existing code. The UR CSV columns are,
ID | Type | Status | Friendly Name | URL/IP | Keyword Type | Keyword Value | Port
❓ Alternatives
I could probably do it manually, however it would take as long as adding the monitors manually. It seems logical to have it as a feature, so anyone can do it quickly, which should encourage migration.
📝 Additional Context
No response