alter some log levels and messages
This commit is contained in:
		| @@ -35,7 +35,8 @@ sub worker_body { | ||||
|           my ($status, $log); | ||||
|           try { | ||||
|               $job->started(scalar localtime); | ||||
|               info sprintf "int (%s): starting job %s at %s", $wid, $jid, $job->started; | ||||
|               info sprintf "int (%s): starting %s job(%s) at %s", | ||||
|                 $wid, $target, $jid, $job->started; | ||||
|               ($status, $log) = $self->$target($job); | ||||
|           } | ||||
|           catch { | ||||
| @@ -55,8 +56,8 @@ sub worker_body { | ||||
| sub close_job { | ||||
|   my ($self, $job, $status, $log) = @_; | ||||
|   my $now = scalar localtime; | ||||
|   info sprintf "int (%s): wrapping up job %s - status %s at %s", | ||||
|     $self->wid, $job->job, $status, $now; | ||||
|   info sprintf "int (%s): wrapping up set_%s job(%s) - status %s at %s", | ||||
|     $self->wid, $job->action, $job->job, $status, $now; | ||||
|  | ||||
|   try { | ||||
|       schema('netdisco')->resultset('Admin') | ||||
|   | ||||
| @@ -43,7 +43,7 @@ sub worker_body { | ||||
|   my $self = shift; | ||||
|   my $wid = $self->wid; | ||||
|   my $num_slots = $self->do('num_workers') | ||||
|     or return warning "mgr ($wid): this node has no workers... quitting manager"; | ||||
|     or return debug "mgr ($wid): this node has no workers... quitting manager"; | ||||
|  | ||||
|   # get some pending jobs | ||||
|   my $rs = schema('netdisco')->resultset('Admin') | ||||
| @@ -59,11 +59,11 @@ sub worker_body { | ||||
|  | ||||
|           # filter for discover_* | ||||
|           next unless is_discoverable($job->device); | ||||
|           info sprintf "mgr (%s): job %s is discoverable", $wid, $jid; | ||||
|           debug sprintf "mgr (%s): job %s is discoverable", $wid, $jid; | ||||
|  | ||||
|           # check for available local capacity | ||||
|           next unless $self->do('capacity_for', $job->action); | ||||
|           info sprintf "mgr (%s): processing node has capacity for job %s (%s)", | ||||
|           debug sprintf "mgr (%s): processing node has capacity for job %s (%s)", | ||||
|             $wid, $jid, $job->action; | ||||
|  | ||||
|           # mark job as running | ||||
|   | ||||
| @@ -35,7 +35,8 @@ sub worker_body { | ||||
|           my ($status, $log); | ||||
|           try { | ||||
|               $job->started(scalar localtime); | ||||
|               info sprintf "poll (%s): starting job %s at %s", $wid, $jid, $job->started; | ||||
|               info sprintf "poll (%s): starting %s job(%s) at %s", | ||||
|                 $wid, $target, $jid, $job->started; | ||||
|               ($status, $log) = $self->$target($job); | ||||
|           } | ||||
|           catch { | ||||
| @@ -55,8 +56,8 @@ sub worker_body { | ||||
| sub close_job { | ||||
|   my ($self, $job, $status, $log) = @_; | ||||
|   my $now = scalar localtime; | ||||
|   info sprintf "poll (%s): wrapping up job %s - status %s at %s", | ||||
|     $self->wid, $job->job, $status, $now; | ||||
|   info sprintf "poll (%s): wrapping up %s job(%s) - status %s at %s", | ||||
|     $self->wid, $job->action, $job->job, $status, $now; | ||||
|  | ||||
|   try { | ||||
|       schema('netdisco')->resultset('Admin') | ||||
|   | ||||
| @@ -46,8 +46,8 @@ sub store_device { | ||||
|   my $interfaces = $snmp->interfaces; | ||||
|   my $ip_netmask = $snmp->ip_netmask; | ||||
|  | ||||
|   # build device interfaces suitable for DBIC | ||||
|   my @interfaces; | ||||
|   # build device aliases suitable for DBIC | ||||
|   my @aliases; | ||||
|   foreach my $entry (keys %$ip_index) { | ||||
|       my $ip = NetAddr::IP::Lite->new($entry); | ||||
|       my $addr = $ip->addr; | ||||
| @@ -57,12 +57,13 @@ sub store_device { | ||||
|       next if setting('ignore_private_nets') and $ip->is_rfc1918; | ||||
|  | ||||
|       my $iid = $ip_index->{$addr}; | ||||
|       my $port = $interfaces->{$iid}; | ||||
|       my $port = $aliases->{$iid}; | ||||
|       my $subnet = $ip_netmask->{$addr} | ||||
|         ? NetAddr::IP::Lite->new($addr, $ip_netmask->{$addr})->network->cidr | ||||
|         : undef; | ||||
|  | ||||
|       push @interfaces, { | ||||
|       debug sprintf ' [%s] store_device - aliased as %s', $device->ip, $addr; | ||||
|       push @aliases, { | ||||
|           alias => $addr, | ||||
|           port => $port, | ||||
|           subnet => $subnet, | ||||
| @@ -99,7 +100,7 @@ sub store_device { | ||||
|   schema('netdisco')->txn_do(sub { | ||||
|     $device->device_ips->delete; | ||||
|     $device->update_or_insert; | ||||
|     $device->device_ips->populate(\@interfaces); | ||||
|     $device->device_ips->populate(\@aliases); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| @@ -139,6 +140,8 @@ sub store_interfaces { | ||||
|   my $dev_uptime = $snmp->uptime; | ||||
|  | ||||
|   if (scalar grep {$_ > $dev_uptime} values %$i_lastchange) { | ||||
|       info sprintf ' [%s] interfaces - device uptime has wrapped - correcting', | ||||
|         $device->ip; | ||||
|       $device->uptime( $dev_uptime + 2**32 ); | ||||
|   } | ||||
|  | ||||
| @@ -148,12 +151,21 @@ sub store_interfaces { | ||||
|       my $port = $interfaces->{$entry}; | ||||
|  | ||||
|       if (not length $port) { | ||||
|           # TODO log message | ||||
|           debug sprintf ' [%s] interfaces - ignoring %s (no port mapping)', | ||||
|             $device->ip, $port; | ||||
|           next; | ||||
|       } | ||||
|  | ||||
|       if (scalar grep {$port =~ m/$_/} @{setting('ignore_interfaces') || []}) { | ||||
|           # TODO log message | ||||
|           debug sprintf | ||||
|             ' [%s] interfaces - ignoring %s (%s) (requested in config)', | ||||
|             $device->ip, $entry, $port; | ||||
|           next; | ||||
|       } | ||||
|  | ||||
|       if (exists $i_ignore->{$entry}) { | ||||
|           debug sprintf ' [%s] interfaces - ignoring %s (%s) (%s)', | ||||
|             $device->ip, $entry, $port, $i_type->{$entry}; | ||||
|           next; | ||||
|       } | ||||
|  | ||||
| @@ -168,8 +180,10 @@ sub store_interfaces { | ||||
|               else { | ||||
|                   # uptime wrap less than 5min ago or lastchange > 5min ago | ||||
|                   # to be on safe side, assume lastchange after counter wrap | ||||
|                   debug sprintf | ||||
|                     ' [%s] interfaces - correcting LastChange for %s, assuming sysUptime wrap', | ||||
|                     $device->ip, $port; | ||||
|                   $lc += 2**32; | ||||
|                   # TODO log message | ||||
|               } | ||||
|           } | ||||
|       } | ||||
| @@ -186,6 +200,7 @@ sub store_interfaces { | ||||
|           duplex       => $i_duplex->{$entry}, | ||||
|           duplex_admin => $i_duplex_admin->{$entry}, | ||||
|           stp          => $i_stp_state->{$entry}, | ||||
|           type         => $i_type->{$entry}, | ||||
|           vlan         => $i_vlan->{$entry}, | ||||
|           pvid         => $i_pvid->{$entry}, | ||||
|           lastchange   => $lc, | ||||
| @@ -228,7 +243,8 @@ sub store_wireless { | ||||
|       my $port = $interfaces->{$entry}; | ||||
|  | ||||
|       if (not length $port) { | ||||
|           # TODO log message | ||||
|           debug sprintf ' [%s] wireless - ignoring %s (no port mapping)', | ||||
|             $device->ip, $port; | ||||
|           next; | ||||
|       } | ||||
|  | ||||
| @@ -252,7 +268,8 @@ sub store_wireless { | ||||
|       my $port = $interfaces->{$entry}; | ||||
|  | ||||
|       if (not length $port) { | ||||
|           # TODO log message | ||||
|           debug sprintf ' [%s] wireless - ignoring %s (no port mapping)', | ||||
|             $device->ip, $port; | ||||
|           next; | ||||
|       } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user