Xymon Mailing List Archive search

Date/Time options for Report URLs

3 messages in this thread

list Lionel Worman · Tue, 5 Feb 2013 17:14:36 +0000 ·
	We are using a display management system to cycle through the various report displays that Xymon generates, for example the "Top Changes" & "Event Log" reports. Right now I have figured out how to setup the URL to generate the report for today, but the problem is that I have to manually update the display manager to pass the URL with today's date in order to get today's information:

The URL is (using xymon.com as the example site):
http://www.xymon.com/xymon-cgi/topchanges.sh?FROMTIME=2013/02/05 at 00:00:00&TOTIME=&HOSTMATCH=&EXHOSTMATCH=&PAGEMATCH=&PATHLIST=&EXPAGEMATCH=&TESTMATCH=&EXTESTMATCH=&COLORMATCH=&COUNTTYPE=events&TOP=10&Send=Show

If you notice the "FROMTIME=" section has it manually entered in as '2013/02/05 at 00:00:00', which I have to update every day to the new date. Actually I have it set to '2013/02/01 at 00:00:00' and have it as a monthly view, but I would like it to be a daily view, as well as not have to change it every day/month.

My question is are any of the following options possibilities?

1. Be able to pass some key words on the URL such as TODAY, YESTERDAY, TOMORROW. So that I could construct the URL as simply "FROMTIME=Today" or "FROMTIME=YESTERDAY", this way Xymon would just pass me the data for the day.

2. Could I pass the date/time without the "@00:00:00", and have Xymon assume 00:00:00. Since I can have the display management system sort of pass the date dynamically, but I can't have it append the @00:00:00. So if I could construct the URL in the following manner "FROMTIME=2013/02/05&TOTIME=2013/02/06" I would get the report for 2013/02/05

3. Possibly even change the format of the "FROMTIME=" to MM/DD/YYYY , again without the @00:00:00, so it can work more with US date/time options?
list David Baldwin · Thu, 7 Feb 2013 09:50:34 +1100 ·
Lionel,

Not sure what system you are using for rotating web pages, but I have a
browser which loads the following page 'bbcycle.html' (you will need to
substitute for http://xymonhost and probably modify some of the URLs in
the pages list) - it would be pretty trivial to add some Javascript to
generate the daily URL string you need and add to pages list.

David.

bbcycle.html

<HTML>
<HEAD>
<SCRIPT type="text/javascript">

  var timeout = 20*1000; // milliseconds
  var pages = [ 'hobbit/bb.html', 'hobbit/bb2.html',
'rss2html/rss2html.php', 'hobbit-cgi/hobbit-nkview.sh' ];

  var server = 'http://xymonhost/';;
  var i = 0;

  function setCycle() {
     cycle();
     setInterval("cycle();",timeout);
  }
 
  function cycle() {
     if ( i >= pages.length) window.location.reload(true); // reload
page to reload list of pages if this file gets updated
     var frame = document.getElementById("disp");
     if(pages[i]) frame.src = server + pages[i];
     i++;
  }
</SCRIPT>
</HEAD>
<BODY onload="setCycle();" style="margin:0;">
<IFRAME ID="disp" SRC="" height=100% width=100% frameborder=0
marginwidth=0 marginheight=0 vspace=0 hspace=0 style="left:0; top:0;">
</IFRAME>
</BODY>
</HTML>
quoted from Lionel Worman
	We are using a display management system to cycle through the various report displays that Xymon generates, for example the "Top Changes" & "Event Log" reports. Right now I have figured out how to setup the URL to generate the report for today, but the problem is that I have to manually update the display manager to pass the URL with today's date in order to get today's information:

The URL is (using xymon.com as the example site):
http://www.xymon.com/xymon-cgi/topchanges.sh?FROMTIME=2013/02/05 at 00:00:00&TOTIME=&HOSTMATCH=&EXHOSTMATCH=&PAGEMATCH=&PATHLIST=&EXPAGEMATCH=&TESTMATCH=&EXTESTMATCH=&COLORMATCH=&COUNTTYPE=events&TOP=10&Send=Show

If you notice the "FROMTIME=" section has it manually entered in as '2013/02/05 at 00:00:00', which I have to update every day to the new date. Actually I have it set to '2013/02/01 at 00:00:00' and have it as a monthly view, but I would like it to be a daily view, as well as not have to change it every day/month.

My question is are any of the following options possibilities?

1. Be able to pass some key words on the URL such as TODAY, YESTERDAY, TOMORROW. So that I could construct the URL as simply "FROMTIME=Today" or "FROMTIME=YESTERDAY", this way Xymon would just pass me the data for the day.

2. Could I pass the date/time without the "@00:00:00", and have Xymon assume 00:00:00. Since I can have the display management system sort of pass the date dynamically, but I can't have it append the @00:00:00. So if I could construct the URL in the following manner "FROMTIME=2013/02/05&TOTIME=2013/02/06" I would get the report for 2013/02/05

3. Possibly even change the format of the "FROMTIME=" to MM/DD/YYYY , again without the @00:00:00, so it can work more with US date/time options?
-- 

David Baldwin - Senior Systems Administrator (Datacentres + Networks)
Information and Communication Technology Services
Australian Sports Commission          http://ausport.gov.au
Tel 02 62147830 Fax 02 62141830       PO Box 176 Belconnen ACT 2616
user-cbbf693f2c89@xymon.invalid          Leverrier Street Bruce ACT 2617


Keep up to date with what's happening in Australian sport visit http://www.ausport.gov.au

This message is intended for the addressee named and may contain confidential and privileged information. If you are not the intended recipient please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you receive this message in error, please delete it and notify the sender.
list Lionel Worman · Fri, 8 Feb 2013 16:03:10 +0000 ·
David,
	Thanks for the information and the idea of using a javascript page to do what I was thinking. To that end I wrote the following page and put it on our xymon server, to allow me to pass some simple 'dates'. It is a bit hackneyed, but the nice thing about this is that I can put links from our other site to allow people to easily click on link that says "Today's Top Changes" or "Top change's this month" and it will get there, without having to fiddle with dates on each page I want to link from.

---begin commontopchanges.html---
<HTML>
<BODY>
<SCRIPT TYPE="text/javascript">
<!--

var xymonserver = "<your xymon server here>" //***CHANGE THIS TO MATCH YOUR SERVER!!
var currentTime = new Date()
var year = currentTime.getFullYear()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()

var xymonStartString = "http://"+xymonserver+"/xymon-cgi/topchanges.sh?FROMTIME=";
var xymonEndString = "&TOTIME=&HOSTMATCH=&EXHOSTMATCH=&PAGEMATCH=&PATHLIST=&EXPAGEMATCH=&TESTMATCH=&EXTESTMATCH=&COLORMATCH=&COUNTTYPE=events&TOP=10&Send=Show"

var dateRange = document.location.search.substring(1)

switch (dateRange)
{
	case "today":
		xymonDateRange = year+"/"+month+"/"+day+"@00:00:00"
		break
	case "month":
	case "thismonth":
		xymonDateRange = year+"/"+month+"/01 at 00:00:00"
		break
	case "week":
	case "sincesunday":
		var sunday = new Date(currentTime.setDate(currentTime.getDate() - currentTime.getDay()))
		xymonDateRange = sunday.getFullYear()+"/"+(sunday.getMonth()+1)+"/"+sunday.getDate()+"@00:00:00"
		break
	case "sincemonday":
		var monday = new Date(currentTime.setDate(currentTime.getDate() - (currentTime.getDay() + 1)))
		xymonDateRange = monday.getFullYear()+"/"+(monday.getMonth()+1)+"/"+monday.getDate()+"@00:00:00"
		break
	default:
		xymonDateRange = year+"/"+month+"/"+day+"@00:00:00"
}
var reportpage = xymonStartString+xymonDateRange+xymonEndString
//document.write("<BR>XymonDateRange = "+xymonDateRange)
//document.write("<BR>Xymon URL = "+reportpage)
document.location.href = reportpage

-->
</SCRIPT>
</BODY>
</HTML> 
---End commontopchanges.html---

Lionel M. Worman
quoted from David Baldwin

-----Original Message-----
From: David Baldwin [mailto:user-cbbf693f2c89@xymon.invalid] 
Sent: Wednesday, February 06, 2013 5:51 PM
To: Lionel Worman
Cc: 'xymon at xymon.com'
Subject: Re: [Xymon] Date/Time options for Report URLs

Lionel,

Not sure what system you are using for rotating web pages, but I have a browser which loads the following page 'bbcycle.html' (you will need to substitute for http://xymonhost and probably modify some of the URLs in the pages list) - it would be pretty trivial to add some Javascript to generate the daily URL string you need and add to pages list.

David.

bbcycle.html

<HTML>
<HEAD>
<SCRIPT type="text/javascript">

  var timeout = 20*1000; // milliseconds
  var pages = [ 'hobbit/bb.html', 'hobbit/bb2.html', 'rss2html/rss2html.php', 'hobbit-cgi/hobbit-nkview.sh' ];

  var server = 'http://xymonhost/';;
  var i = 0;

  function setCycle() {
     cycle();
     setInterval("cycle();",timeout);
  }
 
  function cycle() {
     if ( i >= pages.length) window.location.reload(true); // reload page to reload list of pages if this file gets updated
     var frame = document.getElementById("disp");
     if(pages[i]) frame.src = server + pages[i];
     i++;
  }
</SCRIPT>
</HEAD>
<BODY onload="setCycle();" style="margin:0;"> <IFRAME ID="disp" SRC="" height=100% width=100% frameborder=0
marginwidth=0 marginheight=0 vspace=0 hspace=0 style="left:0; top:0;"> </IFRAME> </BODY> </HTML>
	We are using a display management system to cycle through the various report displays that Xymon generates, for example the "Top Changes" & "Event Log" reports. Right now I have figured out how to setup the URL to generate the report for today, but the problem is that I have to manually update the display manager to pass the URL with today's date in order to get today's information:

The URL is (using xymon.com as the example site):

http://www.xymon.com/xymon-cgi/topchanges.sh?FROMTIME=2013/02/05 at 00:00
:00&TOTIME=&HOSTMATCH=&EXHOSTMATCH=&PAGEMATCH=&PATHLIST=&EXPAGEMATCH=&
TESTMATCH=&EXTESTMATCH=&COLORMATCH=&COUNTTYPE=events&TOP=10&Send=Show
quoted from David Baldwin

If you notice the "FROMTIME=" section has it manually entered in as '2013/02/05 at 00:00:00', which I have to update every day to the new date. Actually I have it set to '2013/02/01 at 00:00:00' and have it as a monthly view, but I would like it to be a daily view, as well as not have to change it every day/month.

My question is are any of the following options possibilities?

1. Be able to pass some key words on the URL such as TODAY, YESTERDAY, TOMORROW. So that I could construct the URL as simply "FROMTIME=Today" or "FROMTIME=YESTERDAY", this way Xymon would just pass me the data for the day.

2. Could I pass the date/time without the "@00:00:00", and have Xymon 
assume 00:00:00. Since I can have the display management system sort 
of pass the date dynamically, but I can't have it append the 
@00:00:00. So if I could construct the URL in the following manner 
"FROMTIME=2013/02/05&TOTIME=2013/02/06" I would get the report for 
2013/02/05

3. Possibly even change the format of the "FROMTIME=" to MM/DD/YYYY , again without the @00:00:00, so it can work more with US date/time options?
--
David Baldwin - Senior Systems Administrator (Datacentres + Networks) Information and Communication Technology Services
Australian Sports Commission          http://ausport.gov.au
Tel 02 62147830 Fax 02 62141830       PO Box 176 Belconnen ACT 2616
user-cbbf693f2c89@xymon.invalid          Leverrier Street Bruce ACT 2617


Keep up to date with what's happening in Australian sport visit http://www.ausport.gov.au

This message is intended for the addressee named and may contain confidential and privileged information. If you are not the intended recipient please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you receive this message in error, please delete it and notify the sender.