Index: /branches/rel_apv_10_7/usr/click/bin/webui_storemon/storemon.c
===================================================================
--- /branches/rel_apv_10_7/usr/click/bin/webui_storemon/storemon.c	(revision 39135)
+++ /branches/rel_apv_10_7/usr/click/bin/webui_storemon/storemon.c	(working copy)
@@ -336,7 +336,8 @@
         }
         result = sqlite3_exec(conn, table_init_sql[i],0,0,0);
         if (result != SQLITE_OK) {
-            plog(LOG_ERR, "init db table failed: %s", table_init_sql[i]);
+            plog(LOG_ERR, "init db table failed: %s\n", table_init_sql[i]);
+            plog(LOG_ERR, "SQLite error: %s\n", sqlite3_errmsg(conn));
         }
     }
     return 0;
Index: /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/metric.py
===================================================================
--- /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/metric.py	(revision 39135)
+++ /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/metric.py	(working copy)
@@ -248,6 +248,9 @@
                         db.execute(cmd)
                     except sqlite3.OperationalError, e:
                         return []
+        except sqlite3.DatabaseError, e:
+            # file is encrypted or is not a database
+            return []
 
         result = db.fetchall()
         conn.close()
Index: /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/DatabaseUtils.py
===================================================================
--- /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/DatabaseUtils.py	(revision 0)
+++ /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/DatabaseUtils.py	(working copy)
@@ -0,0 +1,241 @@
+import time
+from datetime import datetime
+import os
+import sqlite3
+
+class DatabaseUtils():
+    C_PATH_SYSTEM_INTERFACE_DB = "/var/crash/graphdb/"
+
+    table_init_sql = [
+        "CREATE TABLE IF NOT EXISTS ClusterVirtualInterface (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, transition_to_master NUMERIC, quit_master NUMERIC, VRRP_loss NUMERIC, quick_transition NUMERIC, inconsistency NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS HAGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, group_event_offline_stat NUMERIC, group_event_online_stat NUMERIC, group_event_priority_stat NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SSFStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, session_count NUMERIC, recv_events_new NUMERIC, recv_events_delete NUMERIC, recv_events_keepalive NUMERIC, recv_events_update_conn NUMERIC, recv_events_update_udata NUMERIC, recv_events_update_all NUMERIC, send_events_new NUMERIC, send_events_delete NUMERIC, send_events_keepalive NUMERIC, send_events_update_conn NUMERIC, send_events_update_udata NUMERIC, send_events_update_all NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QueryStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, total_req NUMERIC, total_succ NUMERIC, total_pass NUMERIC, total_fail NUMERIC, total_drop NUMERIC, req NUMERIC, succ NUMERIC, pass NUMERIC, fail NUMERIC, curr_drop NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LocalDNSStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, ipv4_total_request NUMERIC, ipv4_succ_request NUMERIC, ipv4_pass_request NUMERIC, ipv4_fail_request NUMERIC, ipv4_drop_request NUMERIC, ipv6_total_request NUMERIC, ipv6_succ_request NUMERIC, ipv6_pass_request NUMERIC, ipv6_fail_request NUMERIC, ipv6_drop_request NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS Host (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, host_hits NUMERIC, def_hits NUMERIC, reg_policy_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DefaultPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, matches NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RegionPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, matches NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS Region (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, matches NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS NormalPool (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, pool_hits NUMERIC, pri_hits NUMERIC, sec_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS CnamePool (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PoolMember (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, selected NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS Service (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LLBGlobalStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, connTcpInTot NUMERIC, connTCPOutTot NUMERIC, connTCPTot NUMERIC, connUDPTot NUMERIC, connICMPTot NUMERIC, concurConnTCPTot NUMERIC, concurConnUDPTot NUMERIC, concurConnICMPTot NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DNSProxyServer (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DNSProxyDomain (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DNSProxyNetwork (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LLBDNSRecord (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, total_query NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LLBDNSAddress (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LLBLinkRoute (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, resp_time NUMERIC, totalBytesIn NUMERIC, totalBytesOut NUMERIC, totalPktsIn NUMERIC, totalPktsOut NUMERIC, connTcpIn NUMERIC, connTCPOut NUMERIC, connTcp NUMERIC, connUDP NUMERIC, connICMP NUMERIC, concurConnTCP NUMERIC, concurConnUDP NUMERIC, concurConnICMP NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LLBLinkDNSHealthChecker (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, send_counter NUMERIC, send_error_counter NUMERIC, recv_counter NUMERIC, timeout_counter NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LLBLinkTCPHealthChecker (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, send_counter NUMERIC, send_error_counter NUMERIC, recv_counter NUMERIC, timeout_counter NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LLBLinkICMPHealthChecker (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, send_counter NUMERIC, send_error_counter NUMERIC, recv_counter NUMERIC, timeout_counter NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LLBLinkOutboundSettings (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, dd_entry_count NUMERIC, sent_packets_num NUMERIC, probing_dstip_num NUMERIC, ipv4_link_route_num NUMERIC, ipv6_link_route_num NUMERIC, daemon_detect_times NUMERIC, filter_out_ipv4_data NUMERIC, filter_out_ipv6_data NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LLBRSiteNetwork (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, total_detect_times NUMERIC, total_detect_up_times NUMERIC, total_detect_down_times NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS GlobalStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, totalConnectionPerSec NUMERIC, currentConnection NUMERIC, throughputPkgOut NUMERIC, throughputPkgIn NUMERIC, throughputByteOut NUMERIC, throughputByteIn NUMERIC, clientConnectionPerSec NUMERIC, clientRequestPerSec NUMERIC, clientThroughputPkgOut NUMERIC, clientThroughputPkgIn NUMERIC, serverConnectionPerSec NUMERIC, serverThroughputPkgOut NUMERIC, serverThroughputPkgIn NUMERIC, rsTotalCntOfReq NUMERIC, rsTotalConnCnt NUMERIC, rsTotalHits NUMERIC, vsTotalURLHits NUMERIC, vsTotalHostnameHits NUMERIC, vsTotalPerstntCookieHits NUMERIC, vsTotalQosCookieHits NUMERIC, vsTotalQosDnsdomainHits NUMERIC, vsTotalDnssecHits NUMERIC, vsTotalDefaultHits NUMERIC, vsTotalPerstntURLHits NUMERIC, vsTotalStaticHits NUMERIC, vsTotalQosNetworkHits NUMERIC, vsTotalBackupHits NUMERIC, vsTotalCacheHits NUMERIC, vsTotalRegexHits NUMERIC, vsTotalRCookieHits NUMERIC, vsTotalICookieHits NUMERIC, vsTotalQosClntportHits NUMERIC, vsTotalHeaderHits NUMERIC, vsTotalHashURLHits NUMERIC, vsTotalRedirectHits NUMERIC, vsTotalRTSPFiletypeHits NUMERIC, vsTotalQosBodyHits NUMERIC, vsTotalRadUNameHits NUMERIC, vsTotalRadSidHits NUMERIC, vsTotalConnections NUMERIC, vsThroughputByteIn NUMERIC, vsThroughputByteOut NUMERIC, vsTotalConnectionsAll NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RRGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS GRRGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LCGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SRGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SNMPGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS HCGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ICGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RCGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PCGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ECGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS HHGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PHGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PUGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS CHHGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS HQGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS L2RRGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, drops NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS L2HIGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, drops NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS L2CHIGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, drops NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PIGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS HIGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS CHIGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS HIPGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LBGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SSLSIDGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SIPCIDGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SIPUIDGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PTOGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RDPRTGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RADCHUGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RADCHSGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RADPSUNGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SIPCIDPSGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SIPUIDPSGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS TUXEDOGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PROXGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DiametersidGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS GeneralPersistenceGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS OrchestratorGroup (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC, session_count NUMERIC, staticsession NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS HTTPHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC, sent_attempted_num NUMERIC, send_failed_num NUMERIC, response_received_num NUMERIC, failed_response_time_out NUMERIC, failed_response_not_time_out NUMERIC, failed_read_num NUMERIC, response_match_count NUMERIC, response_mismatch_count NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS LDAPHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC, bind_request_sent_num NUMERIC, bind_request_sent_failed_num NUMERIC, search_request_sent_num NUMERIC, search_request_sent_failed_num NUMERIC, bind_response_received_num NUMERIC, bind_response_received_failed_num NUMERIC, bind_failed_num NUMERIC, search_response_received_num NUMERIC, search_response_received_failed_num NUMERIC, search_failed_num NUMERIC, unfull_packets_num NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS TCPHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS TCPSHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS FTPHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS UDPHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ICMPHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DNSHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SIPTCPHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SIPUDPHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RTSPTCPHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS MYSQLDBHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS MYSQLDBSHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS MSSQLDBHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS MSSQLDBSHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DiameterTCPHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RadiusAuthHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RadiusAcctHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ScriptHealthCheck (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, times_server_up NUMERIC, times_server_down NUMERIC, connections_attempted NUMERIC, connections_succeeded NUMERIC, connections_failed_not_time_out NUMERIC, connections_failed_time_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS StaticPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS slb_DefaultPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS BackupPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QoSCookiePolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RCPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ICPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PCPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS HeaderPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RegexPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PUPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS HashURLPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QoSHostname (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QoSURLPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QoSBody (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QoSClientPortPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QoSNetworkPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RedirectPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RTSPFileTypePolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RadiusSessIDPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RadiusUsernamePolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DNSSecPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QosDiameterPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QosDiameterAppIDPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QoSDNSDomainPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DohPolicy (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS L4L7RealService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, outstanding_request NUMERIC, total_hits NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, average_response_time NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS TUXEDORealService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, outstanding_request NUMERIC, total_hits NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, average_response_time NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS IPRealService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, outstanding_request NUMERIC, total_hits NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, average_response_time NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS FWDMACRealService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, outstanding_request NUMERIC, total_hits NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, average_response_time NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS L2IPRealService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, total_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS L2MACRealService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, total_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SSLGlobalStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, totalRequestedConns NUMERIC, totalAcceptedConns NUMERIC, totalOpenSSLConns NUMERIC, totalRecordsIn NUMERIC, totalRecordsOut NUMERIC, totalBytesIn NUMERIC, totalBytesOut NUMERIC, totalRc4Md5CompHS NUMERIC, totalRc4ShaCompHS NUMERIC, totalDesCbc3ShaCompHS NUMERIC, totalAes128ShaCompHS NUMERIC, totalAes256ShaCompHS NUMERIC, totalDesCbcShaCompHS NUMERIC, totalAES128SHA256CompHS NUMERIC, totalAES256SHA256CompHS NUMERIC, totalExpRc4Md5CompHS NUMERIC, totalExpDesCbcShaCompHS NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SSLRealHost (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, open_conn NUMERIC, accept_conn NUMERIC, request_conn NUMERIC, request_rate NUMERIC, resumed_sess NUMERIC, resumable_sess NUMERIC, sess_misses NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SSLVirtualHost (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, open_conn NUMERIC, accept_conn NUMERIC, request_conn NUMERIC, request_rate NUMERIC, resumed_sess NUMERIC, resumable_sess NUMERIC, sess_misses NUMERIC, local_cache_conn NUMERIC, cache_conn NUMERIC, db_conn NUMERIC, cloud_conn NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS Vlink (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, qos_clientport_hits NUMERIC, qos_network_hits NUMERIC, persistent_url_hits NUMERIC, rcookie_hits NUMERIC, icookie_hits NUMERIC, persistent_cookie_hits NUMERIC, qos_cookie_hits NUMERIC, qos_hostname_hits NUMERIC, qos_url_hits NUMERIC, qos_body_hits NUMERIC, regex_hits NUMERIC, header_hits NUMERIC, hashurl_hits NUMERIC, redirect_hits NUMERIC, raduname_hits NUMERIC, radsid_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS CacheGlobalStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, cacheHitRatio NUMERIC, cacheMemUtil NUMERIC, cacheHitTotalResp NUMERIC, cacheHits NUMERIC, hitsReplyWNotModified NUMERIC, cacheMissWNewEntry NUMERIC, cacheMissWNegEntryHit NUMERIC, cacheMissReq NUMERIC, cacheMissResp NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ProxyGlobalStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, totalRequests NUMERIC, cacheRedirectTotalResp NUMERIC, clientEstabConn NUMERIC, serverEstabConn NUMERIC, respCode100 NUMERIC, respCodeOther100 NUMERIC, respCode200 NUMERIC, respCode206 NUMERIC, respCodeOther200 NUMERIC, respCode301 NUMERIC, respCode302 NUMERIC, respCode304 NUMERIC, respCodeOther300 NUMERIC, respCode400 NUMERIC, respCode401 NUMERIC, respCode404 NUMERIC, respCodeOther400 NUMERIC, respCode502 NUMERIC, respCode503 NUMERIC, respCodeOther500 NUMERIC, respCodeInvalid NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PervsProxyStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, totalRequests NUMERIC, totalRedirectsBeforeCache NUMERIC, clientEstabConn NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PervsCacheStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, cacheHitRatio NUMERIC, cacheHits NUMERIC, hitsReplyWNotModified NUMERIC, cacheMissWNewEntry NUMERIC, cacheMissWNegEntryHit NUMERIC, cacheMissReq NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS CompressionGlobalStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, totalBytesRcvd NUMERIC, totalBytesSent NUMERIC, CompBytesRcvd NUMERIC, CompBytesSent NUMERIC, compRatioComp NUMERIC, compRatioAll NUMERIC, noncompBytesLowRes NUMERIC, noncompBytesNoClnt NUMERIC, noncompBytesDocType NUMERIC, noncompBytesResp NUMERIC, noncompObjsLowRes NUMERIC, noncompObjsNoClnt NUMERIC, noncompObjsDocType NUMERIC, noncompObjsRespCode NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS IPVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, qos_clientport_hits NUMERIC, qos_network_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS L2IPVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, total_hits NUMERIC, default_hits NUMERIC, packet_drop NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS TCPVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, qos_clientport_hits NUMERIC, qos_network_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS TCPSVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, qos_clientport_hits NUMERIC, qos_network_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS UDPVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, qos_clientport_hits NUMERIC, qos_network_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS TUXEDOVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS HTTPVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, qos_clientport_hits NUMERIC, qos_network_hits NUMERIC, persistent_url_hits NUMERIC, rcookie_hits NUMERIC, icookie_hits NUMERIC, persistent_cookie_hits NUMERIC, qos_cookie_hits NUMERIC, qos_hostname_hits NUMERIC, qos_url_hits NUMERIC, qos_body_hits NUMERIC, regex_hits NUMERIC, header_hits NUMERIC, hashurl_hits NUMERIC, redirect_hits NUMERIC, raduname_hits NUMERIC, radsid_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC, cache_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS HTTPSVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, qos_clientport_hits NUMERIC, qos_network_hits NUMERIC, persistent_url_hits NUMERIC, rcookie_hits NUMERIC, icookie_hits NUMERIC, persistent_cookie_hits NUMERIC, qos_cookie_hits NUMERIC, qos_hostname_hits NUMERIC, qos_url_hits NUMERIC, qos_body_hits NUMERIC, regex_hits NUMERIC, header_hits NUMERIC, hashurl_hits NUMERIC, redirect_hits NUMERIC, raduname_hits NUMERIC, radsid_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC, cache_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS FTPVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, qos_clientport_hits NUMERIC, qos_network_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS FTPSVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, qos_clientport_hits NUMERIC, qos_network_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RTSPVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC, filetype_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DNSVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, qos_clientport_hits NUMERIC, qos_network_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RDPVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RADAcctVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, radsid_hits NUMERIC, raduname_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RADAuthVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, radsid_hits NUMERIC, raduname_hits NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SIPUDPVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SIPTCPVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DiameterVirtualService (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, current_connection_count NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, diameter_input_msg NUMERIC, diameter_output_msg NUMERIC, diameter_drop_msg NUMERIC, diameter_ret_msg NUMERIC, diameter_input_speed NUMERIC, diameter_output_speed NUMERIC, diameter_ccr NUMERIC, diameter_cca NUMERIC, diameter_cer NUMERIC, diameter_cea NUMERIC, diameter_dwr NUMERIC, diameter_dwa NUMERIC, diameter_unexpect_cca NUMERIC, default_hits NUMERIC, static_hits NUMERIC, backup_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS StaticNATEntry (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, outbound_icmp_total_connection NUMERIC, outbound_icmp_current_connection NUMERIC, outbound_udp_total_connection NUMERIC, outbound_udp_current_connection NUMERIC, outbound_tcp_total_connection NUMERIC, outbound_tcp_current_connection NUMERIC, outbound_total_packets_in NUMERIC, outbound_total_packets_out NUMERIC, outbound_total_bytes_in NUMERIC, outbound_total_bytes_out NUMERIC, inbound_icmp_total_connection NUMERIC, inbound_icmp_current_connection NUMERIC, inbound_udp_total_connection NUMERIC, inbound_udp_current_connection NUMERIC, inbound_tcp_total_connection NUMERIC, inbound_tcp_current_connection NUMERIC, inbound_total_packets_in NUMERIC, inbound_total_packets_out NUMERIC, inbound_total_bytes_in NUMERIC, inbound_total_bytes_out NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS NATPortIPPoolEntry (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, icmp_total_connection NUMERIC, icmp_current_connection NUMERIC, udp_total_connection NUMERIC, udp_current_connection NUMERIC, tcp_total_connection NUMERIC, tcp_current_connection NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS NATPortIPEntry (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, icmp_total_connection NUMERIC, icmp_current_connection NUMERIC, udp_total_connection NUMERIC, udp_current_connection NUMERIC, tcp_total_connection NUMERIC, tcp_current_connection NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS NAT64Settings (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, a_query_counter NUMERIC, a4_query_counter NUMERIC, a_response_counter NUMERIC, a4_response_counter NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS NATProtocolSettings (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, outbound_gre_tunnel NUMERIC, outbound_out_packets NUMERIC, outbound_in_packets NUMERIC, outbound_out_bytes NUMERIC, outbound_in_bytes NUMERIC, inbound_gre_tunnel NUMERIC, inbound_out_packets NUMERIC, inbound_in_packets NUMERIC, inbound_out_bytes NUMERIC, inbound_in_bytes NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DNSCahceSettings (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, num NUMERIC, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SystemInterface (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, framesIn NUMERIC, framesOut NUMERIC, bytesIn NUMERIC, bytesOut NUMERIC, throughput_in_bits NUMERIC, throughput_in_packets NUMERIC, throughput_out_bits NUMERIC, throughput_out_packets NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS BondInterface (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, framesIn NUMERIC, framesOut NUMERIC, bytesIn NUMERIC, bytesOut NUMERIC, throughput_in_bits NUMERIC, throughput_in_packets NUMERIC, throughput_out_bits NUMERIC, throughput_out_packets NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS VlanInterface (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, throughput_in_bits NUMERIC, throughput_in_packets NUMERIC, throughput_out_bits NUMERIC, throughput_out_packets NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS InterfaceThroughputStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, totalFramesIn NUMERIC, totalFramesOut NUMERIC, totalBytesIn NUMERIC, totalBytesOut NUMERIC, throughput_in_bits NUMERIC, throughput_in_packets NUMERIC, throughput_out_bits NUMERIC, throughput_out_packets NUMERIC, throughput_out_error NUMERIC, throughput_in_error NUMERIC, throughput_out_ucast_packets NUMERIC, throughput_in_ucast_packets NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QosRootQueue (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, pkts NUMERIC, bytes NUMERIC, dropped_pkts NUMERIC, dropped_bytes NUMERIC, peak_in_hour NUMERIC, cur_band NUMERIC, avg_band NUMERIC, qlength NUMERIC, borrows NUMERIC, suspends NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QosSubQueue (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, pkts NUMERIC, bytes NUMERIC, dropped_pkts NUMERIC, dropped_bytes NUMERIC, peak_in_hour NUMERIC, cur_band NUMERIC, avg_band NUMERIC, qlength NUMERIC, borrows NUMERIC, suspends NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS QosFilter (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS VXLANInterface (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, throughput_in_bits NUMERIC, throughput_in_packets NUMERIC, throughput_out_bits NUMERIC, throughput_out_packets NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RHISetting (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, viplist_updates NUMERIC, new_vip NUMERIC, activate NUMERIC, deactivate NUMERIC, activate_fail NUMERIC, deactivate_fail NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS Eroute (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS AutoGenerateEroute (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ERouteStatistics (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, ipv4_eroute NUMERIC, ipv4_eroute_look_up_only NUMERIC, ipv4_eroute_look_up_update NUMERIC, ipv4_eroute_fail NUMERIC, ipv4_ipflow NUMERIC, ipv4_ipflow_lookup NUMERIC, ipv4_droute NUMERIC, ipv4_droute_look_up NUMERIC, ipv4_rts NUMERIC, ipv4_rts_look_up NUMERIC, ipv4_domain_eroute NUMERIC, ipv4_domain_resolved_eroute NUMERIC, ipv4_droute_entry_allocations_errors NUMERIC, ipv6_eroute NUMERIC, ipv6_eroute_look_up_only NUMERIC, ipv6_eroute_look_up_update NUMERIC, ipv6_eroute_fail NUMERIC, ipv6_ipflow NUMERIC, ipv6_ipflow_lookup NUMERIC, ipv6_droute NUMERIC, ipv6_droute_look_up NUMERIC, ipv6_rts NUMERIC, ipv6_rts_look_up NUMERIC, ipv6_domain_eroute NUMERIC, ipv6_domain_resolved_eroute NUMERIC, ipv6_droute_entry_allocations_errors NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS IPFlow (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, ip_overflow_num NUMERIC, ipflow_hits NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS IPRTS (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, rts_over_num NUMERIC, rts_lokp NUMERIC, match_egw_match NUMERIC, match_hgw_match NUMERIC, match_non NUMERIC, match_hgw_fail NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS NTPSettings (pk varchar(512), time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, sysstats_reset NUMERIC, packets_received NUMERIC, bad NUMERIC, auth_failed NUMERIC, declined NUMERIC, restricted NUMERIC, rate_limited NUMERIC, KoD_responses NUMERIC, processed_for_time NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS GlobalVirtualServiceStats (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, service_name varchar(259), current_connection_count NUMERIC, rps NUMERIC, total_connection_count NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, average_packets_in NUMERIC, average_packets_out NUMERIC, average_rtt NUMERIC, average_request_time NUMERIC, average_response_time NUMERIC, connection_count NUMERIC, total_handshake_count NUMERIC, successful_handshake_count NUMERIC, successful_handshake_rate NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS GlobalRealServiceStats (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, service_name varchar(259), current_connection_count NUMERIC, total_hits NUMERIC, total_bytes_in NUMERIC, total_bytes_out NUMERIC, total_packets_in NUMERIC, total_packets_out NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, average_packets_in NUMERIC, average_packets_out NUMERIC, average_response_time NUMERIC, connection_count NUMERIC, reqcount NUMERIC, total_handshake_count NUMERIC, successful_handshake_count NUMERIC, successful_handshake_rate NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ExSLBNodeStatistics (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, name varchar(255), current_connection_count NUMERIC, cps NUMERIC, rps NUMERIC, average_bandwidth NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS GlobalSSLThroughStats (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, average_bandwidth_in_vhost NUMERIC, average_bandwidth_out_vhost NUMERIC, average_bandwidth_in_rhost NUMERIC, average_bandwidth_out_rhost NUMERIC, current_connection_count NUMERIC, connection_per_second NUMERIC, total_handshake_count NUMERIC, successful_handshake_count NUMERIC, successful_handshake_rate NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ExSSLVirtualHostStatistics (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, name varchar(371), current_connection_count NUMERIC, connection_count NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, total_handshake_count NUMERIC, successful_handshake_count NUMERIC, successful_handshake_rate NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ExSSLRealHostStatistics (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, name varchar(371), current_connection_count NUMERIC, connection_count NUMERIC, average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, total_handshake_count NUMERIC, successful_handshake_count NUMERIC, successful_handshake_rate NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PervsCompressStatistics (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, service_name varchar(259), compRatioComp NUMERIC, compRatioAll NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS RealServiceHTTPCodeStatistics (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, service_name varchar(259), resp_100 NUMERIC, resp_101 NUMERIC, resp_200 NUMERIC, resp_206 NUMERIC, resp_301 NUMERIC, resp_302 NUMERIC, resp_303 NUMERIC, resp_304 NUMERIC, resp_305 NUMERIC, resp_307 NUMERIC, resp_400 NUMERIC, resp_401 NUMERIC, resp_402 NUMERIC, resp_403 NUMERIC, resp_404 NUMERIC, resp_405 NUMERIC, resp_406 NUMERIC, resp_407 NUMERIC, resp_416 NUMERIC, resp_500 NUMERIC, resp_501 NUMERIC, resp_502 NUMERIC, resp_503 NUMERIC, resp_504 NUMERIC, resp_505 NUMERIC, resp_others NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS VirtualServiceHTTPCodeStatistics (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, service_name varchar(259), resp_100 NUMERIC, resp_101 NUMERIC, resp_200 NUMERIC, resp_206 NUMERIC, resp_301 NUMERIC, resp_302 NUMERIC, resp_303 NUMERIC, resp_304 NUMERIC, resp_307 NUMERIC, resp_400 NUMERIC, resp_401 NUMERIC, resp_402 NUMERIC, resp_403 NUMERIC, resp_404 NUMERIC, resp_405 NUMERIC, resp_406 NUMERIC, resp_407 NUMERIC, resp_416 NUMERIC, resp_500 NUMERIC, resp_501 NUMERIC, resp_502 NUMERIC, resp_503 NUMERIC, resp_504 NUMERIC, resp_505 NUMERIC, resp_901 NUMERIC, resp_902 NUMERIC, resp_903 NUMERIC, resp_904 NUMERIC, resp_905 NUMERIC, resp_906 NUMERIC, resp_others NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ExLLBLinkStatistics (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, name varchar(32), average_bandwidth_in NUMERIC, average_bandwidth_out NUMERIC, usage NUMERIC, thresh NUMERIC, current_connection NUMERIC, hits NUMERIC, status NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS SystemStatus (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, cpu_usage NUMERIC, system_memory_usage NUMERIC, network_memory_usage NUMERIC, connection_memory_usage NUMERIC, cps NUMERIC, rps NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS ChainStats (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, chain_name varchar(128), uplink_bps_inbound NUMERIC, uplink_bps_outbound NUMERIC, downlink_bps_inbound NUMERIC, downlink_bps_outbound NUMERIC, uplink_pps_inbound NUMERIC, uplink_pps_outbound NUMERIC, downlink_pps_inbound NUMERIC, downlink_pps_outbound NUMERIC, deny_uplink NUMERIC, deny_downlink NUMERIC, total_uplink_bytes_inbound NUMERIC, total_uplink_bytes_outbound NUMERIC, total_downlink_bytes_inbound NUMERIC, total_downlink_bytes_outbound NUMERIC, total_uplink_packets_inbound NUMERIC, total_uplink_packets_outbound NUMERIC, total_downlink_packets_inbound NUMERIC, total_downlink_packets_outbound NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS L2L3L4ServiceStats (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, service_name varchar(128), todev_bps_inbound NUMERIC, todev_bps_outbound NUMERIC, fromdev_bps_inbound NUMERIC, fromdev_bps_outbound NUMERIC, todev_pps_inbound NUMERIC, todev_pps_outbound NUMERIC, fromdev_pps_inbound NUMERIC, fromdev_pps_outbound NUMERIC, deny_todev NUMERIC, deny_fromdev NUMERIC, todev_bytes_inbound NUMERIC, todev_bytes_outbound NUMERIC, fromdev_bytes_inbound NUMERIC, fromdev_bytes_outbound NUMERIC, todev_packets_inbound NUMERIC, todev_packets_outbound NUMERIC, fromdev_packets_inbound NUMERIC, fromdev_packets_outbound NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS TapServiceStats (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, service_name varchar(128), todev_bps_inbound NUMERIC, todev_bps_outbound NUMERIC, todev_pps_inbound NUMERIC, todev_pps_outbound NUMERIC, todev_bytes_inbound NUMERIC, todev_bytes_outbound NUMERIC, todev_packets_inbound NUMERIC, todev_packets_outbound NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS DeviceStats (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, device_name varchar(128), todev_bps_inbound NUMERIC, todev_bps_outbound NUMERIC, fromdev_bps_inbound NUMERIC, fromdev_bps_outbound NUMERIC, todev_pps_inbound NUMERIC, todev_pps_outbound NUMERIC, fromdev_pps_inbound NUMERIC, fromdev_pps_outbound NUMERIC, todev_bytes_inbound NUMERIC, todev_bytes_outbound NUMERIC, fromdev_bytes_inbound NUMERIC, fromdev_bytes_outbound NUMERIC, todev_packets_inbound NUMERIC, todev_packets_outbound NUMERIC, fromdev_packets_inbound NUMERIC, fromdev_packets_outbound NUMERIC);",
+        "CREATE TABLE IF NOT EXISTS PolicyStats (time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, policy_name varchar(128), deny_to_bytes NUMERIC, deny_from_bytes NUMERIC, deny_to_frames NUMERIC, deny_from_frames NUMERIC);",
+        ""
+    ]
+
+    def get_date_for_db_name(self):
+        now = time.asctime( time.localtime(time.time()) )
+        now_date = datetime.strptime(now, '%a %b %d %H:%M:%S %Y')
+        db_name = now_date.strftime('%Y-%m-%d') + '.db'
+        return db_name
+
+    def num(self, s):
+        if not s or s == '-':
+            return 0
+        try:
+            return int(s)
+        except ValueError:
+            try:
+                return float(s)
+            except ValueError:
+                # not a number string
+                return 0
+
+    def remove_if_is_not_sqlite3_file(self, filename):
+        if not os.path.isfile(filename):
+            return
+        with open(filename, 'rb') as f:
+            header = f.read(16)
+            if header == 'SQLite format 3\000':
+                return
+        # remove the file if the file is not sqlite3 file
+        os.remove(filename)
+
+    def check_table_or_create(self, db_name):
+        conn = sqlite3.connect(db_name)
+        db = conn.cursor()
+        for sql in self.table_init_sql:
+            try:
+                db.execute(sql)
+            except Exception as ex:
+                return str(ex)
+            finally:
+                conn.commit()
+        conn.close()
+        return ""
+
+    def prevent_db_file_corrupted(self, db_name):
+        self.remove_if_is_not_sqlite3_file(db_name)
+        # if file be removed in previous code
+        # then it will create file and tables in this function
+        try:
+            self.check_table_or_create(db_name)
+        except Exception as ex:
+            print("Cannot create tables")
+            print(str(ex))
+            return
Index: /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/SLBRSGroup.py
===================================================================
--- /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/SLBRSGroup.py	(revision 0)
+++ /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/SLBRSGroup.py	(working copy)
@@ -0,0 +1,146 @@
+import commands
+import re
+from DatabaseUtils import DatabaseUtils
+import sqlite3
+import time
+
+class SLBRSGroup():
+
+    C_GROUP_DB_MATCH_BY_METHOD = {
+        'rr': 'RRGroup',
+        'grr': 'GRRGroup',
+        'lc': 'LCGroup',
+        'sr': 'SRGroup',
+        'snmp': 'SNMPGroup',
+        'hc': 'HCGroup',
+        'ic': 'ICGroup',
+        'rc': 'RCGroup',
+        'pc': 'PCGroup',
+        'ec': 'ECGroup',
+        'hh': 'HHGroup',
+        'ph': 'PHGroup',
+        'pu': 'PUGroup',
+        'chh': 'CHHGroup',
+        'hq': 'HQGroup',
+        'pi': 'PIGroup',
+        'hi': 'HIGroup',
+        'chi': 'CHIGroup',
+        'hip': 'HIPGroup',
+        'lb': 'LBGroup',
+        'sslsid': 'SSLSIDGroup',
+        'sipcid': 'SIPCIDGroup',
+        'sipuid': 'SIPUIDGroup',
+        'pto': 'PTOGroup',
+        'rdprt': 'RDPRTGroup',
+        'radchu': 'RADCHUGroup',
+        'radchs': 'RADCHSGroup',
+        'radpsun': 'RADPSUNGroup',
+        'sipcidps': 'SIPCIDPSGroup',
+        'sipuidps': 'SIPUIDPSGroup',
+        'tuxedo': 'TUXEDOGroup',
+        'prox': 'PROXGroup',
+        'diametersid': 'DiametersidGroup',
+        'persistence': 'GeneralPersistenceGroup',
+        'orchestrator': 'OrchestratorGroup',
+    }
+
+    C_L2_GROUP_DB_MATCH_BY_METHOD = {
+        'rr': 'L2RRGroup',
+        'hi': 'L2HIGroup',
+        'chi': 'L2CHIGroup',
+    }
+
+    def __init__(self):
+        self.dbUtils = DatabaseUtils()
+        self.db_name = DatabaseUtils.C_PATH_SYSTEM_INTERFACE_DB + self.dbUtils.get_date_for_db_name()
+        self.groups_from_cli = self.get_groups()
+        self.now = int(time.time())
+
+    def get_groups(self):
+        cmd = '/ca/bin/backend -c "show statistics slb group"'
+        cmd = cmd.encode('utf-8') + chr(252)
+        (status, output) = commands.getstatusoutput(cmd)
+        if status != 0:
+            exit(1)
+        split_newline = output.splitlines()
+        # The first line is title: Group Name, Method, Hits, SessionCount  Staticsession
+        target_content = "\n".join(split_newline[1:])
+        return target_content
+
+    def insert_db(self):
+        self.dbUtils.prevent_db_file_corrupted(self.db_name)
+        self.insert_rs_group()
+        self.insert_l2_rs_group()
+
+    def insert_rs_group(self):
+        conn = sqlite3.connect(self.db_name)
+        db = conn.cursor()
+        groups = re.findall(r"(?P<group_name>[^\s]+)\s*?(?P<method>\S+).*?(?P<hits>[0-9\-]+)\s*?(?P<session_count>[0-9\-]+)\s*?(?P<staticsession>[0-9\-]+)", self.groups_from_cli, re.DOTALL)
+        for entry in groups:
+            if len(entry) < 5:
+                continue
+            # each entry is a tuple
+            grp_method = str(entry[1]).strip()
+            if grp_method not in self.C_GROUP_DB_MATCH_BY_METHOD:
+                continue
+            matched_table = self.C_GROUP_DB_MATCH_BY_METHOD[grp_method]
+            grp_name = str(entry[0]).strip()
+            try:
+                db.execute(" ".join(['INSERT INTO %s (' % matched_table,
+                    'pk,',
+                    'time,',
+                    'hits,',
+                    'session_count,',
+                    'staticsession',
+                    ') VALUES (',
+                    '?,',
+                    '?,',
+                    '?,',
+                    '?,',
+                    '?)']),
+                    ("{\"name\": \"%s\"}" % grp_name,
+                    self.now,
+                    self.dbUtils.num(entry[2]), # hits
+                    self.dbUtils.num(entry[3]), # session_count
+                    self.dbUtils.num(entry[4]))) # staticsession
+            except Exception as ex:
+                print("Cannot insert in rs group")
+                print(str(ex))
+        conn.commit()
+        conn.close()
+
+    def insert_l2_rs_group(self):
+        conn = sqlite3.connect(self.db_name)
+        db = conn.cursor()
+        l2groups = re.findall(r"(L2\sGroup\sName\s+Method\s+Hits\s+Drops\n)((?:[^\n]*\n)+)", self.groups_from_cli, re.DOTALL)
+        if len(l2groups) > 0 and len(l2groups[0]) > 1:
+            target_content = l2groups[0][1].splitlines()
+            for l2entry in target_content:
+                l2groups = l2entry.split()
+                if len(l2groups) < 4:
+                    continue
+                l2grp_method = str(l2groups[1]).strip()
+                if l2grp_method not in self.C_L2_GROUP_DB_MATCH_BY_METHOD:
+                    continue
+                matched_l2table = self.C_L2_GROUP_DB_MATCH_BY_METHOD[l2grp_method]
+                l2grp_name = str(l2groups[0]).strip()
+                try:
+                    db.execute(" ".join(['INSERT INTO %s (' % matched_l2table,
+                                'pk,',
+                                'time,',
+                                'hits,',
+                                'drops',
+                                ') VALUES (',
+                                '?,',
+                                '?,',
+                                '?,',
+                                '?)']),
+                                ("{\"name\": \"%s\"}" % l2grp_name,
+                                self.now,
+                                self.dbUtils.num(l2groups[2]), # hits
+                                self.dbUtils.num(l2groups[3]))) # drops
+                except Exception as ex:
+                    print("Cannot insert data into db %s" % matched_l2table)
+                    print(ex)
+        conn.commit()
+        conn.close()
Index: /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/SystemInterface.py
===================================================================
--- /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/SystemInterface.py	(revision 0)
+++ /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/SystemInterface.py	(working copy)
@@ -0,0 +1,115 @@
+import commands
+import re
+from DatabaseUtils import DatabaseUtils
+import sqlite3
+import time
+
+class SystemInterface():
+
+    C_DB_SYSTEM_INTERFACE_STATUS = "SystemInterface"
+
+    def __init__(self):
+        self.dbUtils = DatabaseUtils()
+        self.db_name = DatabaseUtils.C_PATH_SYSTEM_INTERFACE_DB + self.dbUtils.get_date_for_db_name()
+        self.now = int(time.time())
+
+    def system_data(self):
+        cmd = '/ca/bin/backend -c "show interface"'
+        cmd = cmd.encode('utf-8') + chr(252)
+        (status, output) = commands.getstatusoutput(cmd)
+        if status != 0:
+            exit(1)
+        # Initialize data storage
+        each_data = {}
+        if output:
+            # Regular expression to match each port
+            port_pattern = r"(port\d+)\(port\d+\):"
+            ports_data = re.split(port_pattern, output)
+
+            # Patterns to extract required information
+            Frames_In       = r"Input queue:\s*\d+\/\d+\s*\(size\/max\)\n\s*total:\s*\d+\s*packets,\s*good:\s*(\d+)\s*packets"
+            Frames_Out      = r"Output queue:\s*\d+\/\d+\s*\(size\/max\)\n\s*total:\s*\d+\s*packets,\s*good:\s*(\d+)\s*packets"
+            Bytes_In        = r"Input queue:\s*\d+\/\d+\s*\(size\/max\)\n\s*total:\s*\d+\s*packets,\s*good:\s*\d+\s*packets,\s*(\d+)\s*bytes"
+            Bytes_Out       = r"Output queue:\s*\d+\/\d+\s*\(size\/max\)\n\s*total:\s*\d+\s*packets,\s*good:\s*\d+\s*packets,\s*(\d+)\s*bytes"
+            Bit_Rate_In     = r"input rate (\d+) bits\/sec"
+            Packet_Rate_In  = r"input rate \d+ bits\/sec,\s*(\d+)\spackets\/sec"
+            Bit_Rate_Out    = r"output rate (\d+) bits\/sec"
+            Packet_Rate_Out = r"output rate \d+ bits\/sec,\s*(\d+)\spackets\/sec"
+
+            # Iterate through ports_data
+            for i in range(1, len(ports_data), 2):
+                port_name = ports_data[i].strip()  # e.g., 'port1'
+                port_details = ports_data[i + 1]   # Corresponding port details
+
+                # Initialize a list to store data for the current port
+                port_info = {}
+
+                # Extracting required data using regex
+                FramesIn        = re.search(Frames_In, port_details)
+                FramesOut       = re.search(Frames_Out, port_details)
+                BytesIn         = re.search(Bytes_In, port_details)
+                BytesOut        = re.search(Bytes_Out, port_details)
+                BitRateIn       = re.search(Bit_Rate_In, port_details)
+                PacketRateIn    = re.search(Packet_Rate_In, port_details)
+                BitRateOut      = re.search(Bit_Rate_Out, port_details)
+                PacketRateOut   = re.search(Packet_Rate_Out, port_details)
+
+                # Store the extracted data in the port_info dictionary
+                port_info['FramesIn']       = FramesIn.group(1) if FramesIn else None
+                port_info['FramesOut']      = FramesOut.group(1) if FramesOut else None
+                port_info['BytesIn']        = BytesIn.group(1) if BytesIn else None
+                port_info['BytesOut']       = BytesOut.group(1) if BytesOut else None
+                port_info['BitRateIn']      = BitRateIn.group(1) if BitRateIn else None
+                port_info['PacketRateIn']   = PacketRateIn.group(1) if PacketRateIn else None
+                port_info['BitRateOut']     = BitRateOut.group(1) if BitRateOut else None
+                port_info['PacketRateOut']  = PacketRateOut.group(1) if PacketRateOut else None
+
+                # Store the port info in the main data dictionary
+                each_data[port_name] = port_info
+        return each_data
+
+    def insert_db(self):
+        self.dbUtils.prevent_db_file_corrupted(self.db_name)
+        conn = sqlite3.connect(self.db_name)
+        db = conn.cursor()
+        data = self.system_data()
+        try:
+            if len(data):                              # Ensure 'data' has entries
+                for port, port_info in data.items():   # Insert the port information into the database
+                    db.execute(" ".join(['INSERT INTO %s (' % self.C_DB_SYSTEM_INTERFACE_STATUS,
+                            'pk,',
+                            'time,',
+                            'framesIn,',
+                            'framesOut,',
+                            'bytesIn,',
+                            'bytesOut,',
+                            'throughput_in_bits,',
+                            'throughput_in_packets,',
+                            'throughput_out_bits,',
+                            'throughput_out_packets',
+                            ') VALUES (',
+                            '?,',
+                            '?,',
+                            '?,',
+                            '?,',
+                            '?,',
+                            '?,',
+                            '?,',
+                            '?,',
+                            '?,',
+                            '?)']),
+                            ("{\"name\": \"%s\"}" % port,
+                            self.now,
+                            port_info.get('FramesIn', 0),
+                            port_info.get('FramesOut', 0),
+                            port_info.get('BytesIn', 0),
+                            port_info.get('BytesOut', 0),
+                            port_info.get('BitRateIn', 0),
+                            port_info.get('PacketRateIn', 0),
+                            port_info.get('BitRateOut', 0),
+                            port_info.get('PacketRateOut', 0)))
+        except Exception as ex:
+            print("Cannot insert data into db %s" % self.C_DB_SYSTEM_INTERFACE_STATUS)
+            print(ex)
+        conn.commit()
+        conn.close()
Index: /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/write_monitor_to_db.py
===================================================================
--- /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/write_monitor_to_db.py	(revision 39135)
+++ /branches/rel_apv_10_7/usr/click/webui/htdocs/new/src/hive/monitor_log/write_monitor_to_db.py	(working copy)
@@ -4,6 +4,8 @@
 import time
 from datetime import datetime
 import re
+from SLBRSGroup import SLBRSGroup
+from SystemInterface import SystemInterface
 
 C_PATH_TCP_STATUS_DB = "/var/crash/tcp_status/"
 C_PATH_TCP_SYN_DROP_DB = "/var/crash/tcp_syn_drop/"
@@ -37,53 +39,6 @@
     'fatal_alerts': 'fatal alerts'
 }
 
-C_PATH_SYSTEM_INTERFACE_DB   = "/var/crash/graphdb/"
-C_DB_SYSTEM_INTERFACE_STATUS = "SystemInterface"
-
-C_GROUP_DB_MATCH_BY_METHOD = {
-    'rr': 'RRGroup',
-    'grr': 'GRRGroup',
-    'lc': 'LCGroup',
-    'sr': 'SRGroup',
-    'snmp': 'SNMPGroup',
-    'hc': 'HCGroup',
-    'ic': 'ICGroup',
-    'rc': 'RCGroup',
-    'pc': 'PCGroup',
-    'ec': 'ECGroup',
-    'hh': 'HHGroup',
-    'ph': 'PHGroup',
-    'pu': 'PUGroup',
-    'chh': 'CHHGroup',
-    'hq': 'HQGroup',
-    'pi': 'PIGroup',
-    'hi': 'HIGroup',
-    'chi': 'CHIGroup',
-    'hip': 'HIPGroup',
-    'lb': 'LBGroup',
-    'sslsid': 'SSLSIDGroup',
-    'sipcid': 'SIPCIDGroup',
-    'sipuid': 'SIPUIDGroup',
-    'pto': 'PTOGroup',
-    'rdprt': 'RDPRTGroup',
-    'radchu': 'RADCHUGroup',
-    'radchs': 'RADCHSGroup',
-    'radpsun': 'RADPSUNGroup',
-    'sipcidps': 'SIPCIDPSGroup',
-    'sipuidps': 'SIPUIDPSGroup',
-    'tuxedo': 'TUXEDOGroup',
-    'prox': 'PROXGroup',
-    'diametersid': 'DiametersidGroup',
-    'persistence': 'GeneralPersistenceGroup',
-    'orchestrator': 'OrchestratorGroup',
-}
-
-C_L2_GROUP_DB_MATCH_BY_METHOD = {
-    'rr': 'L2RRGroup',
-    'hi': 'L2HIGroup',
-    'chi': 'L2CHIGroup',
-}
-
 def main():
     if len(sys.argv) < 1:
         exit(1)
@@ -224,122 +179,9 @@
     conn.commit()
     conn.close()
 
-def insert_db_system_interface_status():    
-    if not os.path.exists(C_PATH_TCP_STATUS_DB):
-        os.mkdir(C_PATH_TCP_STATUS_DB)
-
-    cmd = '/ca/bin/backend -c "show interface"'
-    cmd = cmd.encode('utf-8') + chr(252)
-    (status, output) = commands.getstatusoutput(cmd)
-    if status != 0:
-        exit(1)
-
-    # Initialize data storage
-    each_data = {}
-
-    if output:
-        # Regular expression to match each port
-        port_pattern = r"(port\d+)\(port\d+\):"
-        ports_data = re.split(port_pattern, output)
-
-        # Patterns to extract required information
-        Frames_In       = r"Input queue:\s*\d+\/\d+\s*\(size\/max\)\n\s*total:\s*\d+\s*packets,\s*good:\s*(\d+)\s*packets"
-        Frames_Out      = r"Output queue:\s*\d+\/\d+\s*\(size\/max\)\n\s*total:\s*\d+\s*packets,\s*good:\s*(\d+)\s*packets" 
-        Bytes_In        = r"Input queue:\s*\d+\/\d+\s*\(size\/max\)\n\s*total:\s*\d+\s*packets,\s*good:\s*\d+\s*packets,\s*(\d+)\s*bytes"
-        Bytes_Out       = r"Output queue:\s*\d+\/\d+\s*\(size\/max\)\n\s*total:\s*\d+\s*packets,\s*good:\s*\d+\s*packets,\s*(\d+)\s*bytes"
-        Bit_Rate_In     = r"input rate (\d+) bits\/sec"
-        Packet_Rate_In  = r"input rate \d+ bits\/sec,\s*(\d+)\spackets\/sec"
-        Bit_Rate_Out    = r"output rate (\d+) bits\/sec"
-        Packet_Rate_Out = r"output rate \d+ bits\/sec,\s*(\d+)\spackets\/sec"
-
-        # Iterate through ports_data
-        for i in range(1, len(ports_data), 2):
-            port_name = ports_data[i].strip()  # e.g., 'port1'
-            port_details = ports_data[i + 1]   # Corresponding port details
-
-            # Initialize a list to store data for the current port
-            port_info = {}
-
-            # Extracting required data using regex
-            FramesIn        = re.search(Frames_In, port_details)
-            FramesOut       = re.search(Frames_Out, port_details)
-            BytesIn         = re.search(Bytes_In, port_details)
-            BytesOut        = re.search(Bytes_Out, port_details)
-            BitRateIn       = re.search(Bit_Rate_In, port_details)
-            PacketRateIn    = re.search(Packet_Rate_In, port_details)
-            BitRateOut      = re.search(Bit_Rate_Out, port_details)
-            PacketRateOut   = re.search(Packet_Rate_Out, port_details)
-
-            # Store the extracted data in the port_info dictionary
-            port_info['FramesIn']       = FramesIn.group(1) if FramesIn else None
-            port_info['FramesOut']      = FramesOut.group(1) if FramesOut else None
-            port_info['BytesIn']        = BytesIn.group(1) if BytesIn else None
-            port_info['BytesOut']       = BytesOut.group(1) if BytesOut else None
-            port_info['BitRateIn']      = BitRateIn.group(1) if BitRateIn else None
-            port_info['PacketRateIn']   = PacketRateIn.group(1) if PacketRateIn else None
-            port_info['BitRateOut']     = BitRateOut.group(1) if BitRateOut else None
-            port_info['PacketRateOut']  = PacketRateOut.group(1) if PacketRateOut else None
-
-            # Store the port info in the main data dictionary
-            each_data[port_name] = port_info
-    
-    db_name = C_PATH_SYSTEM_INTERFACE_DB + get_date_for_db_name()
-    conn = sqlite3.connect(db_name)
-    db = conn.cursor()
-
-    try:
-        now = int(time.time())
-        if len(each_data):                              # Ensure 'each_data' has entries
-            for port, port_info in each_data.items():   # Insert the port information into the database
-                print("Port: {}".format(port))
-                print("  Frames In: {}".format(port_info.get('FramesIn', 'N/A')))
-                print("  Frames Out: {}".format(port_info.get('FramesOut', 'N/A')))
-                print("  Bytes In: {}".format(port_info.get('BytesIn', 'N/A')))
-                print("  Bytes Out: {}".format(port_info.get('BytesOut', 'N/A')))
-                print("  Bit Rate In: {}".format(port_info.get('BitRateIn', 'N/A')))
-                print("  Packet Rate In: {}".format(port_info.get('PacketRateIn', 'N/A')))
-                print("  Bit Rate Out: {}".format(port_info.get('BitRateOut', 'N/A')))
-                print("  Packet Rate Out: {}".format(port_info.get('PacketRateOut', 'N/A')))
-                print()
-
-                db.execute(" ".join(['INSERT INTO %s (' % C_DB_SYSTEM_INTERFACE_STATUS,
-                        'pk,',
-                        'time,', 
-                        'framesIn,', 
-                        'framesOut,', 
-                        'bytesIn,', 
-                        'bytesOut,',
-                        'throughput_in_bits,', 
-                        'throughput_in_packets,', 
-                        'throughput_out_bits,', 
-                        'throughput_out_packets',
-                        ') VALUES (',
-                        '?,',
-                        '?,',
-                        '?,',
-                        '?,',
-                        '?,',
-                        '?,',
-                        '?,',
-                        '?,',
-                        '?,',
-                        '?)']), 
-                        ("{\"name\": \"%s\"}" % port,
-                        now,
-                        port_info.get('FramesIn', 0),
-                        port_info.get('FramesOut', 0),
-                        port_info.get('BytesIn', 0),
-                        port_info.get('BytesOut', 0),
-                        port_info.get('BitRateIn', 0),
-                        port_info.get('PacketRateIn', 0),
-                        port_info.get('BitRateOut', 0),
-                        port_info.get('PacketRateOut', 0)))
-                        
-    except Exception as ex:
-        print("Cannot insert data into db %s" % C_DB_SYSTEM_INTERFACE_STATUS)
-        print(ex)
-    conn.commit()
-    conn.close()
+def insert_db_system_interface_status():
+    handler = SystemInterface()
+    handler.insert_db()
 
 def insert_db_tcp_syn_drop():
     if not os.path.exists(C_PATH_TCP_SYN_DROP_DB):
@@ -553,88 +395,8 @@
     conn.close()
 
 def insert_db_slb_rs_group():
-    cmd = '/ca/bin/backend -c "show statistics slb group"'
-    cmd = cmd.encode('utf-8') + chr(252)
-    (status, output) = commands.getstatusoutput(cmd)
-    if status != 0:
-        exit(1)
-    split_newline = output.splitlines()
-    # The first line is title: Group Name, Method, Hits, SessionCount  Staticsession
-    target_content = "\n".join(split_newline[1:])
-    groups = re.findall(r"(?P<group_name>[^\s]+)\s*?(?P<method>\S+).*?(?P<hits>[0-9\-]+)\s*?(?P<session_count>[0-9\-]+)\s*?(?P<staticsession>[0-9\-]+)", target_content, re.DOTALL)
-
-    db_name = C_PATH_SYSTEM_INTERFACE_DB + get_date_for_db_name()
-    conn = sqlite3.connect(db_name)
-    db = conn.cursor()
-    now = int(time.time())
-
-    for entry in groups:
-        if len(entry) < 5:
-            continue
-        # each entry is a tuple
-        grp_method = str(entry[1]).strip()
-        if grp_method not in C_GROUP_DB_MATCH_BY_METHOD:
-            continue
-        matched_table = C_GROUP_DB_MATCH_BY_METHOD[grp_method]
-        grp_name = str(entry[0]).strip()
-        try:
-            db.execute(" ".join(['INSERT INTO %s (' % matched_table,
-                        'pk,',
-                        'time,',
-                        'hits,',
-                        'session_count,',
-                        'staticsession',
-                        ') VALUES (',
-                        '?,',
-                        '?,',
-                        '?,',
-                        '?,',
-                        '?)']),
-                        ("{\"name\": \"%s\"}" % grp_name,
-                        now,
-                        num(entry[2]), # hits
-                        num(entry[3]), # session_count
-                        num(entry[4]))) # staticsession
-        except Exception as ex:
-            print("Cannot insert data into db %s" % matched_table)
-            print(ex)
-    conn.commit()
-    conn.close()
-
-    conn2 = sqlite3.connect(db_name)
-    db2 = conn2.cursor()
-    l2groups_part = re.findall(r"(L2\sGroup\sName\s+Method\s+Hits\s+Drops\n)((?:[^\n]*\n)+)", target_content, re.DOTALL)
-    if len(l2groups_part) > 0 and len(l2groups_part[0]) > 1:
-        target_content2 = l2groups_part[0][1].splitlines()
-        for l2entry in target_content2:
-            l2groups = l2entry.split()
-            if len(l2groups) < 4:
-                continue
-            l2grp_method = str(l2groups[1]).strip()
-            if l2grp_method not in C_L2_GROUP_DB_MATCH_BY_METHOD:
-                continue
-            matched_l2table = C_L2_GROUP_DB_MATCH_BY_METHOD[l2grp_method]
-            l2grp_name = str(l2groups[0]).strip()
-            try:
-                db2.execute(" ".join(['INSERT INTO %s (' % matched_l2table,
-                            'pk,',
-                            'time,',
-                            'hits,',
-                            'drops',
-                            ') VALUES (',
-                            '?,',
-                            '?,',
-                            '?,',
-                            '?)']),
-                            ("{\"name\": \"%s\"}" % l2grp_name,
-                            now,
-                            num(l2groups[2]), # hits
-                            num(l2groups[3]))) # drops
-            except Exception as ex:
-                print("Cannot insert data into db %s" % matched_l2table)
-                print(ex)
-    conn2.commit()
-    conn2.close()
+    handler = SLBRSGroup()
+    handler.insert_db()
 
 def insert_db_tcp_reset_id():
     # because the data is from /ca/bin/anetstat -p tcp, we use same path
