Trigger action when WebUI is not opened #2845
-
Describe the bug To Reproduce Expected behavior Desktop (please complete the following information):
|
Beta Was this translation helpful? Give feedback.
Replies: 9 comments
-
Is this the same as #1879? |
Beta Was this translation helpful? Give feedback.
-
Hi @attilabalazsy , it is not directly related to the issue #1879. For the moment, the Glances architecture do not allow actions to be triggered if no client are connected (in order to avoid resource consumption is no client are connected). We know that it's a limitation that will be solved by design in future version (perhaps version 4). For the current branch (Glances 3.x), i will try to have a look if a workaround is possible. Any ideas are welcomes. |
Beta Was this translation helpful? Give feedback.
-
Hi @nicolargo, Thanks for your answer and confirmation. Unfortunately I cannot really do any suggestion from architectural side. From user side, I can: As a workaround I'm using a cron job (through Ofelia) to read the web: This is correctly triggering the actions. If this is an issue for limited number of users, then maybe you can just make it optionally (enable-auto-trigger: on/off). As an easiest workaround would be the same, I'm doing, but internally. There could be an internal cron job :) Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Hey @attilabalazsy can you explain your solution? How and why are you calling Kuma instead of directly to notification service? |
Beta Was this translation helpful? Give feedback.
-
Hi @Metatropics, currently I'm doing the following:
notify.sh: The issue here is, that Glances is triggering AMP and alerts only, when you open it in a browser. Which is wrong in my case, as I would like to use it as a background monitoring service. As a workaround I use a cron job (through Ofelia) to simulate the web (wget), which is then triggering all othe other internal processes, described above. |
Beta Was this translation helpful? Give feedback.
-
I have a possible workaround for your need. As i said, Glances actions are only triggered if a client is connected. When a server with a -w option is launch, nothing is done until a client send a request. By client we mean the Glances Web UI or a simple "curl" process ran every 'n' minutes. My proposal is to create a simple glancestrigger.sh script:
-s si for silent mode Then cron this script every 'n' minutes.
With this configuration, actions should be triggered. Can you give it a try on your configuration and tell us if it is working ? Additional note: if you want to go lower than every minute (why ?), please read this. Lower n is, higher is the CPU consumption. |
Beta Was this translation helpful? Give feedback.
-
@nicolargo thanks for your response. Currently I'm using a very similar approach, but instead of calling the API endpoint, I'm requesting the site itself, using "curl http://localhost:61208". Is there any difference calling "curl http://localhost:61208" and "curl -s -o /dev/null http://:61208/api/3/all"? I'm not executing the cron tasks directly but through ofelia. |
Beta Was this translation helpful? Give feedback.
-
It is more or less the same thinks. When you use the site, it will request the static page (JS) then the static page calls the API end-point. Note that if you never use the "page" you can run Glances with the --disable-webui in order to disable the JS and only expose the API. |
Beta Was this translation helpful? Give feedback.
-
This issue is stale because it has been open for 3 months with no activity. |
Beta Was this translation helpful? Give feedback.
@attilabalazsy
I have a possible workaround for your need. As i said, Glances actions are only triggered if a client is connected. When a server with a -w option is launch, nothing is done until a client send a request. By client we mean the Glances Web UI or a simple "curl" process ran every 'n' minutes.
My proposal is to create a simple glancestrigger.sh script:
-s si for silent mode
-o is to redirect the output to a file (nothing with /dev/null)
is the IP @ or name of your Glances server (or localhost if your script is ran on the same host.
Then cron this script every 'n' minutes.