mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 09:36:41 +00:00
add xcatprobe discovery time info when monitor
This commit is contained in:
parent
9a3f08e28e
commit
41f8c31ba1
@ -1188,11 +1188,11 @@ sub handle_dhcp_msg {
|
||||
my $nic = $2;
|
||||
|
||||
if ($3 =~ /no free leases/) {
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor);
|
||||
return 0;
|
||||
}
|
||||
my $record = "Received DHCPDISCOVER from $mac via $nic";
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor);
|
||||
push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug);
|
||||
} elsif ($log_ref->{msg} =~ /DHCPOFFER\s+on\s+(.+)\s+to\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/i) {
|
||||
my $ip = $1;
|
||||
@ -1200,7 +1200,7 @@ sub handle_dhcp_msg {
|
||||
my $nic = $3;
|
||||
my $record = "Sent DHCPOFFER on $ip back to $mac via $nic";
|
||||
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor);
|
||||
push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug);
|
||||
} elsif ($log_ref->{msg} =~ /DHCPREQUEST\s+for\s+(.+)\s+[\(\)0-9\.]*\s*from\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) {
|
||||
my $ip = $1;
|
||||
@ -1208,7 +1208,7 @@ sub handle_dhcp_msg {
|
||||
my $nic = $3;
|
||||
my $record = "Received DHCPREQUEST from $mac for $ip via $nic";
|
||||
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor);
|
||||
push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug);
|
||||
} elsif ($log_ref->{msg} =~ /DHCPACK\s+on\s+(.+)\s+to\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) {
|
||||
my $ip = $1;
|
||||
@ -1216,7 +1216,7 @@ sub handle_dhcp_msg {
|
||||
my $nic = $3;
|
||||
my $record = "Sent DHCPACK on $ip back to $mac via $nic";
|
||||
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor);
|
||||
push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug);
|
||||
$ipmacmap{$ip} = $mac;
|
||||
$node_state_ref->{$mac}{type} = "mac";
|
||||
@ -1225,11 +1225,11 @@ sub handle_dhcp_msg {
|
||||
my $mac = $1;
|
||||
my $nic = $2;
|
||||
if ($3 =~ /no dynamic leases/) {
|
||||
probe_utils->send_msg("stdout", "d", "Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor);
|
||||
return 0;
|
||||
}
|
||||
my $record = "Received BOOTREQUEST from $mac via $nic";
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor);
|
||||
push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug);
|
||||
} elsif ($log_ref->{msg} =~ /BOOTREPLY\s+for\s+(.+)\s+to\s+.+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) {
|
||||
my $ip = $1;
|
||||
@ -1237,7 +1237,7 @@ sub handle_dhcp_msg {
|
||||
my $nic = $3;
|
||||
my $record = "Sent BOOTREPLY on $ip back to $mac via $nic";
|
||||
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor);
|
||||
push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug);
|
||||
$ipmacmap{$ip} = $mac;
|
||||
$node_state_ref->{$mac}{type} = "mac";
|
||||
@ -1269,7 +1269,7 @@ sub handle_tftp_msg {
|
||||
|
||||
if (exists($node_state_ref->{$mac})) {
|
||||
my $record = "Via TFTP $ip download $file";
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor);
|
||||
push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug);
|
||||
|
||||
if ($file =~ /\/pxelinux.cfg\//i or $file =~ /\/xcat\/xnba\/nets\//i) {
|
||||
@ -1309,7 +1309,7 @@ sub handle_http_msg {
|
||||
if ($file =~ /\/install\//i) {
|
||||
return;
|
||||
}
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor);
|
||||
push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug);
|
||||
|
||||
if ($file =~ /\/pxelinux.cfg\//i or $file =~ /\/xcat\/xnba\/nets\//i) {
|
||||
@ -1349,13 +1349,13 @@ sub handle_cluster_msg {
|
||||
$node_state_ref->{$node}{id} = $mac;
|
||||
$node_state_ref->{$node}{discoverytype} = $type;
|
||||
my $record = "Start to update node information, discovery type is $type";
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor);
|
||||
set_node_state($node_state_ref, $mac, $::STATE_DISCOVER_UPDATE);
|
||||
push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug);
|
||||
} elsif ($log_ref->{msg} =~ /xcat.discovery.$discovery_type: \((.+)\) Warning: Could not find any nodes using (.+) discovery/i) {
|
||||
my $mac = $1;
|
||||
my $type = $2;
|
||||
probe_utils->send_msg("stdout", "w", "[$mac] Could not find any nodes using $type discovery") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "w", "[$mac] $log_ref->{time_record} Could not find any nodes using $type discovery") if ($monitor);
|
||||
set_node_state($node_state_ref, $mac, $::STATE_DISCOVER_FAILED);
|
||||
push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug);
|
||||
}
|
||||
@ -1381,7 +1381,7 @@ sub handle_compute_msg {
|
||||
my $mac = $ipmacmap{$ip};
|
||||
|
||||
if (exists $node_state_ref->{$mac}) {
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] ($ip) $log_ref->{msg}") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} ($ip) $log_ref->{msg}") if ($monitor);
|
||||
push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug);
|
||||
|
||||
if ($log_ref->{label} == $::LOGLABEL_DOXCAT) {
|
||||
@ -1403,7 +1403,7 @@ sub handle_compute_msg {
|
||||
}
|
||||
if ($node ne "") {
|
||||
$node_state_ref->{$node}{done} = 1;
|
||||
probe_utils->send_msg("stdout", "o", "[$mac] node $node discovery completed") if ($monitor);
|
||||
probe_utils->send_msg("stdout", "o", "[$mac] $log_ref->{time_record} node $node discovery completed") if ($monitor);
|
||||
set_node_state($node_state_ref, $mac, $::STATE_DISCOVER_COMPLETED);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user