Nagios timeperiod and notification period - nagios

I'm having troubles getting Nagios to honor a notification_period setting for a predefined timeperiod.
My timeperiod definition is called 'sleep' as in, do not notify me between midnight and 7am. it looks like this:
define timeperiod{
timeperiod_name sleep
alias Not Middle of Night
sunday 07:00-23:59
monday 07:00-23:59
tuesday 07:00-23:59
wednesday 07:00-23:59
thursday 07:00-23:59
friday 07:00-23:59
saturday 07:00-23:59
}
I've entered the directive for the hosts as follows:
define host{
use linux-server,host-pnp
host_name server.domain.com
alias server.domain.com
address xxx.33.xxx.243
notification_period sleep
}
This morning I was expecting to see WARNING notifications but only after 7am. Instead, I saw them throughout the night between 23:59 last night and 7am this morning.
My understanding from the configuration is that I should NOT have received any emails during this time.
Have I overlooked something? I was hoping it would be this simple but it didn't work as expected.

I have solved this issue which stemmed from a lack of understanding of the way Nagios is configured. In short, custom service checks require custom notification_period directives if desired.
The question was asked and correctly answered in detail here:
Nagios Forum: notification_period not honoured on host config?

Just a hint. Please, check your time and time zone setting on the Nagios server. Your configuration looks fine for me.

Rather than adding it to all your service checks. You can add it to you contact or contact_group having the email addresses that should be notified during that time. I do basically the same for two different groups because we are 24X7. The US group gets the notifications during EST days, and the Asian group gets them at night. Saving everyone a lot of needless alert spam.

Related

How to control the time of day in React Suite's DateRangePicker?

I cannot for the life of me figure out how to default the time of day in DateRangePicker to 00:00:00 for start date and 23:59:59 for end date.
The time of day simply defaults to the current time on the computer, which, frankly, is rarely what the requirements for a date range are. So It's hard for me to imagine there is no way to do what I'm trying to do. Check out the screenshot:
Here I picked the date range of Apr 22 to May 4. But notice the time of day. In order to set those to 00:00:00 and 23:59:59 respectively, I have to click on those times and scroll around to pick specific time of day, which is super annoying to do every time.
The documentation says nothing about the time. Also their GitHub issues page does not address this. What am I missing here. It seems like such an obvious oversight to not allow you to set a default time of day.
You can set the default time on the calendar via defaultCalendarValue.
<DateRangePicker
format="yyyy-MM-dd HH:mm:ss"
defaultCalendarValue={[new Date('2022-02-01 00:00:00'), new Date('2022-03-01 23:59:59')]}
/>
This has also been updated in the example on the rsuite official website.
https://rsuitejs.com/components/date-range-picker/#date-time-or-time

Why are repeated days incorrect with this RRULE?

This should be a 2 hour 50 minute event starting at 5pm PST on a thursday evening repeating weekly. When imported into google calendar or Evolution, the first occurrence is correct, but subsequent weeks have the event on Wednesdays.
DTSTART:20170908T000000Z
DTEND:20170908T025000Z
RRULE:FREQ=WEEKLY;UNTIL=20171201T080000Z;BYDAY=TH
Other events that my application generate occur on multiple days i.e. BYDAY=TH,TU so simply removing the BYDAY is not a solution for my problem.
You are mixing up the timezone of the event and the display timezone. As far as recurrence calculation goes, the only thing that counts is the timezone that you declare in the VEVENT. Here you are using UTC. So:
The first instance is on the 20170908 which is a Friday. From there, you ask for a recurrence every thursday. The next thursday after 20170908 is 20170914, so the next instance starts on 20170914T000000Z.
When viewed with a display timezone of PST, this event has indeed its first instance on Thursday evening. But the second instance, as calculated above, is on a Thursday UTC time, so on a Wednesday PST time.
Besides this particular issue, you also need to worry about daylight saving changes. If your event is really taking place in PST timezone, the event, as expressed above will see its time change in November, after the DST transition takes place.
Hence it is almost never a good idea to express a recurring event by using UTC (Zulu) time.
You should have your event expressed in local time with timezone, i.e. use:
DTSTART;TZID="America/Los_Angeles":20170907T170000

Angular - Use of i18n and l10n for date time and timezone management

On server side DateTime is saved as per UTC (2016-03-24 17:45:12) and to client it is always returned DateTime as UTC. There are different users from world.
What is the best way to do date-time display management with i18n and l10n in angular?
Also i want that it should display date-time as per timezone of the user.
There are lots of feeds shown from all over the world like StackOverflow Posts. From server side always DateTime are passed in UTC time zone. On client side, date time can be displayed in two formats like below.
Showing date time of post as per time zone
Showing time-ago facility like (Just Now, Minute Ago, Hour Ago, Day Ago, Month Ago, Year Ago, 2 Years ago, 3 Years ago, etc)
This type of date times displayed across system multiple times for posts. So what is best way to use angular to have very less code for managing this.
How/When/Why to use Filters, Directives, Expressions for this?
(P.S. I am new to angular.)
Update:
More explanation:
Post object can be single page or array of objects.
And post date time will be like UTC: (2016-03-24 17:45:12)
So there are two cases which can be displayed like:
5 Months Ago
2016-03-24 11:15 PM (IST time)
You can trust the users' browsers. To display a date, you can use myDate.toLocaleString(). It will display the date using user's locale settings.
For "time-ago" format, you can use AngularJS version of moment.js: https://github.com/urish/angular-moment#am-time-ago-directive

Changing ADUC Account expiration date via command saves wrong date

I am trying to make a simple batch file to change a user's ADUC expiration to a specified date.
Using the below command the date always appears in ADUC as one day prior to what I set:
net user myname /expires:09/17/13 /domain
In ADUC, the date will be: 09/16/2013. No matter what, the date that appears in ADUC is one day before the day I set.
The documentation I found for this indicates
Note that the account expires at the beginning of the specified date.
So does this mean, If i wanted the account to be expired today, I would send the command for today and ADUC would interpret that as yesterday?
Thanks in advance, I just want to get this right.
As a wild guess, since you're UTC-savvy - is the date UTC date, so 130917T0000Z=130916T1900 local?

Possible to Schedule a Cron Job for Specific Day of Every Month on Google App Engine?

Question
Is it possible to schedule a cron job on google app engine to run on the 27th day of every month?
Background
Looking at their syntax here, it appears doing that is too specific, but I wanted to see if anyone here managed to do it somehow.
Interestingly enough, this works:
1st day of jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec 00:00
but this doesn't:
27th day of jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec 00:00
All I did was change the day number (ordinal), but it seems that if the ordinal is greater than 5, you get an exception (Parent module 'antlr3' not loaded). I assume this is because the parser is mistakenly letting the "1st day" get through thinking it means "weekday of the month" or something like that.
Keep it simple, stupid ! ;)
27 of month 9:40
Tested and worked.
UPDATE: This answer is obsolete; see new accepted answer.
It appears this currently is not possible, though I still don't know for certain.
Thus, my work around is to setup a cronjob to run every day, and have the method it's calling return early if it's not the 27th. ~29 extra requests per month isn't that bad, right?

Resources