Xymon Digest, Vol 126, Issue 12

David Smith david.smith at renfrewshire.gov.uk
Mon Jul 19 12:01:21 CEST 2021


Here is what I did, it may be a bit convoluted

This script in EXT
#############################
#!/bin/bash

export {http,https,ftp}_proxy="myproxyurlhere"

myproxy=`env | grep -i proxy`
echo "proxy settings are $myproxy"

HOSTTAG=URLTEST          # What we put in hosts.cfg to trigger this test
COLUMN=$HOSTTAG      # Name of the column, often same as tag in hosts.cfg

XYMONHOME=/opt/BB/bbsw/server
XYMON=/opt/BB/bbsw/server/bin/xymon
XYMSRV=10.111.9.5
SED=/bin/sed

$XYMONHOME/bin/xymongrep $HOSTTAG | while read L
   do
      set $L    # To get one line of output from xymongrep

      HOSTIP="$1"
      MACHINEDOTS="$2"
      MACHINE=`echo $2 | $SED -e's/\./,/g'`

echo "$MACHINE will do $HOSTTAG"

urlfile="/opt/BB/bbsw/server/ext/URL/$MACHINE.bb-checkweb"

URL=`cat $urlfile`

UP="HTTP/1.1 200 OK"
UP2="HTTP/1.1 200 Connection established"

status="$(curl -Is $URL | head -1)"
status=$(echo $status|tr -d '\r')

if [[ "$status" ==  "$UP" || "$status" ==  "$UP2" ]] ;
then
COLOR=green
MSG="$URL returned $status, so is up"

$XYMON $XYMSRV "status $MACHINE.$COLUMN $COLOR `date`
${MSG}
"
echo "$URL is up"

else
COLOR=red
MSG="$URL returned $status, so is down"
$XYMON $XYMSRV "status $MACHINE.$COLUMN $COLOR `date`
${MSG}
"
echo "$URL is down"
fi
done
########################

In EXT/URL
I have a bunch of txt files, with the name of the host as it appears in xymon hosts  file, and each contains the url I wish to check. A bit more work could make this better

In hosts.cfg, I have the tag URLTEST after the host to tell it to test a url

In tasks.cfg, I have

[checkurl]
        ENVFILE $XYMONHOME/etc/xymonserver.cfg
        NEEDS xymond
        CMD $BBHOME/ext/URLtest.sh
        LOGFILE $XYMONSERVERLOGS/checkurl.log
        INTERVAL 5m


Now I am certain that this is a very long way for a shortcut, but it definitely works for me


David


-----Original Message-----
From: Xymon <xymon-bounces at xymon.com> On Behalf Of xymon-request at xymon.com
Sent: 17 July 2021 11:00
To: xymon at xymon.com
Subject: Xymon Digest, Vol 126, Issue 12

Send Xymon mailing list submissions to
        xymon at xymon.com

To subscribe or unsubscribe via the World Wide Web, visit
        https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.xymon.com%2Fmailman%2Flistinfo%2Fxymon&data=04%7C01%7Cdavid.smith%40renfrewshire.gov.uk%7C916ad43bd7124f2c578c08d94909a881%7Cca2953361aa64486b2b2cf7669625305%7C0%7C0%7C637621128094733109%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=hK61QyCAiiqLFm6m5xJ90Yk85KL6TTma7JfbctROpX8%3D&reserved=0
or, via email, send a message with subject or body 'help' to
        xymon-request at xymon.com

You can reach the person managing the list at
        xymon-owner at xymon.com

When replying, please edit your Subject line so it is more specific than "Re: Contents of Xymon digest..."


Today's Topics:

   1. Removing Columns and http monitoring 401 error (Cory Fiala)
   2. Re: Removing Columns and http monitoring 401 error
      (Christoph Zechner)


----------------------------------------------------------------------

Message: 1
Date: Fri, 16 Jul 2021 15:15:59 +0000
From: Cory Fiala <Cory.Fiala at bethel.k12.or.us>
To: "'xymon at xymon.com'" <xymon at xymon.com>
Subject: [Xymon] Removing Columns and http monitoring 401 error
Message-ID: <7b5e855c915c4869a8dcda7c1221dd87 at bethel.k12.or.us>
Content-Type: text/plain; charset="us-ascii"

Hello all,

I somehow created 2 new columns in the dashboard while I was trying to fix a http monitor. I've removed my changes and the columns still show up. How do you remove them from the dashboard?

My second issue is I'm wanting to monitor a URL and am only wanting to know if its alive. Since it requires authentication I'm getting HTTP status 401 error. How can I only monitor if it's up or down? Here is the last thing I've tried:

xxx.xxx.xxx.xxx    fs1     #     httpstatus=http;https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fworkfolders.somesite.k12.or.us%2F&data=04%7C01%7Cdavid.smith%40renfrewshire.gov.uk%7C916ad43bd7124f2c578c08d94909a881%7Cca2953361aa64486b2b2cf7669625305%7C0%7C0%7C637621128094743068%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=udJy43fiSFax0ZlqR5zUVaC4n5n38HX2f3kCLFroTL0%3D&reserved=0;200

Thanks!
Cory




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.xymon.com%2Fpipermail%2Fxymon%2Fattachments%2F20210716%2Fca98dcce%2Fattachment-0001.htm&data=04%7C01%7Cdavid.smith%40renfrewshire.gov.uk%7C916ad43bd7124f2c578c08d94909a881%7Cca2953361aa64486b2b2cf7669625305%7C0%7C0%7C637621128094743068%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Y%2B4vz4HvsdcHseheBI3ywdpUo59RDF%2B5wdxLNsfD7f0%3D&reserved=0>

------------------------------

Message: 2
Date: Fri, 16 Jul 2021 18:17:11 +0200
From: Christoph Zechner <zechner at vrvis.at>
To: Cory Fiala <Cory.Fiala at bethel.k12.or.us>
Cc: "'xymon at xymon.com'" <xymon at xymon.com>
Subject: Re: [Xymon] Removing Columns and http monitoring 401 error
Message-ID: <a3b822cc-22c2-f35d-5269-4e320a88eb46 at vrvis.at>
Content-Type: text/plain; charset=windows-1252; format=flowed

Hi,

On 16/07/2021 17:15, Cory Fiala wrote:
> Hello all,
>
> I somehow created 2 new columns in the dashboard while I was trying to
> fix a http monitor. I?ve removed my changes and the columns still show
> up. How do you remove them from the dashboard?

On your xymon server, run the following command:

/usr/lib/xymon/server/bin/xymon 127.0.0.1 "drop <CLIENT> <COLUMN>"

to remove the column.

>
> My second issue is I?m wanting to monitor a URL and am only wanting to
> know if its alive. Since it requires authentication I?m getting HTTP
> status 401 error. How can I only monitor if it?s up or down? Here is
> the last thing I?ve tried:
>
> xxx.xxx.xxx.xxx??? fs1???? #
>
> ????httpstatus=http;https://eur01.safelinks.protection.outlook.com/?ur
> l=https%3A%2F%2Fworkfolders.somesite.k12.or.us%2F&data=04%7C01%7Cd
> avid.smith%40renfrewshire.gov.uk%7C916ad43bd7124f2c578c08d94909a881%7C
> ca2953361aa64486b2b2cf7669625305%7C0%7C0%7C637621128094743068%7CUnknow
> n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLC
> JXVCI6Mn0%3D%7C1000&sdata=udJy43fiSFax0ZlqR5zUVaC4n5n38HX2f3kCLFro
> TL0%3D&reserved=0;200

this works on my machine with http auth:

sni httpstatus;https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fxymon.example.com%2F&data=04%7C01%7Cdavid.smith%40renfrewshire.gov.uk%7C916ad43bd7124f2c578c08d94909a881%7Cca2953361aa64486b2b2cf7669625305%7C0%7C0%7C637621128094743068%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=oRn%2BHaBpfNOSq2EMtj5l6UcSien64ygEutwWozP8cPM%3D&reserved=0;^([23]..|4013);^(40[02456789]|5..)

This allows status code 401 and 403 for example among others. See also:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fxymon.sourceforge.io%2Fxymon%2Fhelp%2Fmanpages%2Fman5%2Fhosts.cfg.5.html&data=04%7C01%7Cdavid.smith%40renfrewshire.gov.uk%7C916ad43bd7124f2c578c08d94909a881%7Cca2953361aa64486b2b2cf7669625305%7C0%7C0%7C637621128094743068%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2BIVGAfCff6cuWJs5hJAjIkAqxG2%2FtG49RugbYWO8jVE%3D&reserved=0

under "httpstatus"

Cheers
Christoph


>
> Thanks!
>
> Cory
>
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists
> .xymon.com%2Fmailman%2Flistinfo%2Fxymon&data=04%7C01%7Cdavid.smith
> %40renfrewshire.gov.uk%7C916ad43bd7124f2c578c08d94909a881%7Cca2953361a
> a64486b2b2cf7669625305%7C0%7C0%7C637621128094743068%7CUnknown%7CTWFpbG
> Zsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%
> 3D%7C1000&sdata=QBUm0%2Fco6vvgYt3FgLgxgOLdhW%2B2AkCnVeyAQtF6g%2Bo%
> 3D&reserved=0
>


------------------------------

Subject: Digest Footer

_______________________________________________
Xymon mailing list
Xymon at xymon.com
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.xymon.com%2Fmailman%2Flistinfo%2Fxymon&data=04%7C01%7Cdavid.smith%40renfrewshire.gov.uk%7C916ad43bd7124f2c578c08d94909a881%7Cca2953361aa64486b2b2cf7669625305%7C0%7C0%7C637621128094743068%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QBUm0%2Fco6vvgYt3FgLgxgOLdhW%2B2AkCnVeyAQtF6g%2Bo%3D&reserved=0


------------------------------

End of Xymon Digest, Vol 126, Issue 12
**************************************




Renfrewshire Council Website -http://www.renfrewshire.gov.uk

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. Renfrewshire Council may, in accordance with the Telecommunications(Lawful Business Practice) (Interception of Communications) Regulations 2000, intercept e-mail messages for the purpose of monitoring or keeping a record of communications on the Council's system. If a message contains inappropriate dialogue it will automatically be intercepted by the Council's Internal Audit section who will decide whether or not the e-mail should be onwardly transmitted to the intended recipient(s).


More information about the Xymon mailing list