Once the module is setup and ready, a drush command should be provided that will allow running monitor tasks by tag.
This command should be compatible with drush 8 and 9.
Additionally, this ticket should include updating the associated drush command documentation here:
https://www.drupal.org/docs/8/modules/system-monitor/drush
The update should include a sample usage of the command and what it does.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3074971-11.patch | 12.44 KB | robpowell |
| #9 | SM-3074971--drush-to-run-monitor.patch | 672 bytes | robpowell |
Comments
Comment #2
merauluka commentedUpdated the original ticket description to include updating the documentation page as part of this ticket.
Comment #3
merauluka commentedUpdated ticket description to more accurate describe the work needed.
Comment #4
merauluka commentedNow that I have worked on the monitor tagging issue, I think that we'll want to have a option in this drush command to run either tasks or full monitors with certain tags. So if someone wants to tag a monitor, then running the drush command would trigger all active tasks in that monitor. And if they run it at the task level, it would run all tasks that contain the tag.
One thing I'm not sure of though, If we do it this way, should we run all tasks with the tag, regardless of whether they're active in a monitor, or should we only run active tasks? Maybe we should make the default for active tasks and an override that runs all tasks, regardless of whether or not they're associated with a monitor?
But maybe that doesn't make sense. Because if we run an inactive monitor, it wouldn't/shouldn't trigger notifications I'd think.
What are your thoughts @robpowell?
Comment #5
robpowellClarification on the requirements, I would prefer to make the drush 8 command then update all the command to drush 9 in another ticket.
I think we should honor disabled property of the task. It sounds like the drush command should be able to do the following:
If I have this right, the drush command should have two parameters, type to to run (monitor/task) and machine names of entities. There will also be an option to accept flag name. Do this sound right to you?
Comment #6
robpowellComment #7
merauluka commented@robpowell That sounds right on the money.
Comment #8
robpowellComment #9
robpowellSo having an interesting bug where the drush command fails when running ddev . drush sm:run monitor. If I look at watchdog logs,
If I run the service through the a form, basically debugging outside of drush, It passes without issue
When I go to /admin/config/system/system-monitor/configure I get a message "success" which means the task ran. To run, you will need to download and enable https://gitlab.com/merauluka/system-monitor-demo.
Comment #10
robpowellComment #11
robpowellAh ha! It turns out exploding an empty string gives you an array with an empty value NOT an empty array. Here's the code in its entirety.
Comment #12
merauluka commentedLooks good to me! Let's merge.
Comment #14
robpowellmerged into 8.x-1.x
Comment #15
robpowell