#100 Mangled output on descritption and detail

mon server (53)

I'm getting a "20" instead of a white space in description and detail, both in cli command and cgi interface: I get "Servidores20de20nombres" instead of "Servidores de nombres". I'm running CentOS 4.7, last uptdates applied:

# rpm -qi mon
Name : mon Relocations: (not relocatable)
Version : 1.2.0 Vendor: Dag Apt Repository, http://dag.wieers.com/apt/
Release : 2.el4.rf Build Date: Wed 17 Dec 2008 12:31:43 AM ART
Install Date: Tue 24 Feb 2009 03:52:57 PM ART Build Host: lisse.hasselt.wieers.com
Group : Applications/Internet Source RPM: mon-1.2.0-2.el4.rf.src.rpm
Size : 830771 License: GPL
Signature : DSA/SHA1, Tue 16 Dec 2008 01:59:55 AM ART, Key ID a20e52146b8d79e6
Packager : Dag Wieers <dag@wieers.com>
URL : http://www.kernel.org/software/mon/
Summary : General-purpose resource monitoring system
Description :
Mon is a general-purpose resource monitoring system. It can be used
to monitor network service availability, server problems,
environmental conditions (i.e., the temperature in a room) or other
things. Mon can be used to test the condition and/or to trigger an
action upon failure of the condition. Mon keeps the testing and
action-taking tasks as separate, stand-alone programs.

Mon is very extensible. Monitors and alerts are not a part of mon, but
the distribution comes with a handful of them to get you started. This
means that if a new service needs monitoring, or if a new alert is
required, the mon server will not need to be changed.

# monshow --detail dns,DNS

server: localhost
time: Thu Feb 26 12:18:00 2009
state: scheduler running

Detail for group dns service DNS

semillon barbera ns1.techtel.com.ar ns2.techtel.com.ar
ns1.impsat.net.ar ns1.us.impsat.net ns2.us.impsat.net


opstatus: fail (0)
exitval: 1
last check: 00:02:26 ago
next_check: in 00:02:33


  • Daniel Gajdos

    Daniel Gajdos - 2010-12-03

    Hi Marcelo,
    I've had the same problem and I solved it by modification of mon file (version
    Change Line 2514 to (add ' character): sock_write ($fh, "$group $service '" .
    Change Line 2516 to (add ' character): "'\n");
    Replace Line 3038 with:
    my $buf =
    "group=$group" .
    " service=$service" .
    " opstatus=$sref->{_op_status}" .
    " last_opstatus=$sref->{_last_op_status}" .
    " exitval=$sref->{_exitval}" .
    " timer=$sref->{_timer}" .
    " last_success=$sref->{_last_success}" .
    " last_trap=$sref->{_last_trap}" .
    " last_check=$sref->{_last_check}" .
    " ack=$sref->{_ack}" .
    " ackcomment='$comment'" .
    " alerts_sent=$alerts_sent" .
    " depstatus=" . int ($sref->{"_depend_status"}) .
    " depend='$depend'" .
    " monitor='$monitor'" .
    " last_summary='$summary'" .
    " last_detail='$detail'";

  • Paul M

    Paul M - 2013-10-23

    I worked out how to fix this. in /usr/share/perl5/Mon/Client.pm at line 1932, change this:
    quotewords ('\s+', 0, $o)

    quotewords ('\s+', 1, $o)

    It took me about an hour and a half to find this, and minutes to fix.

    The mon daemon stores strings in its status "database" file ( /var/lib/mon/opstatus ) file after escaping all ascii codes 20 (space) and below, as it uses whitespace to separate fields. e.g. spaces are stored as \20.

    The mon daemon listens on tcp:2583 and is queried by the mon.cgi via
    the library file /usr/share/perl5/Mon/Client.pm for status, a simple ascii query and response.

    The Client.pm library reads the response, and used the perl function quotewords to split the output read from the mon daemon into separate name=value pairs.

    Unfortunately it set the second parameter to 0, which caused quotewords to strip off the backslash character. This meant that the \20 representation of the space character was turned into simply 20, and thus the un-escaping function didn't turn it back into a space.

    It might be that the "keep" parameter in quotewords changed its function during one of the many perl releases since mon was written 12.5 years ago and abandoned. Or that someone fixed it locally and never submitted the patch and noone really cared because mon is abandonware?


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks