monit-docker 1.2.0__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. {monit_docker-1.2.0/monit_docker.egg-info → monit_docker-1.3.0}/PKG-INFO +5 -5
  2. {monit_docker-1.2.0 → monit_docker-1.3.0}/README.md +4 -4
  3. monit_docker-1.3.0/RELEASE +1 -0
  4. monit_docker-1.3.0/VERSION +1 -0
  5. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/compose-quickstart-fr.md +50 -2
  6. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/compose-quickstart.md +2 -2
  7. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/compose.md +3 -2
  8. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/config-cli-contract.md +16 -0
  9. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/cron.md +17 -0
  10. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/http-api-contract.md +2 -2
  11. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/index.rst +1 -0
  12. monit_docker-1.3.0/docs/release-1.3.0.md +26 -0
  13. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/roadmap.md +4 -0
  14. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/serve.md +59 -1
  15. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/simple.md +18 -0
  16. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/compose.yaml +1 -1
  17. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/ui/compose.yaml +2 -2
  18. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/__init__.py +1 -1
  19. monit_docker-1.3.0/monit_docker/adapters/command_config.py +56 -0
  20. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/configuration.py +2 -1
  21. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/http.py +4 -3
  22. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/http_routes.py +1 -1
  23. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/http_security.py +7 -2
  24. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/validation.py +15 -3
  25. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/cli.py +56 -9
  26. {monit_docker-1.2.0 → monit_docker-1.3.0/monit_docker.egg-info}/PKG-INFO +5 -5
  27. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker.egg-info/SOURCES.txt +4 -0
  28. {monit_docker-1.2.0 → monit_docker-1.3.0}/setup.yml +2 -2
  29. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_api_contract.py +20 -0
  30. monit_docker-1.3.0/tests/test_direct_command_config.py +58 -0
  31. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_http_token_separation.py +7 -4
  32. monit_docker-1.3.0/tests/test_serve_config.py +83 -0
  33. monit_docker-1.2.0/RELEASE +0 -1
  34. monit_docker-1.2.0/VERSION +0 -1
  35. {monit_docker-1.2.0 → monit_docker-1.3.0}/LICENSE +0 -0
  36. {monit_docker-1.2.0 → monit_docker-1.3.0}/MANIFEST.in +0 -0
  37. {monit_docker-1.2.0 → monit_docker-1.3.0}/bin/monit-docker +0 -0
  38. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/access-checks.md +0 -0
  39. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/alerts.md +0 -0
  40. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/architecture-review-2026-09-27.md +0 -0
  41. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/architecture.md +0 -0
  42. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/audit-migration.md +0 -0
  43. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/audit.md +0 -0
  44. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/beta-decisions.md +0 -0
  45. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/check-config.md +0 -0
  46. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/configuration-validation.md +0 -0
  47. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/contributing.md +0 -0
  48. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/contributors.rst +0 -0
  49. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/deprecation-policy.md +0 -0
  50. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/dwho-http-notifications.md +0 -0
  51. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/filesystems.md +0 -0
  52. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/grafana.md +0 -0
  53. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/healthchecks.md +0 -0
  54. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/images/grafana-cpu.png +0 -0
  55. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/images/grafana-network.png +0 -0
  56. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/images/grafana-overview.png +0 -0
  57. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/images/terminal-containers.png +0 -0
  58. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/images/terminal-details.png +0 -0
  59. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/images/terminal-journal.png +0 -0
  60. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/images/textual-containers.png +0 -0
  61. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/images/textual-journal.png +0 -0
  62. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/images/textual-unavailable.png +0 -0
  63. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/installation-upgrades.md +0 -0
  64. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/journal-compatibility.md +0 -0
  65. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/maintenance.md +0 -0
  66. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/metrics.md +0 -0
  67. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/notifications.md +0 -0
  68. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/performance-resilience.md +0 -0
  69. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/redis-notifications.md +0 -0
  70. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/release-1.0.0.md +0 -0
  71. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/release-1.0.1.md +0 -0
  72. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/release-1.1.0.md +0 -0
  73. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/release-1.1.1.md +0 -0
  74. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/release-1.1.2.md +0 -0
  75. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/release-1.1.3.md +0 -0
  76. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/release-1.1.4.md +0 -0
  77. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/release-1.2.0.md +0 -0
  78. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/restart-limit.md +0 -0
  79. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/runtime-checks.md +0 -0
  80. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/scenarios.md +0 -0
  81. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/shared-terminal.md +0 -0
  82. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/supported-environments.md +0 -0
  83. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/terminal.md +0 -0
  84. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/textual-review.md +0 -0
  85. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/textual.md +0 -0
  86. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/trigger-delay.md +0 -0
  87. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/troubleshooting.md +0 -0
  88. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/tutorial-memory.md +0 -0
  89. {monit_docker-1.2.0 → monit_docker-1.3.0}/docs/ui.md +0 -0
  90. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/grafana/monit-docker.json +0 -0
  91. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/alertmanager.email-slack.yml +0 -0
  92. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/alertmanager.email.yml +0 -0
  93. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/alertmanager.redis.yml +0 -0
  94. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/alertmanager.slack.yml +0 -0
  95. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/alerts.runtime.test.yml +0 -0
  96. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/alerts.runtime.yml +0 -0
  97. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/alerts.test.yml +0 -0
  98. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/alerts.yml +0 -0
  99. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/compose.audit.yaml +0 -0
  100. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/compose.notifications.yaml +0 -0
  101. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/compose.redis.yaml +0 -0
  102. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/dwho-http/http.json +0 -0
  103. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/dwho-http/http.yml +0 -0
  104. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/dwho-http/payload.json +0 -0
  105. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/dwho-http/send.py +0 -0
  106. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/grafana/dashboards.yml +0 -0
  107. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/grafana/datasources.yml +0 -0
  108. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/prometheus-notifications.yml +0 -0
  109. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/prometheus.yml +0 -0
  110. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/redis-webhook/Dockerfile +0 -0
  111. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/redis-webhook/bridge.py +0 -0
  112. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/redis-webhook/requirements.txt +0 -0
  113. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/monitoring/start.sh +0 -0
  114. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/scenarios.yml +0 -0
  115. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/socket-proxy/Dockerfile +0 -0
  116. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/tutorial-memory/compose.yaml +0 -0
  117. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/tutorial-memory/monit-docker.yml +0 -0
  118. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/tutorial-memory/worker.py +0 -0
  119. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/ui/compose.actions.yaml +0 -0
  120. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/ui/compose.journal.yaml +0 -0
  121. {monit_docker-1.2.0 → monit_docker-1.3.0}/examples/ui/prepare.py +0 -0
  122. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/__main__.py +0 -0
  123. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/__init__.py +0 -0
  124. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/access.py +0 -0
  125. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/audit_http.py +0 -0
  126. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/docker.py +0 -0
  127. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/events.py +0 -0
  128. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/filesystems.py +0 -0
  129. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/rules.py +0 -0
  130. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/scenarios.py +0 -0
  131. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/selection.py +0 -0
  132. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/state.py +0 -0
  133. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/stats.py +0 -0
  134. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/syntax.py +0 -0
  135. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/adapters/validation_rules.py +0 -0
  136. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/application.py +0 -0
  137. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/application_state.py +0 -0
  138. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/audit.py +0 -0
  139. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/audit_forward.py +0 -0
  140. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/audit_migrate.py +0 -0
  141. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/audit_query.py +0 -0
  142. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/cli_audit.py +0 -0
  143. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/composition.py +0 -0
  144. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/core/__init__.py +0 -0
  145. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/core/engine.py +0 -0
  146. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/core/manual.py +0 -0
  147. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/core/metrics.py +0 -0
  148. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/core/policy.py +0 -0
  149. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/core/rules.py +0 -0
  150. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/domain/__init__.py +0 -0
  151. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/domain/errors.py +0 -0
  152. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/domain/filesystems.py +0 -0
  153. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/domain/identifiers.py +0 -0
  154. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/domain/maintenance.py +0 -0
  155. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/domain/models.py +0 -0
  156. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/domain/rules.py +0 -0
  157. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/domain/runtime.py +0 -0
  158. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/job.py +0 -0
  159. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/manual_actions.py +0 -0
  160. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/notification_audit.py +0 -0
  161. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/observation.py +0 -0
  162. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/outputs/__init__.py +0 -0
  163. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/outputs/formatting.py +0 -0
  164. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/outputs/prometheus.py +0 -0
  165. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/service.py +0 -0
  166. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/textual_demo.py +0 -0
  167. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/textual_tui.py +0 -0
  168. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker/tui.py +0 -0
  169. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker.egg-info/dependency_links.txt +0 -0
  170. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker.egg-info/requires.txt +0 -0
  171. {monit_docker-1.2.0 → monit_docker-1.3.0}/monit_docker.egg-info/top_level.txt +0 -0
  172. {monit_docker-1.2.0 → monit_docker-1.3.0}/pyproject.toml +0 -0
  173. {monit_docker-1.2.0 → monit_docker-1.3.0}/requirements.txt +0 -0
  174. {monit_docker-1.2.0 → monit_docker-1.3.0}/scripts/capture_textual.py +0 -0
  175. {monit_docker-1.2.0 → monit_docker-1.3.0}/setup.cfg +0 -0
  176. {monit_docker-1.2.0 → monit_docker-1.3.0}/setup.py +0 -0
  177. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_access.py +0 -0
  178. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_access_docker.py +0 -0
  179. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_adapters.py +0 -0
  180. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_application_architecture.py +0 -0
  181. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_audit.py +0 -0
  182. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_audit_migrate.py +0 -0
  183. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_audit_query.py +0 -0
  184. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_audit_stream.py +0 -0
  185. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_beta_decisions.py +0 -0
  186. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_check_config.py +0 -0
  187. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_cli_contract.py +0 -0
  188. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_configuration_schema.py +0 -0
  189. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_core.py +0 -0
  190. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_cron.py +0 -0
  191. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_docker_integration.py +0 -0
  192. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_engine.py +0 -0
  193. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_filesystem_mode.py +0 -0
  194. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_filesystems.py +0 -0
  195. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_health.py +0 -0
  196. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_http_service_boundaries.py +0 -0
  197. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_httpdis_transport.py +0 -0
  198. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_journal_compatibility.py +0 -0
  199. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_maintenance.py +0 -0
  200. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_manual_actions.py +0 -0
  201. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_monit_docker.py +0 -0
  202. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_packaging.py +0 -0
  203. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_resilience.py +0 -0
  204. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_restart_limit.py +0 -0
  205. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_rule_literals.py +0 -0
  206. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_runtime_checks.py +0 -0
  207. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_runtime_docker.py +0 -0
  208. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_scenarios.py +0 -0
  209. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_service.py +0 -0
  210. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_stats_timeouts.py +0 -0
  211. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_stats_transport.py +0 -0
  212. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_terminal_docker.py +0 -0
  213. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_terminal_signals.py +0 -0
  214. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_trigger_delay.py +0 -0
  215. {monit_docker-1.2.0 → monit_docker-1.3.0}/tests/test_tui.py +0 -0
  216. {monit_docker-1.2.0 → monit_docker-1.3.0}/textual_tests/test_textual_tui.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: monit-docker
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: monit-docker
5
5
  Home-page: https://github.com/decryptus/monit-docker
6
6
  Author: Adrien Delle Cave
@@ -49,8 +49,8 @@ Dynamic: summary
49
49
 
50
50
  # monit-docker project
51
51
 
52
- **Current package and image version: [1.2.0](https://github.com/decryptus/monit-docker/tree/v1.2.0)**
53
- — [Release notes and upgrade guidance](docs/release-1.2.0.md).
52
+ **Current package and image version: [1.3.0](https://github.com/decryptus/monit-docker/tree/v1.3.0)**
53
+ — [Release notes and upgrade guidance](docs/release-1.3.0.md).
54
54
 
55
55
  <p align="center">
56
56
  <img src="https://raw.githubusercontent.com/decryptus/monit-docker/v0.0.63/ui/branding/monit-docker-logo.png" alt="monit-docker logo" width="640">
@@ -66,7 +66,7 @@ Dynamic: summary
66
66
  [Documentation (EN)](https://www.monit-docker.com/docs/en/) ·
67
67
  [Live demo](https://demo.monit-docker.com/) ·
68
68
  [Release roadmap](docs/roadmap.md) ·
69
- [1.2.0 release notes](docs/release-1.2.0.md) ·
69
+ [1.3.0 release notes](docs/release-1.3.0.md) ·
70
70
  [Logos and icons](ui/branding/README.md)
71
71
 
72
72
  monit-docker is a free, open-source tool for checking Docker containers and
@@ -77,7 +77,7 @@ container or reloading PHP-FPM when memory usage is high.
77
77
  Compose v2 and curl, run:
78
78
 
79
79
  ```sh
80
- git clone --branch v1.2.0 --depth 1 https://github.com/decryptus/monit-docker.git
80
+ git clone --branch v1.3.0 --depth 1 https://github.com/decryptus/monit-docker.git
81
81
  cd monit-docker
82
82
  ./install.sh
83
83
  ```
@@ -1,7 +1,7 @@
1
1
  # monit-docker project
2
2
 
3
- **Current package and image version: [1.2.0](https://github.com/decryptus/monit-docker/tree/v1.2.0)**
4
- — [Release notes and upgrade guidance](docs/release-1.2.0.md).
3
+ **Current package and image version: [1.3.0](https://github.com/decryptus/monit-docker/tree/v1.3.0)**
4
+ — [Release notes and upgrade guidance](docs/release-1.3.0.md).
5
5
 
6
6
  <p align="center">
7
7
  <img src="https://raw.githubusercontent.com/decryptus/monit-docker/v0.0.63/ui/branding/monit-docker-logo.png" alt="monit-docker logo" width="640">
@@ -17,7 +17,7 @@
17
17
  [Documentation (EN)](https://www.monit-docker.com/docs/en/) ·
18
18
  [Live demo](https://demo.monit-docker.com/) ·
19
19
  [Release roadmap](docs/roadmap.md) ·
20
- [1.2.0 release notes](docs/release-1.2.0.md) ·
20
+ [1.3.0 release notes](docs/release-1.3.0.md) ·
21
21
  [Logos and icons](ui/branding/README.md)
22
22
 
23
23
  monit-docker is a free, open-source tool for checking Docker containers and
@@ -28,7 +28,7 @@ container or reloading PHP-FPM when memory usage is high.
28
28
  Compose v2 and curl, run:
29
29
 
30
30
  ```sh
31
- git clone --branch v1.2.0 --depth 1 https://github.com/decryptus/monit-docker.git
31
+ git clone --branch v1.3.0 --depth 1 https://github.com/decryptus/monit-docker.git
32
32
  cd monit-docker
33
33
  ./install.sh
34
34
  ```
@@ -0,0 +1 @@
1
+ 1.3.0
@@ -0,0 +1 @@
1
+ 1.3.0
@@ -50,7 +50,7 @@ Sur Linux amd64, installer Git, Docker Engine, son plugin Compose v2 avec
50
50
  `up --wait` et curl. Pour le tableau de bord, prévoir Python 3 et OpenSSL.
51
51
 
52
52
  ```sh
53
- git clone --branch v1.2.0 --depth 1 https://github.com/decryptus/monit-docker.git
53
+ git clone --branch v1.3.0 --depth 1 https://github.com/decryptus/monit-docker.git
54
54
  cd monit-docker
55
55
  ./install.sh
56
56
  ```
@@ -137,7 +137,7 @@ Définir `MONIT_DOCKER_PORT`, `UI_PORT` ou `DOCKER_SOCKET_PATH` dans le shell av
137
137
  Compose si nécessaire. `UI_BIND` vaut `127.0.0.1` par défaut. Garder le même nom
138
138
  de projet et le même répertoire pour réutiliser le volume.
139
139
 
140
- Les images de l’agent et de l’UI sont fixées à **1.2.0**. Pour une évolution,
140
+ Les images de l’agent et de l’UI sont fixées à **1.3.0**. Pour une évolution,
141
141
  choisir des versions correspondantes, préserver la configuration et les données,
142
142
  puis utiliser `pull` et `up -d --wait` avec la même liste de fichiers. Un simple
143
143
  `pull` ne remplace pas les conteneurs en cours d’exécution.
@@ -154,6 +154,34 @@ nom de projet d’origine. Pour conserver des jobs, reprendre explicitement leur
154
154
  cibles et règles selon le [guide cron](cron.md), avec un état persistant et une
155
155
  simulation préalable. Aucune conversion automatique des règles n’est effectuée.
156
156
 
157
+ À partir de la version 1.3.0, la commande `monit-docker serve`
158
+ peut aussi lire ses réglages dans `monit-docker.yml`. Exemple :
159
+
160
+ ```yaml
161
+ serve:
162
+ port: 9810
163
+ interval: 60
164
+ rsc: [status, health]
165
+ status_token_file: /run/secrets/status
166
+ ```
167
+
168
+ Une option explicite en ligne de commande est prioritaire. Avec cet exemple,
169
+ `serve --port 9808 --rsc pid` écoute sur 9808, collecte uniquement le PID
170
+ et conserve l’intervalle et le chemin du jeton définis dans le fichier.
171
+ Les listes `rsc` et `cmd` sont remplacées en entier. Pour les noms de clés,
172
+ remplacer les tirets des options longues par des traits de soulignement.
173
+ La simulation ponctuelle utilise toujours `--dry-run`.
174
+ Pour désactiver temporairement un booléen activé dans `serve:`, utilisez
175
+ `--no-allow-actions`, `--no-allow-maintenance` ou `--no-trust-proxy-user`.
176
+
177
+ Pour protéger la lecture de `/v1/status`, montez un fichier secret dans
178
+ l’agent et ajoutez `--status-token-file /run/secrets/status` après `serve`.
179
+ Le fichier contient 64 caractères hexadécimaux minuscules. Utilisez un secret
180
+ distinct pour chaque usage. Les clients envoient le jeton dans l’en-tête Bearer
181
+ de la requête. Si vous utilisez le tableau de bord, configurez son proxy pour
182
+ ajouter cet en-tête uniquement sur la route de statut. Voir le [guide de
183
+ l’agent](serve.md).
184
+
157
185
  ## Continuer avec une démonstration
158
186
 
159
187
  Le [tutoriel mémoire](tutorial-memory.md) ajoute un conteneur jetable et permet
@@ -163,3 +191,23 @@ conteneur et la sélection exacte évitent de prendre un service existant comme
163
191
  La [pile Prometheus et Grafana](compose.md) reste une installation distincte pour
164
192
  l’historique. Arrêter la pile minimale ou modifier ses ports avant de la lancer.
165
193
  Les notifications demandent une [configuration supplémentaire](notifications.md).
194
+
195
+ ## Réglages de cron, stats et monit
196
+
197
+ La version 1.3.0 permet de placer les valeurs habituelles dans
198
+ trois sections de `monit-docker.yml`. Exemple pour une lecture de métriques :
199
+
200
+ ```yaml
201
+ stats:
202
+ rsc: [cpu_percent, mem_usage]
203
+ output: json
204
+ monit:
205
+ rsc: [status]
206
+ ```
207
+
208
+ `monit-docker stats --output text` utilise les ressources du fichier et affiche
209
+ du texte. Avec `monit --rsc status`, seules les mesures demandées sont lues,
210
+ même si le YAML définit une commande. Pour programmer une règle, renseignez
211
+ `cron.cmd` et `cron.state_file`, puis testez avec
212
+ `monit-docker --name web cron --dry-run`. Le [guide cron](cron.md) contient
213
+ un exemple complet.
@@ -48,7 +48,7 @@ On Linux amd64, install Git, Docker Engine, its Compose v2 plugin with
48
48
  `up --wait` support, and curl. For the web dashboard, install Python 3 and OpenSSL.
49
49
 
50
50
  ```sh
51
- git clone --branch v1.2.0 --depth 1 https://github.com/decryptus/monit-docker.git
51
+ git clone --branch v1.3.0 --depth 1 https://github.com/decryptus/monit-docker.git
52
52
  cd monit-docker
53
53
  ./install.sh
54
54
  ```
@@ -147,7 +147,7 @@ host ports. The UI binds to loopback unless `UI_BIND` is explicitly changed.
147
147
  Changing a host port does not change internal agent addresses. Keep the same
148
148
  directory/project name so Compose reuses its named volume.
149
149
 
150
- The examples pin agent and UI to **1.2.0**. When updating versions, preserve your
150
+ The examples pin agent and UI to **1.3.0**. When updating versions, preserve your
151
151
  configuration and state, choose matching agent/UI versions, then pull and recreate
152
152
  the selected stack. `docker compose pull` alone does not change a running container.
153
153
 
@@ -140,7 +140,7 @@ backups; archive them separately if you rely on this history.
140
140
 
141
141
  ## Customize
142
142
 
143
- The services are pinned to monit-docker 1.2.0, Prometheus 3.5.0 and Grafana 12.2.0.
143
+ The services are pinned to monit-docker 1.3.0, Prometheus 3.5.0 and Grafana 12.2.0.
144
144
  Update versions deliberately in `examples/monitoring/compose.yaml`, then run
145
145
  `docker compose pull` and `sh start.sh`. The repository-root `docker-compose.yml`
146
146
  runs the minimal observation agent; use the file in `examples/monitoring` for this
@@ -172,4 +172,5 @@ authorization:
172
172
  ```
173
173
 
174
174
  Use HTTPS when scraping across an untrusted network. The token only grants
175
- access to metrics. Configure access to `/v1/status` separately at your proxy.
175
+ access to metrics. For authenticated status reads, use the independent
176
+ `--status-token-file` option described in [serve mode](serve.md).
@@ -40,8 +40,22 @@ is rendered once; runtime and offline checks use the same validation. See the
40
40
  | `dir-groups` | `NAME: {paths: [STRING, ...], access: MAPPING}` | Nonempty absolute container paths; `access` is optional unless an access probe is requested |
41
41
  | `conditions` | `NAME: {expr: [STRING, ...]}` | Nonempty list of conditions combined with AND |
42
42
  | `commands` | `NAME: {exec: [ACTION, ...]}` | Nonempty ordered action sequence |
43
+ | `stats` | Mapping | `rsc` (ordered list), `output` (`text` or `json`) |
44
+ | `monit` | Mapping | `rsc` or `cmd` (ordered list), `propagate_exit_code` (boolean) |
45
+ | `cron` | Mapping | `cmd`, `state_file`, `cooldown`, `trigger_after`, `max_gap`, `max_restarts`, `propagate_exit_code` |
46
+ | `serve` | Mapping | Defaults for direct `serve`; explicit CLI options take precedence (see [serve](serve.md#configure-serve-in-yaml)) |
43
47
  | `scenarios` | `NAME: MAPPING` | A named `stats`, `cron` or `serve` job |
44
48
 
49
+ These direct command sections are available since 1.3.0. Each command
50
+ reads its own section. Explicit flags override individual YAML fields, even at
51
+ their built-in default value. Repeating `--rsc` or `--cmd` / `--cmd-if` replaces
52
+ the complete YAML list in argument order. For `monit`, choosing `--rsc` also
53
+ discards configured commands and their exit-code policy for that invocation.
54
+ Choosing `--cmd` discards configured resources. Use `--no-propagate-exit-code`
55
+ to override `propagate_exit_code: true`. Simulation is requested with the
56
+ `--dry-run` flag. Global selectors still go before the subcommand. Named
57
+ scenarios keep their own settings.
58
+
45
59
  Command/condition aliases and directory-group names use an ASCII letter followed
46
60
  by at most 64 letters, digits, underscores, dots or hyphens. Scenario names match
47
61
  `[a-z0-9][a-z0-9-]{0,63}` and are selected exactly. Client and container-group names
@@ -225,6 +239,8 @@ a lock and audit simulated decisions while preserving durable policy state.
225
239
  | `--allow-maintenance` | `serve` | Off; requires `--allow-actions` |
226
240
  | `--trust-proxy-user` | `serve` | Off; requires manual actions or an audit read token. Trust the authenticated proxy to supply the username. |
227
241
  | `--audit-read-token-file` | `serve` | Off; requires explicit audit path and a distinct read secret |
242
+ | `--status-token-file` | `serve` | Optional dedicated bearer secret for GET and HEAD on `/v1/status` |
243
+ | `--metrics-token-file` | `serve` | Optional dedicated bearer secret for GET and HEAD on `/metrics` |
228
244
  | `--notification-token-file` | `serve` | Off; private notification ingestion secret |
229
245
 
230
246
  Keep one persistent state path per Docker host/job. A busy state lock fails
@@ -156,3 +156,20 @@ There is no background scheduler or HTTP listener. The optional [trigger delay](
156
156
  There is no cycle-wide deadline or hysteresis. Existing Docker client timeouts still apply; a hung cycle can hold its
157
157
  lock until it exits or is terminated. [Serve mode](serve.md) reuses the same
158
158
  engine and cooldown policy for continuous monitoring.
159
+
160
+ ## Defaults for the direct cron command
161
+
162
+ Starting with version 1.3.0, a top-level section can supply
163
+ the rule list, persistent state and restart policy:
164
+
165
+ ```yaml
166
+ cron:
167
+ state_file: /var/lib/monit-docker/web.json
168
+ cmd: ['mem_percent > 90 ? restart']
169
+ cooldown: 300
170
+ max_restarts: 2
171
+ ```
172
+
173
+ Preview with `monit-docker --name web cron --dry-run`. A scheduled invocation of
174
+ `monit-docker --name web cron` executes one cycle. Add `--cooldown 600` to
175
+ override just that value. Keep the same selector and state file for the job.
@@ -42,8 +42,8 @@ or explicitly starts a monitoring cycle. Reads never execute Docker actions.
42
42
  | --- | --- | --- | --- |
43
43
  | `/healthz` | GET, HEAD | Always, no agent credential | 200 `{"alive":true}` |
44
44
  | `/readyz` | GET, HEAD | Always, no agent credential | 200 `{"ready":true}` or 503 `{"ready":false}` |
45
- | `/v1/status` | GET, HEAD | Always, no agent credential | 200 cached status, including degraded states |
46
- | `/metrics` | GET, HEAD | Always, no agent credential | 200 Prometheus text, including degraded states |
45
+ | `/v1/status` | GET, HEAD | Dedicated bearer token when `--status-token-file` is configured | 200 cached status, including degraded states |
46
+ | `/metrics` | GET, HEAD | Dedicated bearer token when `--metrics-token-file` is configured | 200 Prometheus text, including degraded states |
47
47
  | `/v1/actions` | POST | Manual actions enabled; action token and exact Origin | 202 request record |
48
48
  | `/v1/audit` | GET, HEAD | Journal reader enabled; audit token and actor | 200 bounded event page |
49
49
  | `/v1/audit/export` | GET, HEAD | Same journal authentication | 200 JSONL or CSV attachment |
@@ -55,6 +55,7 @@ For installation and the command reference, see the
55
55
  check-config
56
56
  configuration-validation
57
57
  textual
58
+ release-1.3.0
58
59
  release-1.2.0
59
60
  release-1.1.4
60
61
  release-1.1.3
@@ -0,0 +1,26 @@
1
+ # monit-docker 1.3.0
2
+
3
+ The direct commands now read their own optional sections in `monit-docker.yml`.
4
+ For example, `stats: {rsc: [cpu_percent, mem_usage], output: json}` selects two
5
+ measurements. Running `monit-docker stats --output text` changes the output
6
+ format for one invocation.
7
+
8
+ ## Upgrade from 1.2.0
9
+
10
+ Pin the agent and UI images to `1.3.0`, or install the package with
11
+ `python -m pip install --upgrade 'monit-docker==1.3.0'`. Existing command lines
12
+ work with their previous defaults. Upgrade before adding the new YAML sections.
13
+ Keep existing state, audit files and secrets. For a rollback to 1.2.0, restore
14
+ the previous configuration and command line before starting the older agent.
15
+
16
+ - Each of `serve`, `cron`, `stats` and `monit` reads only its own section. An
17
+ explicit flag overrides that field. Repeated `--rsc` or `--cmd` flags replace
18
+ the corresponding YAML list. `monit --rsc` selects observation even if YAML
19
+ configures an action. Use `--dry-run` to preview rules for one invocation.
20
+ - To protect `GET` and `HEAD /v1/status`, set `serve.status_token_file` or pass
21
+ `--status-token-file FILE`. Give clients a dedicated bearer token. When using
22
+ the dashboard, configure its authenticated proxy to inject this token only
23
+ on the upstream status route. Prometheus uses its own metrics credential.
24
+
25
+ See the [configuration reference](https://github.com/decryptus/monit-docker/blob/v1.3.0/docs/config-cli-contract.md)
26
+ and [serve guide](https://github.com/decryptus/monit-docker/blob/v1.3.0/docs/serve.md).
@@ -12,6 +12,10 @@ acceptance now has separate post-release evidence, recorded below. See
12
12
  scope and known limits, and inspect the tagged revision's workflow results for
13
13
  actual automated acceptance.
14
14
 
15
+ ## 1.3.0 configuration for direct commands
16
+
17
+ The [1.3.0 release](release-1.3.0.md) adds per-command YAML settings and optional bearer authentication for status reads.
18
+
15
19
  ## 1.2.0 security and reliability
16
20
 
17
21
  See the [upgrade notes](release-1.2.0.md) before updating API credentials or the journal proxy.
@@ -50,7 +50,65 @@ accepts 1–65535. Without `--cmd`, the process observes containers only and nee
50
50
  no state file. All resources are collected by default; repeated `--rsc` options
51
51
  select a subset, for example `--rsc cpu_percent --rsc mem_usage`.
52
52
 
53
- The agent has no read authentication, TLS or embedded UI. The optional
53
+ ### Configure serve in YAML
54
+
55
+ Version 1.3.0 accepts a top-level `serve` section in
56
+ `monit-docker.yml`. For example:
57
+
58
+ ```yaml
59
+ serve:
60
+ bind: 127.0.0.1
61
+ port: 9810
62
+ interval: 60
63
+ rsc: [status, health]
64
+ status_token_file: /run/secrets/status
65
+ ```
66
+
67
+ Start this configuration with `monit-docker serve`, or select a file with
68
+ `monit-docker -c /path/to/monit-docker.yml serve`. An explicit CLI option
69
+ overrides that YAML field, even when the argument equals the built-in default.
70
+ For example, `serve --port 9808 --rsc pid` uses port 9808, collects only PID,
71
+ and keeps the configured interval and status token file.
72
+
73
+ Use the long flag name with underscores in place of hyphens. Use YAML
74
+ booleans for switches and ordered lists for `rsc` and `cmd` (including
75
+ conditional rules). Each CLI list replaces the whole corresponding YAML
76
+ list. To turn off a YAML switch for one launch, use `--no-allow-actions`,
77
+ `--no-allow-maintenance` or `--no-trust-proxy-user`. Keep only file paths in the five token settings. `--dry-run` is
78
+ CLI-only. Global options still precede the subcommand. Named scenarios
79
+ (`monit-docker run NAME`) use their own configuration. The
80
+ [configuration reference](config-cli-contract.md) lists the available settings.
81
+
82
+ | Purpose | Keys under `serve:` |
83
+ |---|---|
84
+ | HTTP listener | `bind`, `port` |
85
+ | Collection | `interval`, `stale_after`, `rsc` |
86
+ | Automatic actions | `cmd`, `state_file`, `cooldown`, `trigger_after`, `max_gap`, `max_restarts` |
87
+ | Manual actions and proxy identity | `allow_actions`, `allow_maintenance`, `action_origin`, `action_cooldown`, `trust_proxy_user` |
88
+ | Secret file paths | `action_token_file`, `audit_read_token_file`, `notification_token_file`, `metrics_token_file`, `status_token_file` |
89
+
90
+ To protect the cached status (container names, IDs and measurements), start the
91
+ agent with `monit-docker serve --status-token-file /run/secrets/status`.
92
+ Use a dedicated file containing 64 lowercase hexadecimal characters and an
93
+ optional final newline. The agent loads the file at startup. GET and HEAD
94
+ require a single `Authorization: Bearer TOKEN` header when enabled. Missing
95
+ or incorrect credentials return HTTP 403. Health and readiness probes stay
96
+ available; Prometheus uses its own `--metrics-token-file`.
97
+
98
+ For example, read status through a local connection or a trusted HTTPS endpoint
99
+ without passing the secret as a command-line argument:
100
+
101
+ ```sh
102
+ { printf 'Authorization: Bearer '; tr -d '\n' < /run/secrets/status; printf '\n'; } |
103
+ curl --fail --silent --show-error --header @- "$AGENT_URL/v1/status"
104
+ ```
105
+
106
+ When using the web UI, configure its authenticated reverse proxy to inject the
107
+ status bearer on the upstream `/v1/status` location. The stock Nginx
108
+ configuration clears the upstream Authorization header. Replace that directive
109
+ for this location only and keep the secret on the proxy, outside browser code.
110
+
111
+ The optional
54
112
  [separate UI component](ui.md) supplies an authenticated Nginx frontend. Manual
55
113
  start/stop/restart is disabled by default; enabling its API requires explicit
56
114
  configuration, a proxy secret, an allowed HTTPS origin and persistent state.
@@ -98,3 +98,21 @@ to switch modes to run simple checks or scheduled rules. Both modes use the
98
98
  same selectors and rule syntax.
99
99
 
100
100
  If a command fails, start with [troubleshooting](troubleshooting.md).
101
+
102
+ ## Defaults for direct stats and monit commands
103
+
104
+ Starting with version 1.3.0, add these optional sections to
105
+ `monit-docker.yml`:
106
+
107
+ ```yaml
108
+ stats:
109
+ rsc: [cpu_percent, mem_usage]
110
+ output: json
111
+ monit:
112
+ rsc: [status]
113
+ ```
114
+
115
+ Run `monit-docker stats` for JSON or `monit-docker stats --output text` for a
116
+ one-time text report. Run `monit-docker --name web monit` to check the selected
117
+ container's status. See the [configuration reference](config-cli-contract.md)
118
+ for rule lists and exit codes.
@@ -1,6 +1,6 @@
1
1
  services:
2
2
  monit-docker:
3
- image: decryptus/monit-docker:1.2.0
3
+ image: decryptus/monit-docker:1.3.0
4
4
  command: [monit-docker, serve, --bind, 0.0.0.0, --interval, '30']
5
5
  restart: unless-stopped
6
6
  stop_grace_period: 60s
@@ -1,6 +1,6 @@
1
1
  services:
2
2
  monit-docker:
3
- image: decryptus/monit-docker:1.2.0
3
+ image: decryptus/monit-docker:1.3.0
4
4
  command: [monit-docker, serve, --bind, 0.0.0.0, --interval, '30']
5
5
  restart: unless-stopped
6
6
  stop_grace_period: 60s
@@ -15,7 +15,7 @@ services:
15
15
  create_host_path: false
16
16
 
17
17
  ui:
18
- image: decryptus/monit-docker-ui:1.2.0
18
+ image: decryptus/monit-docker-ui:1.3.0
19
19
  restart: unless-stopped
20
20
  depends_on: [monit-docker]
21
21
  networks: [agent, frontend]
@@ -2,6 +2,6 @@
2
2
 
3
3
  from __future__ import absolute_import
4
4
 
5
- __version__ = '1.2.0'
5
+ __version__ = '1.3.0'
6
6
 
7
7
  __all__ = ('__version__',)
@@ -0,0 +1,56 @@
1
+ """YAML defaults for direct monitoring commands."""
2
+ import ipaddress
3
+ import sys
4
+
5
+ from monit_docker.adapters.syntax import RESOURCE_CHOICES
6
+ from monit_docker.adapters.validation_rules import mapping, require, string_list
7
+ from monit_docker.domain.filesystems import filesystem_resource
8
+
9
+ _BOOL_FIELDS = frozenset(('allow_actions', 'allow_maintenance', 'trust_proxy_user'))
10
+ _INTEGER_MIN = {'port': 1, 'max_restarts': 1}
11
+ _NUMBER_MIN = {'interval': 0.1, 'stale_after': 0.1, 'cooldown': 0, 'action_cooldown': 1,
12
+ 'trigger_after': 0, 'max_gap': 0}
13
+ _TEXT_FIELDS = frozenset(('bind', 'state_file', 'action_origin', 'action_token_file',
14
+ 'audit_read_token_file', 'notification_token_file', 'metrics_token_file',
15
+ 'status_token_file'))
16
+ _LIST_FIELDS = frozenset(('rsc', 'cmd'))
17
+ _SERVE_FIELDS = _BOOL_FIELDS | _INTEGER_MIN.keys() | _NUMBER_MIN.keys() | _TEXT_FIELDS | _LIST_FIELDS
18
+
19
+ COMMAND_FIELDS = {
20
+ 'serve': _SERVE_FIELDS,
21
+ 'stats': frozenset(('rsc', 'output')),
22
+ 'monit': frozenset(('rsc', 'cmd', 'propagate_exit_code')),
23
+ 'cron': frozenset(('cmd', 'propagate_exit_code', 'state_file', 'cooldown', 'trigger_after',
24
+ 'max_gap', 'max_restarts')),
25
+ }
26
+
27
+
28
+ def validate_command_section(mode, section):
29
+ mapping(section, mode)
30
+ require(not set(section) - COMMAND_FIELDS[mode], mode, 'unknown %s option' % mode)
31
+ for key, value in section.items():
32
+ where = mode + '.' + key
33
+ if key in _BOOL_FIELDS or key == 'propagate_exit_code':
34
+ require(type(value) is bool, where, 'expected a boolean')
35
+ elif key in _INTEGER_MIN:
36
+ require(type(value) is int and value >= _INTEGER_MIN[key], where, 'expected a positive integer')
37
+ elif key in _NUMBER_MIN:
38
+ require(type(value) in (int, float) and value >= _NUMBER_MIN[key]
39
+ and value <= sys.float_info.max, where, 'invalid duration')
40
+ elif key == 'output':
41
+ require(value in ('text', 'json'), where, 'expected text or json')
42
+ elif key in _LIST_FIELDS:
43
+ string_list(value, where)
44
+ else:
45
+ require(isinstance(value, str) and bool(value.strip()) and '\x00' not in value,
46
+ where, 'expected a nonempty string')
47
+ if mode == 'monit':
48
+ require(not (section.get('cmd') and section.get('rsc')), mode, 'choose either cmd or rsc')
49
+ if 'bind' in section:
50
+ try:
51
+ ipaddress.IPv4Address(section['bind'])
52
+ except ValueError:
53
+ require(False, 'serve.bind', 'expected an IPv4 address')
54
+ require(section.get('port', 1) <= 65535, 'serve.port', 'port must be at most 65535')
55
+ for resource in section.get('rsc', ()):
56
+ require(resource in RESOURCE_CHOICES or filesystem_resource(resource), mode + '.rsc', 'unknown resource')
@@ -6,6 +6,7 @@ from collections import OrderedDict
6
6
  import six
7
7
  import yaml
8
8
  from mako.template import Template
9
+ from monit_docker.adapters.command_config import COMMAND_FIELDS
9
10
  from monit_docker.domain.errors import MonitoringError
10
11
 
11
12
  try:
@@ -135,7 +136,7 @@ class Configuration(object):
135
136
  for key in ('general', 'vars'):
136
137
  if conf.get(key):
137
138
  self._common_conf[key] = dict(conf[key])
138
- result = {}
139
+ result = {mode: conf[mode] for mode in COMMAND_FIELDS if mode in conf}
139
140
  for key, kind, section in _CONFIG_SECTIONS:
140
141
  if not include_rules and key in ('conditions', 'commands'):
141
142
  continue
@@ -70,10 +70,11 @@ class StatusHandler(httpdis.HttpReqHandler):
70
70
  def authenticate(self, auth_users = None):
71
71
  path = self._path
72
72
  security = self.server.security
73
- if path == '/metrics':
74
- if security.metrics_token:
73
+ if path in ('/metrics', '/v1/status'):
74
+ token = security.metrics_token if path == '/metrics' else security.status_token
75
+ if token:
75
76
  tokens = self.headers.get_all('Authorization') or []
76
- expected = ('Bearer ' + security.metrics_token).encode('ascii')
77
+ expected = ('Bearer ' + token).encode('ascii')
77
78
  if len(tokens) != 1 or not hmac.compare_digest(tokens[0].encode('utf-8'), expected):
78
79
  raise self.req_error(403, 'forbidden')
79
80
  return
@@ -100,7 +100,7 @@ _ROUTES = ({'name': 'v1/audit', 'op': _READ_METHODS, 'handler': audit_page, 'to_
100
100
  'to_auth': True, 'max_body_size': _NOTIFICATION_MAX_BODY_SIZE},
101
101
  {'name': 'healthz', 'op': _READ_METHODS, 'handler': health},
102
102
  {'name': 'readyz', 'op': _READ_METHODS, 'handler': readiness},
103
- {'name': 'v1/status', 'op': _READ_METHODS, 'handler': status},
103
+ {'name': 'v1/status', 'op': _READ_METHODS, 'handler': status, 'to_auth': True},
104
104
  {'name': 'metrics', 'op': _READ_METHODS, 'handler': metrics, 'to_auth': True},
105
105
  {'name': 'v1/actions', 'op': _WRITE_METHODS, 'handler': submit_action,
106
106
  'to_auth': True, 'max_body_size': _ACTION_MAX_BODY_SIZE})
@@ -16,10 +16,12 @@ class HttpSecurity:
16
16
  notification_token: str = field(default=None, repr=False)
17
17
  audit_token: str = field(default=None, repr=False)
18
18
  metrics_token: str = field(default=None, repr=False)
19
+ status_token: str = field(default=None, repr=False)
19
20
 
20
21
 
21
22
  def load_security(*, action_token_file=None, action_origin=None, trust_actor=False,
22
- notification_token_file=None, audit_read_token_file=None, metrics_token_file=None):
23
+ notification_token_file=None, audit_read_token_file=None, metrics_token_file=None,
24
+ status_token_file=None):
23
25
  action_token = read_proxy_token(action_token_file, 'action') if action_token_file else None
24
26
  notification_token = read_proxy_token(notification_token_file) if notification_token_file else None
25
27
  read_token = read_proxy_token(audit_read_token_file) if audit_read_token_file else None
@@ -30,9 +32,12 @@ def load_security(*, action_token_file=None, action_origin=None, trust_actor=Fal
30
32
  metrics_token = read_proxy_token(metrics_token_file, 'metrics') if metrics_token_file else None
31
33
  if metrics_token and metrics_token in (action_token, notification_token, read_token):
32
34
  raise MonitoringError(110, 'metrics secret must differ from action, notification and audit secrets')
35
+ status_token = read_proxy_token(status_token_file, 'status') if status_token_file else None
36
+ if status_token and status_token in (action_token, notification_token, read_token, metrics_token):
37
+ raise MonitoringError(110, 'status secret must differ from action, notification, audit and metrics secrets')
33
38
  return HttpSecurity(action_token=action_token, action_origin=action_origin,
34
39
  trust_actor=trust_actor, notification_token=notification_token,
35
- audit_token=read_token, metrics_token=metrics_token)
40
+ audit_token=read_token, metrics_token=metrics_token, status_token=status_token)
36
41
 
37
42
 
38
43
  def read_proxy_token(path, purpose='Audit'):
@@ -10,10 +10,11 @@ from monit_docker.adapters.rules import RuleParser
10
10
  from monit_docker.adapters.selection import ContainerSelector
11
11
  from monit_docker.adapters.filesystems import directory_groups
12
12
  from monit_docker.adapters.validation_rules import (ConfigurationCheckError, require, mapping, string_list, checked, _validate_action_list, _validate_rule)
13
+ from monit_docker.adapters.command_config import COMMAND_FIELDS, validate_command_section
13
14
  from monit_docker.adapters.scenarios import SCENARIO_FIELDS, SCENARIO_NAME, validate_scenario
14
15
 
15
16
  _CONFIG_FIELDS = frozenset(('general', 'vars', 'clients', 'ctn-groups', 'dir-groups',
16
- 'conditions', 'commands', 'scenarios'))
17
+ 'conditions', 'commands', 'scenarios')) | COMMAND_FIELDS.keys()
17
18
  _ENTRY_REQUIRED = {'client': 'config', 'ctn-group': 'match', 'dir-group': 'paths',
18
19
  'condition': 'expr', 'command': 'exec', 'scenario': None}
19
20
  _VALIDATED_SECTIONS = (('clients', 'client'), ('ctn-groups', 'ctn-group'),
@@ -22,6 +23,10 @@ _VALIDATED_SECTIONS = (('clients', 'client'), ('ctn-groups', 'ctn-group'),
22
23
  _ALIAS_NAME = re.compile(r'[a-zA-Z][a-zA-Z0-9_.-]{0,64}')
23
24
  _ENTRY_VARIABLES = frozenset(('vars', '@import_vars'))
24
25
  CONFIG_SCHEMA = xys.load('''
26
+ stats?: !~~callback(monit_docker.config.mapping) null
27
+ monit?: !~~callback(monit_docker.config.mapping) null
28
+ cron?: !~~callback(monit_docker.config.mapping) null
29
+ serve?: !~~callback(monit_docker.config.mapping) null
25
30
  general?: !~~callback(monit_docker.config.mapping) null
26
31
  vars?: !~~callback(monit_docker.config.mapping) null
27
32
  clients?: !~~callback(monit_docker.config.mapping) null
@@ -53,6 +58,8 @@ class CheckedConfiguration(Configuration):
53
58
  require(not set(result) - _CONFIG_FIELDS, self.source, 'unknown top-level section')
54
59
  for name, value in result.items():
55
60
  mapping(value, '%s: %s' % (self.source, name))
61
+ for mode in COMMAND_FIELDS.keys() & result.keys():
62
+ validate_command_section(mode, result[mode])
56
63
  require(xys.validate(result, CONFIG_SCHEMA), self.source, 'invalid configuration structure')
57
64
  return result
58
65
 
@@ -113,11 +120,12 @@ def check_configuration(conffile, inline=None, selectors=None, selected_groups=(
113
120
  from_env=False, expressions=()):
114
121
  loader = CheckedConfiguration(conffile, inline)
115
122
  config = loader.load()
116
- return validate_configuration(config, selectors, selected_groups, client, from_env, expressions)
123
+ return validate_configuration(config, selectors, selected_groups, client, from_env, expressions,
124
+ check_command_rules=True)
117
125
 
118
126
 
119
127
  def validate_configuration(config, selectors=None, selected_groups=(), client=None,
120
- from_env=False, expressions=()):
128
+ from_env=False, expressions=(), check_command_rules=False):
121
129
  mapping(config, 'configuration')
122
130
  require(not set(config) - _CONFIG_FIELDS, 'configuration', 'unknown top-level section')
123
131
  for section, kind in _VALIDATED_SECTIONS:
@@ -150,6 +158,10 @@ def validate_configuration(config, selectors=None, selected_groups=(), client=No
150
158
  parser = checked(location, lambda: RuleParser(conditions={name: entry}, dir_groups=dir_groups))
151
159
  _validate_rule(parser, '@%s ? reload' % name, location)
152
160
  parser = RuleParser(commands, conditions, dir_groups)
161
+ if check_command_rules:
162
+ for mode in COMMAND_FIELDS:
163
+ for index, expression in enumerate(config.get(mode, {}).get('cmd', ())):
164
+ _validate_rule(parser, expression, '%s.cmd[%s]' % (mode, index))
153
165
  for index, expression in enumerate(expressions):
154
166
  _validate_rule(parser, expression, '--cmd-if[%s]' % index)
155
167
  for name in config.get('scenarios', {}):