summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b3d128a)
raw | patch | inline | side by side (parent: b3d128a)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 28 May 2008 08:44:56 +0000 (08:44 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 28 May 2008 08:44:56 +0000 (08:44 +0000) |
* under construction
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11060 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11060 594d385d-05f5-0310-b6e9-bd551577e9d8
index a6f96e3bc441a3a5e96b837707fa17555cf3f299..1e7717f12a0a2b5526fdb3fd95d60c37f5cb1362 100644 (file)
"detect_hardware",
"confirm_new_key",
"ping",
+ "new_ping",
"import_events", # no implementations
);
@EXPORT = @events;
}
+
+sub new_ping {
+ my ($msg, $msg_hash) = @_ ;
+ my $header = @{$msg_hash->{'header'}}[0];
+ my $source = @{$msg_hash->{'source'}}[0];
+ my $target = @{$msg_hash->{'target'}}[0];
+ my $session_id = @{$msg_hash->{'session_id'}}[0];
+
+
+ # switch target and source and send msg back
+ my $out_hash = &main::create_xml_hash("answer_$session_id", $target, $source);
+ &add_content2xml_hash($out_hash, "session_id", $session_id);
+ my $out_msg = &main::create_xml_string($out_hash);
+ return $out_msg;
+
+}
+
1;
index 7bd0ba2709faed68e4ee3ec4ab50af4cf80f59f6..4529bcaa8620263745be8b77adfe76f3f62ff901 100755 (executable)
print $socket $crypted_msg."\n";
daemon_log("$session_id INFO: send ".$header."msg to $address", 5);
- daemon_log("DEBUG: message:\n$msg", 9);
+ daemon_log("$session_id DEBUG: message:\n$msg", 9);
}
$kernel->yield('watch_for_next_tasks');
$kernel->sig(USR1 => "sig_handler");
$kernel->sig(USR2 => "create_packages_list_db");
-}
-
-sub trigger_db_loop {
- my ($kernel) = @_ ;
$kernel->delay_set('watch_for_new_jobs', $job_queue_loop_delay);
$kernel->delay_set('watch_for_done_jobs', $job_queue_loop_delay);
$kernel->delay_set('watch_for_new_messages', $messaging_db_loop_delay);
$kernel->delay_set('watch_for_delivery_messages', $messaging_db_loop_delay);
$kernel->delay_set('watch_for_done_messages', $messaging_db_loop_delay);
$kernel->delay_set('watch_for_old_known_clients', $job_queue_loop_delay);
+
+}
+
+sub trigger_db_loop {
+ my ($kernel) = @_ ;
+# $kernel->delay_set('watch_for_new_jobs', $job_queue_loop_delay);
+# $kernel->delay_set('watch_for_done_jobs', $job_queue_loop_delay);
+# $kernel->delay_set('watch_for_new_messages', $messaging_db_loop_delay);
+# $kernel->delay_set('watch_for_delivery_messages', $messaging_db_loop_delay);
+# $kernel->delay_set('watch_for_done_messages', $messaging_db_loop_delay);
+# $kernel->delay_set('watch_for_old_known_clients', $job_queue_loop_delay);
}
sub watch_for_done_jobs {
my ($kernel,$heap) = @_[KERNEL, HEAP];
- my $sql_statement = "SELECT * FROM ".$job_queue_tn.
- " WHERE status='done'";
+ my $sql_statement = "SELECT * FROM ".$job_queue_tn." WHERE status='done'";
my $res = $job_db->select_dbentry( $sql_statement );
while( my ($id, $hit) = each %{$res} ) {
sub watch_for_next_tasks {
my ($kernel,$heap) = @_[KERNEL, HEAP];
-
+
my $sql = "SELECT * FROM $incoming_tn";
my $res = $incoming_db->select_dbentry($sql);
index 0c0a1cf4e089447640aa0ad9bcd7b8845da1792d..8f55b3368790ae2e04026774363508f62da5b4e7 100644 (file)
my $target = @{$msg_hash->{target}}[0];
$sql = "SELECT * FROM $main::known_clients_tn WHERE ((hostname='$target') || (macaddress LIKE '$target'))";
- #&main::daemon_log("$sql",1);
$res = $main::known_clients_db->exec_statement($sql);
- #&main::daemon_log(Dumper($res), 1);
my $host_name = @{@$res[0]}[0];
$out_msg =~ s/<target>\S+<\/target>/<target>$host_name<\/target>/;
$out_msg =~ s/<source>\S+<\/source>/<source>$main::server_address<\/source>/;
}
my $answer_xml = @{@$res[0]}[3];
my %data = ( 'answer_xml' => 'bin noch da' );
- my $answer_msg = &build_msg("got_ping", "$main::server_address", "GOSA", \%data);
+ my $answer_msg = &build_msg("got_new_ping", "$main::server_address", "GOSA", \%data);
$sql = "DELETE FROM $main::incoming_tn WHERE id=$message_id";
$res = $main::incoming_db->exec_statement($sql);
index 0efe9eab92a8b0cd9779c6bef175c6e4e0f4f909..7a7cd5e74946c7afbbd245e4f4396a7615d99d9d 100755 (executable)
use Getopt::Long;
use Data::Dumper;
-my $log_file = "/home/hickert/log.gosa-si-server";
-#my $log_file = "/var/log/gosa-si-server.log";
-
-my $within_session = 0;
-my $within_incoming = 0;
-my $within_header = 0;
-my $session;
-my $incoming;
-my $header;
-my $syslog_state;
-
-sub check_syslog_state {
- my ($line) = @_ ;
- if($line =~ /$syslog_state:/ ) {
- return $line;
- }
- return;
-}
-
-sub check_header {
- my ($line) = @_ ;
-
- # new header, set all values back to default
- if ($line =~ /INFO: Incoming msg with header/ ) {
- $within_header = 0;
- }
-
- if ($line =~ /INFO: Incoming msg with header '$header'/) {
- $within_header = 1;
- return $line;
- } else {
- if ($within_header) { return $line; }
- }
- return;
-}
-
-sub check_incoming {
- my ($line) = @_ ;
-
- # new incoming msg, set all values back to default
- if ($line =~ /INFO: Incoming msg with session ID \d+ from/ ) {
- $within_incoming = 0;
- }
-
- if ($line =~ /INFO: Incoming msg with session ID \d+ from '$incoming'/) {
- $within_incoming = 1;
- return $line;
- } else {
- if ($within_incoming) { return $line; }
- }
- return;
-}
-
-sub check_session {
- my ($line) = @_ ;
-
- if ($line =~ /gosa-si-server (\d+) / ) {
- if ((defined $1) && ($1 eq $session)) {
- return $line;
- }
- }
- return;
-}
-
+my $pattern;
+my $log_file = "/var/log/gosa-si-server.log";
### MAIN ######################################################################
GetOptions(
- "s|session=s" => \$session,
- "i|incoming=s" => \$incoming,
- "h|header=s" => \$header,
- "l|log=s" => \$syslog_state,
+ "p|pattern=s" => \$pattern,
);
-# check script pram
-my $script_pram = {};
-if (defined $session) {
- print "session: $session\n";
- $script_pram->{'session'} = $session;
- }
-if (defined $incoming) {
- print "incoming: $incoming\n";
- $script_pram->{'incoming'} = $incoming;
-}
-if (defined $header) {
- print "header: $header\n";
- $script_pram->{'header'} = $header;
-}
-if (defined $syslog_state) {
- print "syslog_state: $syslog_state\n";
- $script_pram->{'syslog_state'} = $syslog_state;
-}
-
-if (keys(%$script_pram) == 0) {
- # print usage and die
- print "exiting script\n";
- exit(0);
-}
-
-open(FILE, "<$log_file") or die "\t can not open log-file";
+open(FILE, "<$log_file") or die "\ncan not open log-file '$log_file'\n";
my @lines;
-my $positive_msg = 0;
+my $messages = {};
+
# Read lines
while ( my $line = <FILE>){
chomp($line);
-
+
# start of a new message, plot saved log lines
- if ($line =~ /INFO: Incoming msg with session ID \d+ from / ) {
- if ($positive_msg) {
- print "#####################################################\n";
- print join("\n", @lines)."\n";
- }
-
- $positive_msg = 0;
- $within_session = 0;
- $within_header = 0;
- $within_incoming = 0;
- @lines = ();
- }
-
- push (@lines, $line);
-
- my $positiv_counter = 0;
- while (my ($pram, $val) = each %$script_pram) {
- if ($pram eq 'session') {
- my $l = &check_session($line);
- if (defined $l) { $positiv_counter++; }
- }
-
- elsif ($pram eq 'incoming') {
- my $l = &check_incoming($line);
- if (defined $l) { $positiv_counter++; }
- }
-
- elsif ($pram eq 'header') {
- my $l = &check_header($line);
- if (defined $l) { $positiv_counter++; }
- }
-
- elsif ($pram eq 'syslog_state') {
- my $l = &check_syslog_state($line);
- if (defined $l) { $positiv_counter++; }
- }
- }
-
- if (keys(%$script_pram) == $positiv_counter) {
- $positive_msg = 1;
- }
+ if ($line =~ /$pattern/ ) {
+ print "$line\n";
+ }
}
-
-
+close FILE;