gists/check_frappe_doctype
2024-05-29 21:58:09 +01:00
..
2024-05-29 21:58:09 +01:00

Check Frappe doctype objects

This script checks the last modified date of a Frappe doctype and alerts if it's older than a certain threshold. It uses the Frappe API to fetch the last modified date of the doctype and compares it to the current time.

$ python3 check-frappe-objects.py -h
usage: check-frappe-objects.py [-h] --doctype DOCTYPE --warning WARNING --critical CRITICAL --url URL --api_key API_KEY --api_secret
                               API_SECRET

Check Frappe doctype for recent updates.

optional arguments:
  -h, --help            show this help message and exit
  --doctype DOCTYPE     The doctype to check.
  --warning WARNING     Warning threshold in minutes.
  --critical CRITICAL   Critical threshold in minutes.
  --url URL             Frappe site URL.
  --api_key API_KEY     API key for authentication.
  --api_secret API_SECRET
                        API secret for authentication.

Usage example

$ ./check-frappe-objects.py --url https://app.domain.com --doctype "Doctype Name" --warning 10 --critical 20 --api_key XXXXXXXXXXX --api_secret XXXXXXXXXXX
CRITICAL: Last update was 190 days, 19:05:17.619701 ago
$ echo $?
2