Check time mismatch

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
bosco
Posts: 40
Joined: Thu Nov 24, 2016 5:34 am

Check time mismatch

Post by bosco »

Hi
I have configured a service to check during the check_period given,also whenever this check run it logs a report so that to check the run time for future reference,i have configyred service to run at the specific time periods mentioned,but some time the check run at wrong time.refer logs given below,ideally it should run at XX-06 times.but some time it runs at other also not sure why it runs. my service check is mentioned as below.my need is check needs to run only one every hour -06 minutes,

01-24-2018_04-06-00 File found!
01-24-2018_06-06-00 File found!
01-24-2018_07-06-00 File found!
01-24-2018_08-06-00 File found!
01-24-2018_09-06-00 FILE NOT FOUND-Reporting service is Down!
01-24-2018_09-14-04 FILE NOT FOUND-Reporting service is Down!
01-24-2018_10-06-00 File found!
01-24-2018_10-06-03 FILE NOT FOUND-Reporting service is Down!
01-24-2018_11-06-00 File found!

Service configuration

#File exist service check for XXXX
define service{
service_description XXX
host XXX
check_command check_file-exist
contact_groups XXXXX
use XXXXX
notifications_enabled 1
check_interval 5
max_check_attempts 1
check_period File_CheckPeriod
notification_period 24x7
notification_interval 0
}
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Check time mismatch

Post by npolovenko »

Hello, @bosco. Can you run ps -aef and show us the output. Also, please show the time period definition.(File_CheckPeriod)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
bosco
Posts: 40
Joined: Thu Nov 24, 2016 5:34 am

Re: Check time mismatch

Post by bosco »

Please find the details of the timeperiod,from where do you want to run the ps -eaf command

Code: Select all

# This defines blackout time period from 04:00 to 05:59
define timeperiod{
        timeperiod_name File_CheckPeriod
        alias           File Check Hours
        sunday          00:06-00:07,01:06-01:07,02:06-02:07,03:06-03:07,04:06-04:07,06:06-06:07,07:06-07:07,08:06-08:07,09:06-09:07,10:06-10:07,11:06-11:07,12:06-12:07,13:06-13:07,14:06-14:07,15:06-15:07,16:06-16:07,17:06-17:07,18:06-18:07,19:06-19:07,20:06-20:07,21:06-21:07,22:06-22:07,23:06-23:07
        monday          00:06-00:07,01:06-01:07,02:06-02:07,03:06-03:07,04:06-04:07,06:06-06:07,07:06-07:07,08:06-08:07,09:06-09:07,10:06-10:07,11:06-11:07,12:06-12:07,13:06-13:07,14:06-14:07,15:06-15:07,16:06-16:07,17:06-17:07,18:06-18:07,19:06-19:07,20:06-20:07,21:06-21:07,22:06-22:07,23:06-23:07
        tuesday         00:06-00:07,01:06-01:07,02:06-02:07,03:06-03:07,04:06-04:07,06:06-06:07,07:06-07:07,08:06-08:07,09:06-09:07,10:06-10:07,11:06-11:07,12:06-12:07,13:06-13:07,14:06-14:07,15:06-15:07,16:06-16:07,17:06-17:07,18:06-18:07,19:06-19:07,20:06-20:07,21:06-21:07,22:06-22:07,23:06-23:07
        wednesday       00:06-00:07,01:06-01:07,02:06-02:07,03:06-03:07,04:06-04:07,06:06-06:07,07:06-07:07,08:06-08:07,09:06-09:07,10:06-10:07,11:06-11:07,12:06-12:07,13:06-13:07,14:06-14:07,15:06-15:07,16:06-16:07,17:06-17:07,18:06-18:07,19:06-19:07,20:06-20:07,21:06-21:07,22:06-22:07,23:06-23:07
        thursday        00:06-00:07,01:06-01:07,02:06-02:07,03:06-03:07,04:06-04:07,06:06-06:07,07:06-07:07,08:06-08:07,09:06-09:07,10:06-10:07,11:06-11:07,12:06-12:07,13:06-13:07,14:06-14:07,15:06-15:07,16:06-16:07,17:06-17:07,18:06-18:07,19:06-19:07,20:06-20:07,21:06-21:07,22:06-22:07,23:06-23:07
        friday          00:06-00:07,01:06-01:07,02:06-02:07,03:06-03:07,04:06-04:07,06:06-06:07,07:06-07:07,08:06-08:07,09:06-09:07,10:06-10:07,11:06-11:07,12:06-12:07,13:06-13:07,14:06-14:07,15:06-15:07,16:06-16:07,17:06-17:07,18:06-18:07,19:06-19:07,20:06-20:07,21:06-21:07,22:06-22:07,23:06-23:07
        saturday        00:06-00:07,01:06-01:07,02:06-02:07,03:06-03:07,04:06-04:07,06:06-06:07,07:06-07:07,08:06-08:07,09:06-09:07,10:06-10:07,11:06-11:07,12:06-12:07,13:06-13:07,14:06-14:07,15:06-15:07,16:06-16:07,17:06-17:07,18:06-18:07,19:06-19:07,20:06-20:07,21:06-21:07,22:06-22:07,23:06-23:07
        }
Last edited by dwhitfield on Mon Jan 29, 2018 2:05 pm, edited 1 time in total.
Reason: code blocks FTW
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Check time mismatch

Post by dwhitfield »

bosco wrote:from where do you want to run the ps -eaf command
From the nagios machine...but it might be useful to run it on both. Please put the output in a code block. The "Code" button is the fifth from the left on the post input screen (between Quote and List).
bosco
Posts: 40
Joined: Thu Nov 24, 2016 5:34 am

Re: Check time mismatch

Post by bosco »

Code: Select all

[root@XXXX config]# ps -aef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0  2017 ?        00:04:41 /sbin/init
root         2     0  0  2017 ?        00:00:18 [kthreadd]
root         3     2  0  2017 ?        00:01:22 [ksoftirqd/0]
root         6     2 98  2017 ?        103-12:10:08 [migration/0]
root         7     2  0  2017 ?        00:04:03 [watchdog/0]
root         8     2 97  2017 ?        102-18:56:15 [migration/1]
root         9     2  0  2017 ?        00:14:55 [kworker/1:0]
root        10     2  0  2017 ?        00:01:24 [ksoftirqd/1]
root        12     2  0  2017 ?        00:03:17 [watchdog/1]
root        13     2 98  2017 ?        103-06:10:14 [migration/2]
root        15     2  0  2017 ?        00:00:43 [ksoftirqd/2]
root        16     2  0  2017 ?        00:03:03 [watchdog/2]
root        17     2 99  2017 ?        104-01:05:17 [migration/3]
root        19     2  0  2017 ?        00:00:31 [ksoftirqd/3]
root        20     2  0  2017 ?        00:02:25 [watchdog/3]
root        21     2  0  2017 ?        00:00:00 [cpuset]
root        22     2  0  2017 ?        00:00:00 [khelper]
root        23     2  0  2017 ?        00:00:00 [netns]
root        24     2  0  2017 ?        00:00:29 [sync_supers]
root        25     2  0  2017 ?        00:00:01 [bdi-default]
root        26     2  0  2017 ?        00:00:00 [kintegrityd]
root        27     2  0  2017 ?        00:00:00 [kblockd]
root        28     2  0  2017 ?        00:00:00 [ata_sff]
root        29     2  0  2017 ?        00:00:00 [khubd]
root        30     2  0  2017 ?        00:00:00 [md]
root        31     2  0  2017 ?        00:00:04 [khungtaskd]
root        32     2  0  2017 ?        00:00:02 [kswapd0]
root        33     2  0  2017 ?        00:00:00 [ksmd]
root        34     2  0  2017 ?        00:01:30 [khugepaged]
root        35     2  0  2017 ?        00:00:00 [fsnotify_mark]
root        36     2  0  2017 ?        00:00:00 [crypto]
root        41     2  0  2017 ?        00:00:00 [kthrotld]
root        44     2  0  2017 ?        00:00:00 [kpsmoused]
root       102     2  0  2017 ?        00:01:29 [kworker/3:1]
root       103     2  0  2017 ?        00:17:33 [kworker/2:1]
root       182     2  0  2017 ?        00:00:00 [scsi_eh_0]
root       183     2  0  2017 ?        00:00:00 [scsi_eh_1]
root       231     2  0  2017 ?        00:00:00 [mpt_poll_0]
root       232     2  0  2017 ?        00:00:00 [mpt/0]
root       233     2  0  2017 ?        00:00:00 [scsi_eh_2]
root       245     2  0  2017 ?        00:00:00 [kworker/2:2]
root       271     2  0  2017 ?        00:00:00 [kworker/0:2]
root       275     2  0  2017 ?        00:08:58 [kworker/3:2]
root       316     2  0  2017 ?        00:00:00 [kdmflush]
root       330     2  0  2017 ?        00:00:32 [jbd2/dm-0-8]
root       331     2  0  2017 ?        00:00:00 [ext4-dio-unwrit]
root       429     1  0  2017 ?        00:00:00 /sbin/udevd -d
root       708     2  0  2017 ?        00:00:00 [vmmemctl]
root       778     2  0  2017 ?        00:00:00 [kdmflush]
root       781     2  0  2017 ?        00:00:00 [kdmflush]
root       783     2  0  2017 ?        00:00:00 [kdmflush]
root       785     2  0  2017 ?        00:00:00 [kdmflush]
root       787     2  0  2017 ?        00:00:00 [kdmflush]
root       824     2  0  2017 ?        00:14:42 [flush-252:4]
root       846     2  0  2017 ?        00:00:09 [jbd2/sda1-8]
root       847     2  0  2017 ?        00:00:00 [ext4-dio-unwrit]
root       848     2  0  2017 ?        00:00:03 [jbd2/dm-5-8]
root       849     2  0  2017 ?        00:00:00 [ext4-dio-unwrit]
root       850     2  0  2017 ?        00:02:11 [jbd2/dm-1-8]
root       851     2  0  2017 ?        00:00:00 [ext4-dio-unwrit]
root       852     2  0  2017 ?        00:00:23 [jbd2/dm-2-8]
root       853     2  0  2017 ?        00:00:00 [ext4-dio-unwrit]
root       854     2  0  2017 ?        00:35:25 [jbd2/dm-3-8]
root       855     2  0  2017 ?        00:00:00 [ext4-dio-unwrit]
root       856     2  0  2017 ?        00:16:03 [jbd2/dm-4-8]
root       857     2  0  2017 ?        00:00:00 [ext4-dio-unwrit]
root       902     2  0  2017 ?        00:35:50 [flush-252:3]
root       941     2  0  2017 ?        00:00:07 [kauditd]
root      1295     1  0  2017 ?        00:00:57 auditd
root      1299     1  0  2017 ?        02:35:36 /usr/sbin/vmtoolsd
root      1351     1  0  2017 ?        00:00:00 /usr/lib/vmware-vgauth/VGAuthService -s
root      1379     1  0  2017 ?        00:07:12 /usr/sbin/nslcd
root      1392     1  0  2017 ?        00:03:38 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5
root      1430     1  0  2017 ?        01:06:29 /usr/lib/vmware-caf/pme/bin/ManagementAgentHost
root      1445     1  0  2017 ?        00:05:31 /var/itlm/tlmagent.bin
dbus      1456     1  0  2017 ?        00:00:08 dbus-daemon --system
avahi     1468     1  0  2017 ?        00:06:39 avahi-daemon: running [XXXX.local]
avahi     1469  1468  0  2017 ?        00:00:00 avahi-daemon: chroot helper
68        1498     1  0  2017 ?        00:00:57 hald
root      1499  1498  0  2017 ?        00:00:00 hald-runner
root      1535     2  0  2017 ?        00:00:00 [kworker/1:2]
root      1543  1499  0  2017 ?        00:00:00 hald-addon-input: Listening on /dev/input/event0 /dev/input/event1
68        1551  1499  0  2017 ?        00:00:00 hald-addon-acpi: listening on acpi kernel interface /proc/acpi/event
root      1568     1  0  2017 ?        00:01:09 /usr/sbin/sshd
root      1576     1  0  2017 ?        00:04:34 xinetd -stayalive -pidfile /var/run/xinetd.pid
ntp       1588     1  0  2017 ?        00:00:57 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
root      1674     1  0  2017 ?        00:01:26 /usr/libexec/postfix/master
postfix   1686  1674  0  2017 ?        00:01:03 qmgr -l -t fifo -u
root      1688     1  0  2017 ?        00:07:03 /usr/sbin/httpd
root      1698     1  0  2017 ?        00:07:03 /bin/bash /usr/sbin/ksmtuned
root      1707     1  0  2017 ?        00:03:11 crond
root      1722     1  2  2017 ?        2-05:58:44 /opt/BESClient/bin/BESClient
root      1781     1  0  2017 tty1     00:00:00 /sbin/mingetty /dev/tty1
root      1783     1  0  2017 tty2     00:00:00 /sbin/mingetty /dev/tty2
root      1785     1  0  2017 tty3     00:00:00 /sbin/mingetty /dev/tty3
root      1787     1  0  2017 tty4     00:00:00 /sbin/mingetty /dev/tty4
root      1789     1  0  2017 tty5     00:00:00 /sbin/mingetty /dev/tty5
root      1791     1  0  2017 tty6     00:00:00 /sbin/mingetty /dev/tty6
root      1798   429  0  2017 ?        00:00:00 /sbin/udevd -d
root      1799   429  0  2017 ?        00:00:00 /sbin/udevd -d
root      2746     2  0 05:41 ?        00:00:00 [kworker/u:0]
postfix   3647  1674  0 09:16 ?        00:00:00 pickup -l -t fifo -u
apache    4508  1688  0 Jan29 ?        00:00:01 /usr/sbin/httpd
apache    4818  1688  0 Jan29 ?        00:00:02 /usr/sbin/httpd
root     10728  1568  0 07:15 ?        00:00:00 sshd: lawerenceb_admin [priv]
10046    11013 10728  0 07:15 ?        00:00:00 sshd: lawerenceb_admin@pts/0
10046    11014 11013  0 07:15 pts/0    00:00:00 -bash
root     11061     2  0  2017 ?        00:00:28 [flush-252:1]
root     11207 11014  0 07:16 pts/0    00:00:00 su -
root     11372 11207  0 07:16 pts/0    00:00:00 -bash
root     11926  1698  0 10:10 ?        00:00:00 sleep 60
nagios   11928 18593  0 10:10 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios   11929 18593  0 10:10 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios   11930 18593  0 10:10 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios   11931 18593  0 10:10 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios   11933 18593  0 10:10 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios   11934 11929  0 10:10 ?        00:00:00 /usr/local/nagios/libexec/check_ping -H XXXXX -w 100.0,20% -c 500.0,60% -p 5
nagios   11935 11928  0 10:10 ?        00:00:00 /usr/local/nagios/libexec/check_nrpe -u -t 60 -H XXXX8k36 -c check_logcontent_B2BService_Socketerror
nagios   11936 18593  0 10:10 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios   11937 18593  0 10:10 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios   11938 11931  0 10:10 ?        00:00:00 /usr/local/nagios/libexec/check_ping -H XXXX65 -w 100.0,20% -c 500.0,60% -p 5
nagios   11939 11933  0 10:10 ?        00:00:00 /usr/local/nagios/libexec/check_ping -H XXXX03 -w 100.0,20% -c 500.0,60% -p 5
nagios   11940 11930  0 10:10 ?        00:00:00 /usr/local/nagios/libexec/check_ping -H XXXXXn3 -w 100.0,20% -c 500.0,60% -p 5
nagios   11941 11934  0 10:10 ?        00:00:00 /bin/ping -n -U -w 10 -c 5 bdhvms45
nagios   11942 11936  0 10:10 ?        00:00:00 /usr/local/nagios/libexec/check_ping -H XXXpc -w 100.0,20% -c 500.0,60% -p 5
nagios   11943 11937  0 10:10 ?        00:00:00 /usr/local/nagios/libexec/check_ping -H XXXX80 -w 100.0,20% -c 500.0,60% -p 5
nagios   11944 11940  0 10:10 ?        00:00:00 /bin/ping -n -U -w 10 -c 5 CXXXXn3
nagios   11945 11938  0 10:10 ?        00:00:00 /bin/ping -n -U -w 10 -c 5 XXX65
nagios   11946 11939  0 10:10 ?        00:00:00 /bin/ping -n -U -w 10 -c 5 XXXX03
nagios   11947 11942  0 10:10 ?        00:00:00 /bin/ping -n -U -w 10 -c 5 XXXXpc
nagios   11948 11943  0 10:10 ?        00:00:00 /bin/ping -n -U -w 10 -c 5 XXXX80
root     11949 11372  0 10:10 pts/0    00:00:00 ps -aef
root     13882     2  0 Jan24 ?        00:00:50 [kworker/0:0]
apache   16213  1688  0 Jan28 ?        00:00:03 /usr/sbin/httpd
apache   17274  1688  0 Jan28 ?        00:00:03 /usr/sbin/httpd
apache   17275  1688  0 Jan28 ?        00:00:03 /usr/sbin/httpd
apache   17276  1688  0 Jan28 ?        00:00:03 /usr/sbin/httpd
apache   17277  1688  0 Jan28 ?        00:00:03 /usr/sbin/httpd
apache   17278  1688  0 Jan28 ?        00:00:03 /usr/sbin/httpd
apache   17279  1688  0 Jan28 ?        00:00:03 /usr/sbin/httpd
apache   17280  1688  0 Jan28 ?        00:00:03 /usr/sbin/httpd
apache   17281  1688  0 Jan28 ?        00:00:03 /usr/sbin/httpd
nagios   18593     1  3 Jan29 ?        00:57:58 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
root     26222     2  0 Jan29 ?        00:00:03 [kworker/u:1]
[root@XXXXX config]#
bosco
Posts: 40
Joined: Thu Nov 24, 2016 5:34 am

Re: Check time mismatch

Post by bosco »

have given above the output from nagios server,the check is ran on windows server where ps -aef is not showing any output
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Check time mismatch

Post by dwhitfield »

bosco wrote:.my need is check needs to run only one every hour -06 minutes,
Do you mean once every hour at the 6 minute mark? That is not something you can do from nagios directly. You would need to run this from cron.

If you are saying you want a check interval of 66 minutes, we should be able to do that.

Currently, you check interval is set to every 5 minutes, so it seems like one of us is way off. Can you help explain a little more what you are trying to do?
bosco
Posts: 40
Joined: Thu Nov 24, 2016 5:34 am

Re: Check time mismatch

Post by bosco »

Thanks for the responce.

The requirement of the script is to check for a particular file in a location and if file is found then script will thorw exost code as file and delet the file,this file will be auto generated every 1 hours 5 minutes,so the check needs to be run at ie the timing timing mentioned in the time period 00.06-00.07,01.06-01.07,02.06-02.07 etc,check interval was mentioned by me for 5 minutes if file is not found then it should check for next minutes also and report notification as file not found.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Check time mismatch

Post by dwhitfield »

bosco wrote: time period 00.06-00.07,01.06-01.07,02.06-02.07
Ok, I think I understand now. You are probably going to need to change your check interval to be 1 rather than 5 to get desired results. Given the way scheduling works, I'm not sure that's going to be enough, but it really depends on how many other checks you are running. Changing the check interval to 1 should *help* at the very least.
Locked