Add type to monitor Odoo license expiration with Prometheus.
This commit is contained in:
parent
195bd49d53
commit
cba90c83e4
5 changed files with 63 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
DBNAME=$(cat "${__object:?}/parameter/dbname")
|
||||
|
||||
cat << EOF
|
||||
[Unit]
|
||||
Description=e-Durable's Prometheus Odoo License Expiration exporter
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=odoo
|
||||
ExecStart=/opt/prometheus-odoo-license-exporter/venv/bin/python /opt/prometheus-odoo-license-exporter/prometheus-odoo-license-exporter ${DBNAME:?}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
20
type/__prometheus_odoo_license_exporter/gencode-remote
Executable file
20
type/__prometheus_odoo_license_exporter/gencode-remote
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
VCS_TAG=$(cat "${__object:?}/parameter/version")
|
||||
VCS_URL="https://code.recycled.cloud/RecycledCloud/prometheus-odoo-license-exporter/raw/tag/$VCS_TAG/prometheus-odoo-license-exporter"
|
||||
|
||||
cat << EOF
|
||||
cd /opt/prometheus-odoo-license-exporter
|
||||
|
||||
# Fetch sources
|
||||
curl "$VCS_URL" -o prometheus-odoo-license-exporter
|
||||
|
||||
# Install virtualenv and dependencies
|
||||
virtualenv venv
|
||||
. venv/bin/activate
|
||||
|
||||
pip3 install prometheus_client psycopg2 datetime
|
||||
|
||||
# Start service
|
||||
systemctl restart prometheus-odoo-license-exporter
|
||||
EOF
|
24
type/__prometheus_odoo_license_exporter/manifest
Executable file
24
type/__prometheus_odoo_license_exporter/manifest
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
os=$(cat "${__global:?}/explorer/os")
|
||||
|
||||
mkdir -p "${__object:?}/files"
|
||||
case "$os" in
|
||||
debian|ubuntu)
|
||||
__package python3-virtualenv
|
||||
__package curl
|
||||
__package libpq-dev
|
||||
|
||||
"${__type:?}/files/prometheus-odoo-license-exporter.service.sh" \
|
||||
> "${__object:?}/files/prometheus-odoo-license-exporter.service"
|
||||
__systemd_unit prometheus-odoo-license-exporter.service \
|
||||
--source "${__object:?}/files/prometheus-odoo-license-exporter.service" \
|
||||
--enablement-state enabled
|
||||
;;
|
||||
*)
|
||||
echo "$os is not supported by this type. Exiting" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
__directory /opt/prometheus-odoo-license-exporter
|
|
@ -0,0 +1,2 @@
|
|||
dbname
|
||||
version
|
0
type/__prometheus_odoo_license_exporter/singleton
Normal file
0
type/__prometheus_odoo_license_exporter/singleton
Normal file
Reference in a new issue