Hello Lutz,

the color (ANSI escape sequence) is set on server-side and stripped by monit 
CLI if in batch mode. If you use curl to fetch the status in txt format 
directly, you need to strip the escape sequence yourselves, for example:

        curl http://127.0.0.1:2812/_status <http://127.0.0.1:2812/_status> | 
sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"

We'll simplify the color handling in the future release.

Best regards,
Martin




> On 23 Mar 2018, at 14:19, Lutz Mader <lutz.ma...@freenet.de> wrote:
> 
> Hello Tildeslash,
> I try to gather the Service status summary via a curl request from an
> other/remote monit system to use the status in a local monit check
> program script.
> 
> curl 'http://admin:monit@macmini.local:2812/_summary?format=xml'
> or
> curl 'http://admin:monit@macmini.local:2812/_summary?format=text'
> 
> Unfortunately, I got the output in the terminal output format only.
> 
> I try to disable tabular output and colours completely in the monitrc
> used by monit.
> 
> set terminal batch
> 
> Nothing was happened, I got the terminal text format with tabular output
> and colours. But the tabular and colours are removed from the local
> monit command output (the monit daemon was restarted), the set terminal
> batch mode seems to be used (handled like -B).
> 
> My question is this the normal behaviour?
> How to get text only or xml output via curl for _summary?
> 
> With _status and format xml I got xml output, but many other
> informations also. And with format text I got the coloured output as well.
> 
> Thanks for any help or suggestion,
> Lutz
> 
> p.s.
> I use Monit 5.25.1 and 5.22.0, 5.19.0.
> 
> -- 
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general

-- 
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to