monit is showing syntax error even though python script running fine.
Issue #1048
closed
"Ubuntu 20.04.4 LTS"
below error its returning when we ran “monit -t”, even we included python shebang line too.
/etc/monit/conf.d/pagerduty-trigger-resolve.py:3: syntax error 'import'
our python script contains following script
#!/usr/bin/env python3
import requests
import json
import argparse
import sys
import hashlib
import os
import datetime
SERVICE_ID = 'PYY8IMS'
fromemailaddress = 'monit@pagerduty.com'
incstatus=""
import socket
Comments (3)
-
-
repo owner - changed status to invalid
invalid configuration
-
reporter - changed status to closed
After moving scripts out of conf.d directory, monit working good.
- Log in to comment
You cannot put a non-monit-configuration file into ubuntu/debian's
/etc/monit/conf.d
directory. ALL files inside this directory are used as config files. See the last lines of/etc/monit/monitrc
on your Ubuntu host.Simply move the py-script into a directory outside conf.d and it should work... For sure you also have to alter the path inside the config file that uses this script.