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

Module_crontab sintax rules #201

Open
f-alemauro opened this issue Jun 24, 2022 · 7 comments
Open

Module_crontab sintax rules #201

f-alemauro opened this issue Jun 24, 2022 · 7 comments

Comments

@f-alemauro
Copy link

Hello,
first of all thank you for your amazing work, I'm using pandorafms tool to remotely monitoring IoT sensors and it works great!

But, I'm facing a strange issue with module_crontab syntax. I'm trying to setup a check that runs every five minutes, so I'm setting up a module with

"module_crontab */5 * * * * command"
or
"module_crontab 0,5,10,15,20,25,30.....,50,55 * * * * command"

but the pandorafms service keep saying that the crontab expression is not correct.
I'm pretty sure it is. How should the expression be? Are there any limitations to the cron expression?

I'm running a pandora agent V"7.0NG.759" (downloaded from this link https://sourceforge.net/projects/pandora/files/Pandora%20FMS%207.0NG/759/Tarball/) on Raspberri PI 4 with Raspbian Buster.

@JimmyOlano
Copy link

¡Hi!

From official DokuWiki:

https://pandorafms.com/manual/en/documentation/02_installation/05_configuration_agents#module_crontab

You need put command in another line with module_exec, full example:

 module_begin
 module_name crontab_test
 module_type generic_data
 module_exec script.sh
 module_crontab * 12-15 * * 1
 module_end

@f-alemauro
Copy link
Author

Tried but didn't work:

Incorrect cron syntax '*/5 * * * *'. This module (module Database_events) will be executed always

This is the module

module_begin
module_name Database_events
module_type generic_data
module_exec sqlite3 ****etc etc
module_condition > 60 systemctl restart easycounter.service; systemctl restart webinterface.service; systemctl restart nginx.service
module_group Database
module_description Check the presence of line events; returns the number of minutes since last line event. It restarts the service in case of critical condition
module_min_warning 30
module_max_warning 59
module_min_critical 60
module_max_critical 1440
module_max 1440
module_min 0
module_crontab */5 * * * *
module_end

@JimmyOlano
Copy link

(🤔 Interesting Sqlite3 example: module_exec sqlite3 temp.db "SELECT abs(random() % 1440);" ).

module_crontab */5 * * * *

Step values are not documented... but default time for agents is 300 seconds, maybe you do not need module_crontab command.

@f-alemauro
Copy link
Author

(🤔 Interesting Sqlite3 example: module_exec sqlite3 temp.db "SELECT abs(random() % 1440);" ).

😁

Step values are not documented...

Do you mean I cannot use it?

but default time for agents is 300 seconds, maybe you do not need module_crontab command.

What if my default agent time is 30 seconds but I need this module to run every 300secs?

What I'm trying to achieve is running this module every 5 minutes (regardless the default agent time) from 10am to 12am and from 3pm to 8pm.

@f-alemauro
Copy link
Author

Hi!
Is there any syntax reference for crontab expression in PandoraFMS?

Thanks

@fbsanchez
Copy link
Member

Hi, use 5,10,15.... seems its not allowed yet to use wildcards :(

@f-alemauro
Copy link
Author

thank you @fbsanchez, I'll stick with the list!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants