2

I have a requirement where I need to compare start time with current time and if the value is greater than certain limit I need an alerting. Can someone share the syntax.

Ex:

I have a column called start time with below syntax.

Start Time >> 2015-12-03 15:04:02.0

I want to put a rule like

if (now()-value) > 3600 then severity critical

THis syntax doesn't work, can someone pls help

Sachin Khandelwal
  • 123
  • 1
  • 2
  • 10

3 Answers3

1

You will need to make your value from string to Date first.

Use this :

set $(dateValue) parseDate('%Y-%m-%d %H:%M:%S.%f', value)
if (now()- $(dateValue)) > 3600 then 
  severity critical
endif

You may want to read the detail for parseDate function from the "Gateway2 Reference Guide.pdf" document.

  • thanks for answering. I have a slight problem. My Geneos server is US based and the datevalue is UK. how can I handle such scenario? – Sachin Khandelwal Jan 12 '16 at 07:58
  • I have experience in adding / subtracting the offset in seconds to the time as a constant. The time value in Geneos is always represented in seconds so it can be add / minus directly with numbers. – Daedalus Chan Jan 13 '16 at 01:40
  • Of coz, you will need to consider the daylight saving effect between US / UK. – Daedalus Chan Jan 13 '16 at 01:41
  • RE your other question, firstly, I doubt Geneos support nested loop. You can try. As I remember, the rule block doesn't really allowing all kind of programming structure. Secondly, Time on gateway (now()) should be local system of the gateway host, rather than GMT. Not 100% sure again, you might want to raise to ITRS. – Daedalus Chan Jan 13 '16 at 01:48
0

set $(rowname) target "rowName"

set $(state) path "job_state" value

set $(a) now()

set $(b) parseDate("%Y-%m-%d %H:%M:S.%f", value)

set $(c) $(a) - $(b)

if $(state) <> "ENDED OK" then

if $(c) > 3600 then

severity warning

endif

endif

Sachin Khandelwal
  • 123
  • 1
  • 2
  • 10
0

Incidentally....

You can define the Timezone of the gateway as GMT in the Operating Environment which will affect what is returned with the function now() . This way you can deal with daylight savings in a controlled fashion.

TimeZone

ParseDate() can also take a timezone which will again help automatically calculate correctly for daylight savings.