<div>Hi all,</div>
<div> </div>
<div>Does anyone have opinions on timezone adjustments per host or service?</div>
<div> </div>
<div>We are wanting to replace our current in-house monitoring with nagios, but our single monitoring system pushes thousands of checks out to sites in half a dozen different timezones every hour. Some of these checks are timezone sensitive, whilst others aren't.
</div>
<div> </div>
<div>I propose that service & host have "timezone" & "use_timezone" attributes. Below is an example of how i'd [poorly] calculate a tz_offset based on the "timezone" attribute.</div>

<div> </div>
<div>Thoughts?</div>
<div> </div>
<div>Cheers,</div>
<div>Grant</div>
<div> </div>
<div> </div>
<div>/* get the timezone difference between local time & the given timezone */<br>long get_timezone_offset(const char *tz){<br>   char *tzlocal;<br>   struct tm t;<br>   time_t secs_since_epoch;<br>   long local_utc_offset, remote_utc_offset;
<br> </div>
<div>   /* save existing timezone data, if exists & grab seconds elapsed since the EPOCH */<br>   tzlocal=getenv("TZ");<br>   secs_since_epoch=time(NULL);<br> </div>
<div>   /* get local offset from UTC, in seconds */<br>   tzset();<br>   localtime_r(&secs_since_epoch,&t);<br>   local_utc_offset=secs_since_epoch-mktime(&t);<br> </div>
<div>   /* set our timezone to remote timezone */<br>   setenv("TZ",tz,1);<br>   tzset();<br>   localtime_r(&secs_since_epoch,&t);<br> </div>
<div>   /* restore original timezone */<br>   if(tzlocal!=NULL)<br>       setenv("TZ",tzlocal,1);<br>   else<br>       unsetenv("TZ");<br>   tzset();<br> </div>
<div>   /* get remote offset from UTC, in seconds */<br>   remote_utc_offset=secs_since_epoch-mktime(&t);<br><br>   return (local_utc_offset-remote_utc_offset);<br>}<br> </div>