1 /* @(#) $Id: ./src/monitord/monitord.c, 2011/09/08 dcid Exp $
4 /* Copyright (C) 2009 Trend Micro Inc.
7 * This program is a free software; you can redistribute it
8 * and/or modify it under the terms of the GNU General Public
9 * License (version 2) as published by the FSF - Free Software
19 /* Real monitord global */
29 char str[OS_SIZE_1024 +1];
31 /* Waiting a few seconds to settle */
34 memset(str, '\0', OS_SIZE_1024 +1);
37 /* Getting currently time before starting */
42 thismonth = p->tm_mon;
43 thisyear = p->tm_year+1900;
47 /* Connecting to the message queue
50 if((mond.a_queue = StartMQ(DEFAULTQUEUE,WRITE)) < 0)
52 ErrorExit(QUEUE_FATAL, ARGV0, DEFAULTQUEUE);
56 /* Sending startup message */
57 snprintf(str, OS_SIZE_1024 -1, OS_AD_STARTED);
58 if(SendMSG(mond.a_queue, str, ARGV0,
61 merror(QUEUE_SEND, ARGV0);
65 /* Main monitor loop */
72 /* Checking unavailable agents */
73 if(mond.monitor_agents)
78 /* Day changed, deal with log files */
79 if(today != p->tm_mday)
81 /* Generate reports. */
82 generate_reports(today, thismonth, thisyear, p);
84 manage_files(today, thismonth, thisyear);
87 thismonth = p->tm_mon;
88 thisyear = p->tm_year+1900;
91 /* We only check every two minutes */