Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Feature Requests
  3. Expose disk usage / free space to API (preferably with a readonly token)

Expose disk usage / free space to API (preferably with a readonly token)

Scheduled Pinned Locked Moved Feature Requests
disk spaceapimonitor
20 Posts 5 Posters 3.1k Views 6 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    msbt
    App Dev
    wrote on last edited by
    #1

    From here. So we can monitor the space with tools like Grafana to avoid running out, because the check and notification mails aren't always reliable.

    1 Reply Last reply
    1
    • M Offline
      M Offline
      msbt
      App Dev
      wrote on last edited by
      #2

      Is there something new to report on this? I just had a server that hit 100% disk space because of the new base image and mail storage but there was no email going out. It was pure luck that I saw that (still a few MB left) to avoid bigger problems. The readonly token is available I see, thanks for that!

      How does everybody else monitor their diskspace?

      girishG 1 Reply Last reply
      2
      • M msbt

        Is there something new to report on this? I just had a server that hit 100% disk space because of the new base image and mail storage but there was no email going out. It was pure luck that I saw that (still a few MB left) to avoid bigger problems. The readonly token is available I see, thanks for that!

        How does everybody else monitor their diskspace?

        girishG Do not disturb
        girishG Do not disturb
        girish
        Staff
        wrote on last edited by
        #3

        @msbt AFAIK, linux provides no event for disk usage. So, one just has to poll a lot. du based polling can churn the disk a lot.

        I would also like to know how this is done outside Cloudron.

        M robiR 2 Replies Last reply
        1
        • girishG girish

          @msbt AFAIK, linux provides no event for disk usage. So, one just has to poll a lot. du based polling can churn the disk a lot.

          I would also like to know how this is done outside Cloudron.

          M Offline
          M Offline
          msbt
          App Dev
          wrote on last edited by
          #4

          @girish but we do have the Cloudron notification, it just doesn't send out an email about it. Could we make that a webhook or something so we can trigger alerts? I think that was the case once (email notification), but not anymore it seems.

          girishG 1 Reply Last reply
          0
          • girishG girish

            @msbt AFAIK, linux provides no event for disk usage. So, one just has to poll a lot. du based polling can churn the disk a lot.

            I would also like to know how this is done outside Cloudron.

            robiR Offline
            robiR Offline
            robi
            wrote on last edited by
            #5

            @girish things that don't churn disk are non filesystem based polling, such as /proc or other similar kernel based APIs.

            This can also be done in a multi stage way, for example, monitoring a /proc node for inodes that lets you know of a calculated threshold being reached after which you can query disks or filesystem for more specificity.

            Conscious tech

            1 Reply Last reply
            0
            • M msbt

              @girish but we do have the Cloudron notification, it just doesn't send out an email about it. Could we make that a webhook or something so we can trigger alerts? I think that was the case once (email notification), but not anymore it seems.

              girishG Do not disturb
              girishG Do not disturb
              girish
              Staff
              wrote on last edited by
              #6

              @msbt ah ok, so you just want better notifications . Can do that.

              In 7.3.4 atleast, we started collecting du information in a cron job (every 24 hours).

              M 1 Reply Last reply
              1
              • girishG girish

                @msbt ah ok, so you just want better notifications . Can do that.

                In 7.3.4 atleast, we started collecting du information in a cron job (every 24 hours).

                M Offline
                M Offline
                msbt
                App Dev
                wrote on last edited by msbt
                #7

                @girish yes, I just want to get notified either by Cloudron via email (because I'm not always logging in and seeing the notifications) or some other means (i.e. regularly checking an API endpoint) if disk space is running low. It's not about individual space usage of apps, just the df of the main disk

                1 Reply Last reply
                1
                • M Offline
                  M Offline
                  msbt
                  App Dev
                  wrote on last edited by
                  #8

                  So I just had another machine hitting 100% disk usage without getting notified via email, only the Cloudron notification inside the dashboard (which was pure luck that I opened it up, could have cought it much later):

                  image.png

                  What's the current status there, was there supposed to be an email or did that get removed with the other notifications (i.e. backup failed). If so, what's the best way to get notified outside of Cloudron if a server is running low on space?

                  1 Reply Last reply
                  0
                  • girishG Do not disturb
                    girishG Do not disturb
                    girish
                    Staff
                    wrote on last edited by
                    #9

                    There is no email currently. We used to have one but when there is no disk space usually you cannot send emails from the server itself either. We have to find some other way of notifications (i.e like a external webhook).

                    robiR M 2 Replies Last reply
                    0
                    • girishG girish

                      There is no email currently. We used to have one but when there is no disk space usually you cannot send emails from the server itself either. We have to find some other way of notifications (i.e like a external webhook).

                      robiR Offline
                      robiR Offline
                      robi
                      wrote on last edited by
                      #10

                      @girish that is too late and not the time to worry about sending email/notifications. It's well before then!

                      Conscious tech

                      1 Reply Last reply
                      1
                      • girishG girish

                        There is no email currently. We used to have one but when there is no disk space usually you cannot send emails from the server itself either. We have to find some other way of notifications (i.e like a external webhook).

                        M Offline
                        M Offline
                        msbt
                        App Dev
                        wrote on last edited by
                        #11

                        @girish wasn't there a threshold when that message apperars? Should be plenty of space to send an email (also, my servers are all using Postmark, maybe that would make it easier to send those messages too?)

                        I would rather get too many emails than having to recover a Cloudron because it ran oos 😉 But any kind of notificaton/webhook/api endpoint to monitor disk space would be much appreciated, that's one of my biggest concerns these days.

                        1 Reply Last reply
                        1
                        • nebulonN Offline
                          nebulonN Offline
                          nebulon
                          Staff
                          wrote on last edited by
                          #12

                          At least in the past usually the situation was happening very fast and not that much over time. For example a Cloudron having local disk backups enabled and a backup run quickly fills up the disk or someone syncing large amounts of data via Nextcloud at once.

                          M 1 Reply Last reply
                          0
                          • nebulonN nebulon

                            At least in the past usually the situation was happening very fast and not that much over time. For example a Cloudron having local disk backups enabled and a backup run quickly fills up the disk or someone syncing large amounts of data via Nextcloud at once.

                            M Offline
                            M Offline
                            msbt
                            App Dev
                            wrote on last edited by
                            #13

                            @nebulon true, that is probably the reason in many cases, but I have a current one where the platformdata logs are >15GB now due to some errors in an app, that didn't grow over night, but still rapidly. Plenty of time to act on it though, if I have a notifcation about it 😉

                            1 Reply Last reply
                            0
                            • timconsidineT Offline
                              timconsidineT Offline
                              timconsidine
                              App Dev
                              wrote on last edited by
                              #14

                              I don't understand the issue here.
                              Simple bash script plus ntfy alerting to telegram
                              du might create disk churn, but I don't think df does, or to a much lesser degree.
                              And it's disk FREE space that needs to be alerted, not the results of what's used (that might be a secondary space if disk free is low)

                              M 1 Reply Last reply
                              1
                              • timconsidineT timconsidine

                                I don't understand the issue here.
                                Simple bash script plus ntfy alerting to telegram
                                du might create disk churn, but I don't think df does, or to a much lesser degree.
                                And it's disk FREE space that needs to be alerted, not the results of what's used (that might be a secondary space if disk free is low)

                                M Offline
                                M Offline
                                msbt
                                App Dev
                                wrote on last edited by
                                #15

                                @timconsidine of course there are ways to do that outside of Cloudron, but since this affects any and all installations, it would be nice if it was shipped with the platform by default, which will also survive migrations and such.

                                It would be cool to set a threshold for any disk and mounted volume in /#/system, either a fixed number or percentage, for when a notification email is sent out.

                                1 Reply Last reply
                                0
                                • timconsidineT Offline
                                  timconsidineT Offline
                                  timconsidine
                                  App Dev
                                  wrote on last edited by timconsidine
                                  #16

                                  I get the desire to have it "in Cloudron".
                                  Equally I would have to say that ntfy is an app on Cloudron, just as Grafana is.
                                  Seems this is more about wanting Grafana support. Which is fine. No objections to that in itself.

                                  However, given the frequency here in the forum of people needing to recover from full disks and the criticality of such events (server down, multiple apps down, recovery work needed), I'm just suggesting a solution that is 'here and now' rather than waiting.

                                  There's a cron tab on every app in Cloudron.

                                  • Install ntfy and set up to send the alerts how you want (mobile app, Telegram)
                                  • add this to a cron entry in an app, setting the user name and password, and also the ntfy app location :
                                    */5 * * * * root_space=$(df -h | grep '/$') && root_usage=$(echo $root_space | awk '{ print int($5) }') && if [ $root_usage -gt 80 ]; then echo "Disk usage alert : $root_usage%" | curl -u user:password -X POST --data "payload@-" https://ntfy.domain.uk/alerts; fi

                                  Automated no hassle alerts for 5 mins work
                                  No excuse for disk full ever again 😄

                                  1 Reply Last reply
                                  2
                                  • timconsidineT Offline
                                    timconsidineT Offline
                                    timconsidine
                                    App Dev
                                    wrote on last edited by
                                    #17

                                    @girish when a Cloudron app is backed up, do the contents of the cron tab get backed up as well ?

                                    robiR 1 Reply Last reply
                                    1
                                    • timconsidineT timconsidine

                                      @girish when a Cloudron app is backed up, do the contents of the cron tab get backed up as well ?

                                      robiR Offline
                                      robiR Offline
                                      robi
                                      wrote on last edited by
                                      #18

                                      @timconsidine easy to test by cloning the app.

                                      Conscious tech

                                      1 Reply Last reply
                                      2
                                      • timconsidineT Offline
                                        timconsidineT Offline
                                        timconsidine
                                        App Dev
                                        wrote on last edited by
                                        #19

                                        @robi true ! good idea

                                        1 Reply Last reply
                                        1
                                        • girishG Do not disturb
                                          girishG Do not disturb
                                          girish
                                          Staff
                                          wrote on last edited by girish
                                          #20

                                          @robi @timconsidine good catch, I don't think it is. Will fix. Opened https://git.cloudron.io/cloudron/box/-/issues/832 to track internally

                                          1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Bookmarks
                                          • Search