[Xymon] Non-Green View

Root, Paul T Paul.Root at CenturyLink.com
Thu May 3 16:49:35 CEST 2018


#!/usr/bin/perl
#

# command line options
use Getopt::Std;

# long listing
# Not including - case insensitive
# Including - case insensitive
getopts ("lv:i:");

#   Need Hostname and port
$XC = "/etc/sysconfig/xymon-client";

if ($ARGV[0]) {
        $H = $ARGV[0];
} else {
        `grep ^XYMONSERVERS $XC` =~ /.*=\"(.*)\"/;
        ($H, @junk) = split (/ /, $1);
}
$P=($ARGV[1] ? $ARGV[1] : 1984);

# Fields wanted for output
$F = "hostname,testname,lastchange";
$F .= ',line1' if ($opt_l);

# extraneous text to remove
@p = ("Disabled by: ",
          "Reason: ",
          "<!-- \[.*\] -->",
          "<IMG SRC=\"\/.*\/gifs\/.+.gif\" ALT=\".+\" HEIGHT=\"16\" WIDTH=\"16\" BORDER=0>",
          "<table border=1>",
);

for $c qw(red yellow purple blue) {
        print "$c:\n";
        $F .= ',diabletime,dismsg' if ($c eq 'blue');   # blue output wants the disable message
        @o = `~xymon/client/bin/xymon $H:$P "xymondboard color=$c fields=$F"`;
        for $l (@o) {
                next if ($opt_v && grep (/$opt_v/i, $l));
                next if ($opt_i && !grep (/$opt_i/i, $l));
                chop $l;
                $l =~ s/\\n/\t/g;
                for $p (@p) {
                        $l =~ s/$p//g;
                }
                @l = split (/\|/, $l);
                $i=0;
                while ($f = shift (@l)) {
                        if ($i == 2) {
                                $t = time;
                                $t -= $f;
                                $t = $t / 60;
                                if ($t > 60) {
                                        $t = $t / 60;
                                        if ($t > 24) {
                                                $t = $t / 24;
                                                $s = sprintf ("%3d %s", $t, ($t < 2 ? 'day' : 'days'));
                                        } else {
                                                $s = sprintf ("%3d %s", $t, ($t < 2 ? 'hour' : 'hours'));
                                        }
                                } else {
                                        $s = sprintf ("%3d min", $t);
                                }
                                print $s, (length ($s) < 8 ? "\t\t" : "\t");
                        } else {
                                print $f, (length ($f) < 8 ? "\t\t" : "\t");
                        }
                        $i++;
                }
                print "\n";
        }
        print "\n";
}

From: Xymon <xymon-bounces at xymon.com> On Behalf Of Ralph Mitchell
Sent: Wednesday, May 02, 2018 9:32 PM
To: John Tullis <john at executech.com>
Cc: xymon at xymon.com
Subject: Re: [Xymon] Non-Green View

Sounds like you're asking about xymondboard:

        xymon  localhost  "xymondboard  color=red,yellow,purple  fields=hostname,testname,color,lastchange"

There are notes on how to use it in the man page for the xymon command:

       https://www.xymon.com/help/manpages/man1/xymon.1.html

The lastchange value is seconds since the epoch.

Ralph Mitchell



On Wed, May 2, 2018 at 3:14 PM, John Tullis <john at executech.com<mailto:john at executech.com>> wrote:
I'm looking for an easy way to list each non-green item and amount of time it has been that color. We have 50 different users and are looking for an easier way to track what servers need attention. The non-green view is massive for us and hovering over each icon to see the time it has been that color is a little tedious.

If there isn't a view I can run, is there a command I can run to query the status and time of a non-green so I can display it in a separate page?

Ideally it would look something like this:
ServerA    |      disk    |      red      |   43 days
ServerB    | memory |   yellow   |   10 days

Currently we're parsing the history log and displaying based on that but it leaves a lot to be desired.



_______________________________________________
Xymon mailing list
Xymon at xymon.com<mailto:Xymon at xymon.com>
http://lists.xymon.com/mailman/listinfo/xymon

This communication is the property of CenturyLink and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20180503/97f815cf/attachment.html>


More information about the Xymon mailing list