nagios-db-checkins Mailing List for Nagios-DB (Page 2)
Status: Beta
Brought to you by:
bench23
You can subscribe to this list here.
2005 |
Jan
(3) |
Feb
(19) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
---|
From: Matthew K. <mat...@us...> - 2005-01-29 05:01:47
|
Update of /cvsroot/nagios-db/nagios-db/database/mysql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28221 Modified Files: schema.sql Log Message: Add configured flag for keeping hostgroup/servicegroups across restarts. Index: schema.sql =================================================================== RCS file: /cvsroot/nagios-db/nagios-db/database/mysql/schema.sql,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** schema.sql 16 Jan 2005 20:19:55 -0000 1.2 --- schema.sql 29 Jan 2005 05:01:38 -0000 1.3 *************** *** 86,90 **** `check_type` int(11) NOT NULL default '0', `performance_data` text, - `current_notification_number` int(11) default NULL, UNIQUE KEY `host_check_unique_index` (`hostid`,`check_command`), KEY `host_check_hostid_index` (`hostid`), --- 86,89 ---- *************** *** 117,120 **** --- 116,120 ---- `name` varchar(64) NOT NULL default '' COMMENT 'the name of this hostgroup; how nagios keeps things unique, len from nagios MAX_HOSTNAME_LENGTH', `alias` text, + `configured` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), *************** *** 178,182 **** `check_type` int(11) NOT NULL default '0', `performance_data` text, - `current_notification_number` int(11) default NULL, UNIQUE KEY `service_check_unique_index` (`serviceid`,`check_command`), KEY `service_check_serviceid_index` (`serviceid`), --- 178,181 ---- *************** *** 209,212 **** --- 208,212 ---- `name` varchar(64) NOT NULL default '' COMMENT 'the name of thie servicegroup; how nagios keeps things unique, len from nagios MAX_HOSTNAME_LENGTH', `alias` text, + `configured` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), |
From: Matthew K. <mat...@us...> - 2005-01-29 05:00:52
|
Update of /cvsroot/nagios-db/nagios-db/neb/mysql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27430 Modified Files: inserter.c Log Message: - Make hostgroups/servicegroups persistant across restarts. Without this the ids could shift when a new group is added breaking a bookmark someone may have added. - Cleanup my other stupid mistakes with configured flag. Index: inserter.c =================================================================== RCS file: /cvsroot/nagios-db/nagios-db/neb/mysql/inserter.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** inserter.c 29 Jan 2005 03:13:01 -0000 1.7 --- inserter.c 29 Jan 2005 05:00:27 -0000 1.8 *************** *** 20,23 **** --- 20,25 ---- * - Adding a verbose mode. * - Cleanup sql statements for uniformity. + * - Error in sql before loading startup host/service data causes multiple + * 'inserter unloading' msg's * - General tidying. */ *************** *** 177,182 **** /* Now that we have a database connection, clear out the previous config info */ asprintf(&tmp, ! "delete from hostgroup"); // err handling buffer(&query_buf, tmp, ++query_buf_count); --- 179,185 ---- /* Now that we have a database connection, clear out the previous config info */ + /* clear out our memberships, we reload these each time */ asprintf(&tmp, ! "delete from hostgroup_membership"); // err handling buffer(&query_buf, tmp, ++query_buf_count); *************** *** 184,188 **** asprintf(&tmp, ! "delete from servicegroup"); // err handling buffer(&query_buf, tmp, ++query_buf_count); --- 187,191 ---- asprintf(&tmp, ! "delete from servicegroup_membership"); // err handling buffer(&query_buf, tmp, ++query_buf_count); *************** *** 195,204 **** free(tmp); ! asprintf(&tmp, ! "update host,service set host.configured = false and service.configured = false"); // err handling buffer(&query_buf, tmp, ++query_buf_count); free(tmp); /* run out these queries right now, we need to mark all host/services as unconfigured * before the large initial update which sets them back to TRUE as to weed out any dead --- 198,218 ---- free(tmp); ! /* this will leave any dead (removed from config hosts/hostgroups/servicegroups) as configured = false */ ! asprintf(&tmp, "update host,service set host.configured = false, service.configured = false"); ! // err handling ! buffer(&query_buf, tmp, ++query_buf_count); ! free(tmp); ! ! asprintf(&tmp, "update hostgroup set hostgroup.configured = false"); ! // err handling ! buffer(&query_buf, tmp, ++query_buf_count); ! free(tmp); ! ! asprintf(&tmp, "update servicegroup set servicegroup.configured = false"); // err handling buffer(&query_buf, tmp, ++query_buf_count); free(tmp); + /* run out these queries right now, we need to mark all host/services as unconfigured * before the large initial update which sets them back to TRUE as to weed out any dead *************** *** 238,241 **** --- 252,261 ---- write_to_logs_and_console(log,NSLOG_INFO_MESSAGE,TRUE); + /* now that we've loaded (possibly from the retention file) flag that they haven't been checked */ + asprintf(&tmp, "update host,service set host.has_been_checked = false, service.has_been_checked = false"); + // err handling + buffer(&query_buf, tmp, ++query_buf_count); + free(tmp); + /* .... and insert new config info. Start with hostgroups. */ for(groupcount=0, hg = hostgroup_list; hg ; hg = hg->next) *************** *** 251,256 **** "INSERT INTO hostgroup (" "name," ! "alias" ! ") VALUES (%s,%s)", NULL_STRING(groupName), NULL_STRING(groupAlias)); --- 271,280 ---- "INSERT INTO hostgroup (" "name," ! "alias," ! "configured" ! ") VALUES (%s,%s,TRUE)" ! " ON DUPLICATE KEY UPDATE " ! "alias=VALUES(alias)," ! "configured=TRUE", NULL_STRING(groupName), NULL_STRING(groupAlias)); *************** *** 399,403 **** if (delayed_unload == TRUE){ nebmodule_deinit(0,0); ! return 0; } --- 423,427 ---- if (delayed_unload == TRUE){ nebmodule_deinit(0,0); ! return -1; } |
From: Matthew K. <mat...@us...> - 2005-01-29 03:13:13
|
Update of /cvsroot/nagios-db/nagios-db/neb/mysql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7363 Modified Files: inserter.c Log Message: Remove host cleanup, we'll keep archives for any deleted hosts, will provide ui for users to clean this up later. Remove current_notification, not useful. Index: inserter.c =================================================================== RCS file: /cvsroot/nagios-db/nagios-db/neb/mysql/inserter.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** inserter.c 27 Jan 2005 06:07:30 -0000 1.6 --- inserter.c 29 Jan 2005 03:13:01 -0000 1.7 *************** *** 238,248 **** write_to_logs_and_console(log,NSLOG_INFO_MESSAGE,TRUE); - /* purge any dead entries, they should have been configured = true by now */ - asprintf(&tmp, - "delete from host where configured = false"); - // err handling - buffer(&query_buf, tmp, ++query_buf_count); - free(tmp); - /* .... and insert new config info. Start with hostgroups. */ for(groupcount=0, hg = hostgroup_list; hg ; hg = hg->next) --- 238,241 ---- *************** *** 478,486 **** "no_more_notifications," "check_type," ! "performance_data," ! "current_notification_number" ") VALUES "); } ! asprintf(&tmp, "((SELECT id from host where name=%s), %s,%f,%f,%d,%d,%d,%d,%d,%s,%d,%s,%d),", NULL_STRING(safeName), NULL_STRING(safeHostCheckCommand), --- 471,478 ---- "no_more_notifications," "check_type," ! "performance_data" ") VALUES "); } ! asprintf(&tmp, "((SELECT id from host where name=%s), %s,%f,%f,%d,%d,%d,%d,%d,%s,%d,%s),", NULL_STRING(safeName), NULL_STRING(safeHostCheckCommand), *************** *** 494,499 **** BOOLIFY_STRING(tmp_host->no_more_notifications), tmp_host->check_type, ! NULL_STRING(safePerfData), ! tmp_host->current_notification_number); if (append(&bulk_buf[BULK_HOST_CHECK], tmp, FALSE)) err_out(ERR_QUERY_BUILD); --- 486,490 ---- BOOLIFY_STRING(tmp_host->no_more_notifications), tmp_host->check_type, ! NULL_STRING(safePerfData)); if (append(&bulk_buf[BULK_HOST_CHECK], tmp, FALSE)) err_out(ERR_QUERY_BUILD); *************** *** 515,523 **** "no_more_notifications," "check_type," ! "performance_data," ! "current_notification_number" ") VALUES "); } ! asprintf(&tmp, "((SELECT id from host where name=%s), '',0,0,0,0,0,0,0,TRUE,0,NULL,0),", NULL_STRING(safeName)); if (append(&bulk_buf[BULK_HOST_CHECK], tmp, FALSE)) --- 506,513 ---- "no_more_notifications," "check_type," ! "performance_data" ") VALUES "); } ! asprintf(&tmp, "((SELECT id from host where name=%s), '',0,0,0,0,0,0,0,TRUE,0,NULL),", NULL_STRING(safeName)); if (append(&bulk_buf[BULK_HOST_CHECK], tmp, FALSE)) *************** *** 677,686 **** "no_more_notifications," "check_type," ! "performance_data," ! "current_notification_number" ") VALUES "); } asprintf(&tmp, "((SELECT id from service where service_description=%s and hostid=(SELECT id from host where name=%s))," ! "%s,%f,%f,%d,%d,%d,%d,%d,%s,%d,%s,%d" "),", NULL_STRING(safeServiceDescription), --- 667,675 ---- "no_more_notifications," "check_type," ! "performance_data" ") VALUES "); } asprintf(&tmp, "((SELECT id from service where service_description=%s and hostid=(SELECT id from host where name=%s))," ! "%s,%f,%f,%d,%d,%d,%d,%d,%s,%d,%s" "),", NULL_STRING(safeServiceDescription), *************** *** 696,701 **** BOOLIFY_STRING(tmp_service->no_more_notifications), tmp_service->check_type, ! NULL_STRING(safePerfData), ! tmp_service->current_notification_number); if (append(&bulk_buf[BULK_SERVICE_CHECK], tmp, FALSE)) err_out(ERR_QUERY_BUILD); --- 685,689 ---- BOOLIFY_STRING(tmp_service->no_more_notifications), tmp_service->check_type, ! NULL_STRING(safePerfData)); if (append(&bulk_buf[BULK_SERVICE_CHECK], tmp, FALSE)) err_out(ERR_QUERY_BUILD); *************** *** 924,929 **** "no_more_notifications=VALUES(no_more_notifications)," "check_type=VALUES(check_type)," ! "performance_data=VALUES(performance_data)," ! "current_notification_number=VALUES(current_notification_number)", TRUE)) err_out(ERR_QUERY_BUILD); --- 912,916 ---- "no_more_notifications=VALUES(no_more_notifications)," "check_type=VALUES(check_type)," ! "performance_data=VALUES(performance_data)", TRUE)) err_out(ERR_QUERY_BUILD); *************** *** 960,965 **** "no_more_notifications=VALUES(no_more_notifications)," "check_type=VALUES(check_type)," ! "performance_data=VALUES(performance_data)," ! "current_notification_number=VALUES(current_notification_number)", TRUE)) err_out(ERR_QUERY_BUILD); --- 947,951 ---- "no_more_notifications=VALUES(no_more_notifications)," "check_type=VALUES(check_type)," ! "performance_data=VALUES(performance_data)", TRUE)) err_out(ERR_QUERY_BUILD); |