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

🐛 [SCRUTINY_FA] Addon doesn't respect scheduling option #1324

Closed
flopon opened this issue Mar 28, 2024 · 18 comments
Closed

🐛 [SCRUTINY_FA] Addon doesn't respect scheduling option #1324

flopon opened this issue Mar 28, 2024 · 18 comments
Labels
bug Something isn't working Priority

Comments

@flopon
Copy link

flopon commented Mar 28, 2024

Description

Addon doesn't seem to respect the 'Hourly' scheduling option :

Scrutiny

Reproduction steps

1. Select 'Hourly' updates
2. Data collection is still only done daily (or at least only sent to distant collector on daily basis)

Addon Logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 

-----------------------------------------------------------
 Add-on: Scrutiny (Full Access)
 Scrutiny WebUI for smartd S.M.A.R.T monitoring (Full Access)
-----------------------------------------------------------
 Add-on version: v0.8.0-3
 You are running the latest version of this add-on.
 System: Home Assistant OS 12.1  (amd64 / generic-x86-64)
 Home Assistant Core: 2024.3.3
 Home Assistant Supervisor: 2024.03.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 00-global_var.sh: executing... 
COLLECTOR_API_ENDPOINT='http://x.x.x.x:8080'
COLLECTOR_HOST_ID='HAos'
Mode='Collector'
SMARTCTL_COMMAND_DEVICE_TYPE='auto'
TZ='Europe/Paris'
Updates='Hourly'
expose_collector='false'
[cont-init.d] 00-global_var.sh: exited 0.
[cont-init.d] 01-config_yaml.sh: executing... 
[cont-init.d] 01-config_yaml.sh: exited 0.
[cont-init.d] 01-configuration.sh: executing... 
Updating folders structure
mkdir: cannot create directory '/data/config': File exists
[cont-init.d] 01-configuration.sh: exited 1.
[cont-init.d] 01-custom_script.sh: executing... 
[cont-init.d] 01-custom_script.sh: exited 0.
[cont-init.d] 01-timezone: executing... 
[cont-init.d] 01-timezone: exited 0.
[cont-init.d] 32-nginx_ingress.sh: executing... 
[cont-init.d] 32-nginx_ingress.sh: exited 0.
[cont-init.d] 50-cron-config: executing... 
[cont-init.d] 50-cron-config: exited 0.
[cont-init.d] 90-run.sh: executing... 
[19:21:05] WARNING: Collector only mode. WebUI and Influxdb will be disabled
[19:21:05] INFO: Using 'COLLECTOR_API_ENDPOINT' http://x.x.x.x:8080
[cont-init.d] 90-run.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
starting cron
starting scrutiny collector (run-once mode. subsequent calls will be triggered via cron service)
[services.d] done.
2024/03/28 19:21:05 No configuration file found at /opt/scrutiny/config/collector.yaml. Using Defaults.

 ___   ___  ____  __  __  ____  ____  _  _  _  _
/ __) / __)(  _ \(  )(  )(_  _)(_  _)( \( )( \/ )
\__ \( (__  )   / )(__)(   )(   _)(_  )  (  \  /
(___/ \___)(_)\_)(______) (__) (____)(_)\_) (__)
AnalogJ/scrutiny/metrics                                dev-0.8.0
time="2024-03-28T19:21:05+01:00" level=info msg="Verifying required tools" type=metrics

time="2024-03-28T19:21:05+01:00" level=info msg="Executing command: smartctl --scan --json" type=metrics
time="2024-03-28T19:21:05+01:00" level=info msg="Executing command: smartctl --info --json /dev/sda" type=metrics
time="2024-03-28T19:21:05+01:00" level=info msg="Generating WWN" type=metrics
time="2024-03-28T19:21:05+01:00" level=info msg="Sending detected devices to API, for filtering & validation" type=metrics
time="2024-03-28T19:21:05+01:00" level=info msg="Collecting smartctl results for sda\n" type=metrics
time="2024-03-28T19:21:05+01:00" level=info msg="Executing command: smartctl --xall --json --device sat /dev/sda" type=metrics
time="2024-03-28T19:21:05+01:00" level=info msg="Publishing smartctl results for 0x5001b448b89cdc90\n" type=metrics
time="2024-03-28T19:21:05+01:00" level=info msg="Main: Completed" type=metrics

Architecture

amd64

OS

HAos

@flopon flopon added the bug Something isn't working label Mar 28, 2024
@flopon flopon changed the title [SCRUTINY_FA] Addon doesn't respect scheduling option 🐛 [SCRUTINY_FA] Addon doesn't respect scheduling option Mar 28, 2024
@alexbelgium
Copy link
Owner

Hi thanks I'll look at it perhaps the upstream code for durations has changed

@alexbelgium
Copy link
Owner

Thanks! indeed it seems something changed in the code along the way I'll check how to restore it

Copy link
Contributor

github-actions bot commented Apr 8, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Element will be closed automatically label Apr 8, 2024
@alexbelgium alexbelgium removed the stale Element will be closed automatically label Apr 8, 2024
@alexbelgium
Copy link
Owner

Thanks I see actually the error is mkdir: cannot create directory '/data/config': File exists which prevents the collector to be configured. Very strange error though...

Do you have the web terminal app enabled? If yes you could try to run docker exec addon_db21ed7f_scrutiny_fa rm -r /data/config then docker exec addon_db21ed7f_scrutiny_fa mkdir -p /data/config and restart to see if the error disappeared !

@flopon
Copy link
Author

flopon commented Apr 10, 2024

Hi.

Thank you trying to investigate on this issue.
Removed the /data/config directory using console. Error message vanished, but still no hourly updates
Also tried to uninstall the addon and do a docker cleaning, no more error message too, but still no hourly updates.
For your information, there is nothing in the /data/config directory, is the config supposed to be stored here ?

In any case, configuration.sh now seems to execute properly, showing The INFO message regarding Hourly updates :
[cont-init.d] 01-configuration.sh: executing...
Updating folders structure
[11:14:18] INFO: Hourly updates
[cont-init.d] 01-configuration.sh: exited 0.

But :
image
image

Maybe there is a conflict between your 50-cron-config, and AnalogJ one ?

@alexbelgium
Copy link
Owner

Hi, actually my code uses the AnalogJ one - I just inject the appropriate env variable according to the user selected choice... From your cat command I see that the injection actually works and it is passed to cron... Or is my cron code wrong ? "0 * * * *" should mean that it runs at the 0 minute of every hour... So not sure where the issue could lie...

In /data/config I see a database but that's probably for local systems opposed to yours

# Align update with options
FREQUENCY="$(bashio::config 'Updates')"
bashio::log.info "$FREQUENCY updates"
case "$FREQUENCY" in
"Hourly")
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 * * * *\"" /etc/cont-init.d/50-cron-config
;;
"Daily")
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * *\"" /etc/cont-init.d/50-cron-config
;;
"Weekly")
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * 0\"" /etc/cont-init.d/50-cron-config
;;
esac

@flopon
Copy link
Author

flopon commented Apr 10, 2024

No, your code is not wrong !

Following my last atempt to cleanup all the thing, and reinstall your addon, it finally start to work as intented just after I sent my previous message.

And I suspect the issue was on AnalogJ side, he has just released an new version, with a fix regarding CRON, not working as expected in the previous version. (see AnalogJ/scrutiny#602)

Thank you in any case !

@flopon flopon closed this as completed Apr 10, 2024
@hiagocosta
Copy link

is it possible to set more frequently updates, alike avery 10 minutes or set this manually?
will be a great update for this addon, since i'm planning to monitor temperature of my disks

@tismofied
Copy link

No, your code is not wrong !

Following my last atempt to cleanup all the thing, and reinstall your addon, it finally start to work as intented just after I sent my previous message.

And I suspect the issue was on AnalogJ side, he has just released an new version, with a fix regarding CRON, not working as expected in the previous version. (see AnalogJ/scrutiny#602)

Thank you in any case !

If I am facing the hourly update not triggering, you think I should reinstall the addon ?

@alexbelgium
Copy link
Owner

is it possible to set more frequently updates, alike avery 10 minutes or set this manually? will be a great update for this addon, since i'm planning to monitor temperature of my disks

Honestly not sure you'll really increase the quality of measurement with nearer measurements due to the inertia of disks? Perhaps this would more show the variability of the measurement more than more precise info about the disks

@hiagocosta
Copy link

I got the temperature of the disks by this addon, so when the temp increase, it starts a fan to cooling down it, if the disk not decrease the temp, the fan keeps on until the next temp update (then it will be in 1 hour using the less update available)

@alexbelgium
Copy link
Owner

I've added a Quarterly option (every 15 min)

alexbelgium added a commit that referenced this issue Nov 2, 2024
@hiagocosta
Copy link

Thank you Alex!! I appreciate that!

@alexbelgium
Copy link
Owner

BTW you can also use this guide https://github.com/alexbelgium/hassio-addons/wiki/Add%E2%80%90ons-feature-:-customisation to execute your own cron with your own timings!

@hiagocosta
Copy link

hiagocosta commented Nov 12, 2024 via email

@alexbelgium
Copy link
Owner

Ah - my fault now I realize that scutiny doesn't use an external config which enables the whole script injection system... Well ok I'll think of a way to make a customizable cron

@alexbelgium
Copy link
Owner

I've pushed a new feature. if you select "Custom" as "Updates" variable, you can define specific updates in natural language in the "Updates_custom_time" field. Example : select "Custom" as "Updates", then type a custom intervals like "5m", "2h", "1w", or "2mo" to have an update every 5 minutes, or every 2 hours, or evey week, or every 2 months

@hiagocosta
Copy link

hiagocosta commented Nov 13, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority
Projects
None yet
Development

No branches or pull requests

4 participants