|
From: | Russell Simpkins |
Subject: | Re: How to output stdout and stderr from an exec program script in monit |
Date: | Mon, 8 Feb 2016 16:18:40 -0500 |
yes, it works when I run the python command directly from shell.but when I do$> monit start my_programI don't see the log file being createdOn Mon, Feb 8, 2016 at 12:22 PM, Russell Simpkins <address@hidden> wrote:I created test.pyraise ValueError("throwing up")I ran it by running$> python test.py > /dev/null 2>&1$> echo $?1Not sure what else you might be doing wrongOn Mon, Feb 8, 2016 at 3:13 PM, Vikram Kone <address@hidden> wrote:For testing it I simply did this in the python script#my_program.py#!/usr/bin/pythonraise ValueError("throwing up")On Mon, Feb 8, 2016 at 10:39 AM, Russell Simpkins <address@hidden> wrote:Virkam,You don't show your python. Are you using "exit(1)" in your python when there is an error condition?You need to exit(1) or something other than zero.RussOn Mon, Feb 8, 2016 at 1:06 PM, Vikram Kone <address@hidden> wrote:--Hi,I have a python script that I use as to check certain system conditions to alert on using monit.This script prints a buch of stuff during execution to stdout which I want to capture in a log file.How should I configure the monit conf script, such that I can capture both the stdout and stderr of this script and at the same time alerting on the exit status of the script. The monit alert should also included the stdout/stderr for the alert events.This is what I tried#/etc/monit/conf/myprogram.confcheck program my_program with path "/usr/bin/python -u /opt/program/my_program.py > my_prgoram.log 2&>1"if status !=0 alertBut I see that the monit always thinks that the program is reporting status=0 even when then it exists with error code 1.What am i doing wrong?
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
[Prev in Thread] | Current Thread | [Next in Thread] |