«Содержание Введение 1 Системы мониторинга 1.1 Введение 1.2 Понятие систем мониторинга 1.3 Подсистемы мониторинга 1.3.1 Сбор данных 1.3.2 Хранение данных 1.3.3 Анализ данных 1.3.4 Отчетность 1.3.5 Оповещения 1.3.6 ...»
@SuppressWarnings("unchecked") private void initComponents() { jscp = new javax.swing.JScrollPane();
graphPanel = new javax.swing.JPanel();
javax.swing.GroupLayout(graphPanel);
graphPanel.setLayout(graphPanelLayout);
graphPanelLayout.setHorizontalGroup( graphPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 390, Short.MAX_VALUE) graphPanelLayout.setVerticalGroup( graphPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 270, Short.MAX_VALUE) jscp.setViewportView(graphPanel);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jscp, javax.swing.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE) layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jscp, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE) // Variables declaration - do not modify private javax.swing.JPanel graphPanel;
private javax.swing.JScrollPane jscp;
// End of variables declaration /** * Copyright 2011 Snoopy Project * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2. * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * limitations under the License.
package com.googlecode.snoopycp.util;
import Ice.Identity;
public final class Identities { * Give you identity with random UID like 154d2630-fafd-4bcb-9cac-dec42ec4ba9c * and prefix domain * @param domain category of identity * @return identity object public static Identity randomIdentity(String domain) { return new Identity(java.util.UUID.randomUUID().toString(), domain);
* Give you full string view of identity like * dev/154d2630-fafd-4bcb-9cac-dec42ec4ba9c * @param identity object to transfer to string * @return string view of identity public static String toString(Identity identity) { return identity.category + "/" + identity.name;
public static Identity stringToIdentity(String identity) { String args[] = identity.split("/");
return new Identity(args[1], args[0]);
return new Identity(args[0], "");
* Compare two identity * @param id1 first object to compare * @param id2 second object to compare * @return true if objects are equal or false public static boolean equals(Identity id1, Identity id2) { return id1.name.equals(id2.name) && id1.category.equals(id2.category);
public static Identity xor(Identity id1, Identity id2) { // ex: 154d2630-fafd-4bcb-9cac-dec42ec4ba9c String id1Part[] = id1.name.split("-");
String id2Part[] = id2.name.split("-");
String resultPart[] = new String[5];
resultPart[0] = Long.toHexString(Long.valueOf(id1Part[0], 16) ^ Long.valueOf(id2Part[0], 16));
while (resultPart[0].length() < 8) { resultPart[0] = "0" + resultPart[0];
resultPart[1] = Long.toHexString(Long.valueOf(id1Part[1], 16) ^ Long.valueOf(id2Part[1], 16));
while (resultPart[1].length() < 4) { resultPart[1] = "0" + resultPart[1];
resultPart[2] = Long.toHexString(Long.valueOf(id1Part[2], 16) ^ Long.valueOf(id2Part[2], 16));
while (resultPart[2].length() < 4) { resultPart[2] = "0" + resultPart[2];
resultPart[3] = Long.toHexString(Long.valueOf(id1Part[3], 16) ^ Long.valueOf(id2Part[3], 16));
while (resultPart[3].length() < 4) { resultPart[3] = "0" + resultPart[3];
resultPart[4] = Long.toHexString(Long.valueOf(id1Part[4], 16) ^ Long.valueOf(id2Part[4], 16));
while (resultPart[4].length() < 12) { resultPart[4] = "0" + resultPart[4];
String result = resultPart[0] + "-" + resultPart[1] + "-" + resultPart[2] + "-" + resultPart[3] + "-" + resultPart[4];
return new Identity(result, id1.category);
log4j.rootLogger=DEBUG, CONSOLE log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOLE.layout.ConversionPattern= %c - %m%n log4j.logger.com.googlecode.snoopyd.driver.Discoverer=DEBUG log4j.logger.com.googlecode.snoopyd.driver.Aliver=DEBUG log4j.logger.com.googlecode.snoopyd.driver.Networker=WARN log4j.logger.com.googlecode.snoopyd.driver.Sessionier=DEBUG * Copyright 2011 Snoopy Project * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2. * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * limitations under the License.
Drop database If Exists snoopydb;
Create Database snoopydb Character Set utf8 Collate utf8_general_ci;
Use snoopydb;
Create table Module ( idModule Int NOT NULL AUTO_INCREMENT, name Varchar(128), Primary Key (idModule)) ENGINE = InnoDB;
Create table Result ( idResult Int NOT NULL AUTO_INCREMENT, idHost Int NOT NULL, idModule Int NOT NULL, datestamp Date, result Varchar(512), Primary Key (idResult)) ENGINE = InnoDB;
Create table Host ( idHost Int NOT NULL AUTO_INCREMENT, idOs Int NOT NULL, name Varchar(128), Primary Key (idHost)) ENGINE = InnoDB;
Create table Os ( idOs Int NOT NULL AUTO_INCREMENT, name Varchar(128), Primary Key (idOs)) ENGINE = InnoDB;
Alter table Result add Foreign Key (idModule) references Module (idModule) on delete cascade on update restrict;
Alter table Result add Foreign Key (idHost) references Host (idHost) on delete cascade on update restrict;
Alter table Host add Foreign Key (idOs) references Os (idOs) on delete restrict on update restrict;
Delimiter $$ Create Procedure storeResult(In osname Varchar(128), In hostname Varchar(128), In modulename Varchar(128), In result Varchar(512)) Begin Declare osIdCount Int;
Declare hostIdCount Int;
Declare moduleIdCount Int;
Declare osId Int;
Declare hostId Int;
Declare moduleId Int;
Select Count(*) Into osIdCount From Os Where name=osname;
If osIdCount = 0 Then Insert Into Os(name) Values(osname);
Select idOs Into osId From Os Where name=osname;
Select Count(*) Into hostIdCount From Host Where name=hostname;
If hostIdCount = 0 Then Insert Into Host(idOs, name) Values(osId, hostname);
Set hostId = LAST_INSERT_ID();
Select idHost Into hostId From Host Where name=hostname;
Select Count(*) Into moduleIdCount From Module Where name=modulename;
If moduleIdCount = 0 Then Insert Into Module(name) Values(modulename);
Set moduleId = LAST_INSERT_ID();
Select idModule Into moduleId From Module Where name=modulename;
Insert Into Result(idHost, idModule, datestamp, result) Values(hostId, moduleId, CURDATE(), result);
End;
Delimiter ;