Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mass Add Sites via Command Line Interface (CLI) #4308

Open
1 task done
Xliff opened this issue Jan 2, 2024 · 7 comments
Open
1 task done

Mass Add Sites via Command Line Interface (CLI) #4308

Xliff opened this issue Jan 2, 2024 · 7 comments
Labels
area:api concearning the api or automation area:core issues describing changes to the core of uptime kuma feature-request Request for new features to be added

Comments

@Xliff
Copy link

Xliff commented Jan 2, 2024

⚠️ Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find similar feature request

🏷️ Feature Request Type

API, Other

🔖 Feature description

Is there a way that one can add sites from the command line? The UI is well done and useful, but I have dozens of sites I'd like to add (I'm a new Kuma user, and this is a new install), but I'd rather not have to maintain them, en-mass, by hand.

✔️ Solution

I'll probably end up attempting to reverse engineer this, as I have an Immediate need for it. Are there technical documentations that I can use to assist in this?

❓ Alternatives

No response

📝 Additional Context

No response

@Xliff Xliff added the feature-request Request for new features to be added label Jan 2, 2024
@CommanderStorm CommanderStorm changed the title [ Request ] Mass Add Sites via Command Line Mass Add Sites via Command Line Interface (CLI) Jan 2, 2024
@CommanderStorm CommanderStorm added the area:core issues describing changes to the core of uptime kuma label Jan 2, 2024
@CommanderStorm
Copy link
Collaborator

Currently, there is no CLI and adding one is blocked by #118 imo.
See PR #3854 for further details on planned progress.

@CommanderStorm
Copy link
Collaborator

I'll probably end up attempting to reverse engineer this, as I have an Immediate need for it. Are there technical documentations that I can use to assist in this?

Note that third partys have created an api wrapper around our websockets:
https://uptime-kuma-api.readthedocs.io/en/latest/

@Xliff
Copy link
Author

Xliff commented Jan 3, 2024

Where can I find details on the WebSocket messaging? Has this been documented?

UPDATE: Given that using the WebSockets appears to not be the preferred method, and that I do not know Python (yet), is there a way to add monitors via accessing the kuma.db file and adding information to the tables therein?

Please note, I am not looking for something permanent. I just need to get our sites into some form of monitoring now and am willing to look, code, document methods for formally adding them later.

Thanks for your hard work in developing this tool! Works nicely!

@CommanderStorm CommanderStorm added the area:api concearning the api or automation label Jan 18, 2024
@CommanderStorm
Copy link
Collaborator

is there a way to add monitors via accessing the kuma.db file and adding information to the tables therein?

You can do that, but I would recomend using the third party python api instead.

see https://uptime-kuma-api.readthedocs.io/en/latest/api.html

from uptime_kuma_api import UptimeKumaApi
api = UptimeKumaApi('INSERT_URL')
api.login('INSERT_USERNAME', 'INSERT_PASSWORD')
api.add_monitor(
    type=MonitorType.HTTP,
    name="Google",
    url="https://google.com"
)
api.disconnect()

@Xliff
Copy link
Author

Xliff commented Jan 18, 2024

I did manage to write something in Raku that worked out. Would you like me to share that code?

@CommanderStorm
Copy link
Collaborator

CommanderStorm commented Jan 18, 2024

Given the scarily complex syntax of said language, I am a bit doubtful that we could use that code, but sure share it ^^

(Why I am doubtful https://www.youtube.com/watch?v=9J0vCQ36020)

@Xliff
Copy link
Author

Xliff commented Jan 27, 2024

ROFLMAO!!!

Don't believe the hype.

I was able to do the addition script in less than a day. If said syntax was so scarily complex, I wouldn't have been able to do half of the things I've been able to accomplish in it.

(And I have over 1 million lines in over 65 separate projects in less than 6 years to prove it...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:api concearning the api or automation area:core issues describing changes to the core of uptime kuma feature-request Request for new features to be added
Projects
None yet
Development

No branches or pull requests

2 participants