1 /* Copyright (C) 2009 Trend Micro Inc.
4 * This program is a free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General Public
6 * License (version 2) as published by the FSF - Free Software
13 /* Global variables */
26 char str[OS_SIZE_1024 + 1];
28 /* Wait a few seconds to settle */
31 memset(str, '\0', OS_SIZE_1024 + 1);
33 /* Get current time before starting */
38 thismonth = p->tm_mon;
39 thisyear = p->tm_year + 1900;
41 /* Connect to the message queue or exit */
42 if ((mond.a_queue = StartMQ(DEFAULTQUEUE, WRITE)) < 0) {
43 ErrorExit(QUEUE_FATAL, ARGV0, DEFAULTQUEUE);
46 /* Send startup message */
47 snprintf(str, OS_SIZE_1024 - 1, OS_AD_STARTED);
48 if (SendMSG(mond.a_queue, str, ARGV0,
50 merror(QUEUE_SEND, ARGV0);
53 /* Main monitor loop */
58 /* Check for unavailable agents */
59 if (mond.monitor_agents) {
63 /* Day changed, deal with log files */
64 if (today != p->tm_mday) {
65 /* Generate reports */
66 generate_reports(today, thismonth, thisyear);
68 manage_files(today, thismonth, thisyear);
71 thismonth = p->tm_mon;
72 thisyear = p->tm_year + 1900;
75 /* We only check every two minutes */