Strange output in mmonit, parsing non-standard characters

Issue #243 resolved
yrpen91 created an issue

How to reproduce: Try create file with special characters. For example:

cat >> /root/testfile
Put some text, and press CTRL + H or CTRL + J, etc...
Press ENTER and after that CTRL + D

Add new program check Example:

check program test-alert with path "/root/test-alert.sh"
  if status > 0 then alert

Now print file and redirect output too error stream inside script used by monit. Example:

#!/bin/bash
cat /root/testfile 2>&1
exit 1

Now look at dashboard: Example: mmonit-javascript.png

I guess special characters should be removed before Monit send it to M/Monit. Or before M/Monit serve it in REST API.

Quick fix inside script:

cat /root/testfile | tr -cd '\11\12\15\40-\176' 2>&1

Fix from: http://alvinalexander.com/blog/post/linux-unix/how-remove-non-printable-ascii-characters-file-unix

Confirmet in M/Monit 3.4, Monit 5.11 (test environment) and M/Monit 3.3, Monit 5.10 (production environment).

Comments (5)

  1. Tildeslash repo owner

    Hello,

    please can you attached the /root/testfile with characters which trigger the issue? We tried to reproduce the problem using the given steps, but are unable to reproduce it (with M/Monit 3.5.1).

    Best regards, M/Monit team

  2. Log in to comment