rename *-daemon apps to be *-backend
Squashed commit of the following: commit39b438aa4bAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sat May 6 16:40:11 2017 +0100 add release notes commitca4ea90d35Author: Oliver Gorwits <oliver@cpan.org> Date: Sat May 6 16:32:06 2017 +0100 update distmeta commit4e35b904b0Author: Oliver Gorwits <oliver@cpan.org> Date: Sat May 6 16:30:22 2017 +0100 rename files from Daemon to Backend commit86a605ba68Author: Oliver Gorwits <oliver@cpan.org> Date: Sat May 6 16:26:43 2017 +0100 rename daemon to backend in code commitffe8fc180fAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sat May 6 16:15:57 2017 +0100 add daemon files which exec to backend equivalents commit53e041594eAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sat May 6 15:32:49 2017 +0100 rename netdisco-daemon to netdisco-backend
This commit is contained in:
2
Build.PL
2
Build.PL
@@ -89,6 +89,8 @@ Module::Build->new(
|
|||||||
'bin/netdisco-db-deploy',
|
'bin/netdisco-db-deploy',
|
||||||
'bin/netdisco-deploy',
|
'bin/netdisco-deploy',
|
||||||
'bin/netdisco-do',
|
'bin/netdisco-do',
|
||||||
|
'bin/netdisco-backend-fg',
|
||||||
|
'bin/netdisco-backend',
|
||||||
'bin/netdisco-daemon-fg',
|
'bin/netdisco-daemon-fg',
|
||||||
'bin/netdisco-daemon',
|
'bin/netdisco-daemon',
|
||||||
'bin/netdisco-web-fg',
|
'bin/netdisco-web-fg',
|
||||||
|
|||||||
49
MANIFEST
49
MANIFEST
@@ -1,10 +1,13 @@
|
|||||||
bin/nd-dbic-versions
|
bin/nd-dbic-versions
|
||||||
bin/nd-import-topology
|
bin/nd-import-topology
|
||||||
|
bin/netdisco-backend
|
||||||
|
bin/netdisco-backend-fg
|
||||||
bin/netdisco-daemon
|
bin/netdisco-daemon
|
||||||
bin/netdisco-daemon-fg
|
bin/netdisco-daemon-fg
|
||||||
bin/netdisco-db-deploy
|
bin/netdisco-db-deploy
|
||||||
bin/netdisco-deploy
|
bin/netdisco-deploy
|
||||||
bin/netdisco-do
|
bin/netdisco-do
|
||||||
|
bin/netdisco-do-e
|
||||||
bin/netdisco-rancid-export
|
bin/netdisco-rancid-export
|
||||||
bin/netdisco-sshcollector
|
bin/netdisco-sshcollector
|
||||||
bin/netdisco-web
|
bin/netdisco-web
|
||||||
@@ -13,25 +16,39 @@ Build.PL
|
|||||||
Changes
|
Changes
|
||||||
lib/App/Netdisco.pm
|
lib/App/Netdisco.pm
|
||||||
lib/App/Netdisco/AnyEvent/Nbtstat.pm
|
lib/App/Netdisco/AnyEvent/Nbtstat.pm
|
||||||
|
lib/App/Netdisco/Backend/Job.pm
|
||||||
|
lib/App/Netdisco/Backend/Job.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Util.pm
|
||||||
|
lib/App/Netdisco/Backend/Util.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Common.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Common.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Interactive/DeviceActions.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Interactive/DeviceActions.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Interactive/PortActions.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Interactive/PortActions.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Manager.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Manager.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Arpnip.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Arpnip.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Common.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Common.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Device.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Device.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Expiry.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Expiry.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Macsuck.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Macsuck.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Nbtstat.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Poller/Nbtstat.pm-e
|
||||||
|
lib/App/Netdisco/Backend/Worker/Scheduler.pm
|
||||||
|
lib/App/Netdisco/Backend/Worker/Scheduler.pm-e
|
||||||
lib/App/Netdisco/Configuration.pm
|
lib/App/Netdisco/Configuration.pm
|
||||||
lib/App/Netdisco/Core/Arpnip.pm
|
lib/App/Netdisco/Core/Arpnip.pm
|
||||||
lib/App/Netdisco/Core/Discover.pm
|
lib/App/Netdisco/Core/Discover.pm
|
||||||
lib/App/Netdisco/Core/Macsuck.pm
|
lib/App/Netdisco/Core/Macsuck.pm
|
||||||
lib/App/Netdisco/Core/Nbtstat.pm
|
lib/App/Netdisco/Core/Nbtstat.pm
|
||||||
lib/App/Netdisco/Daemon/Job.pm
|
|
||||||
lib/App/Netdisco/Daemon/Util.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Common.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Interactive/DeviceActions.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Interactive/PortActions.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Manager.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Poller.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Poller/Arpnip.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Poller/Common.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Poller/Device.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Poller/Expiry.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Poller/Macsuck.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Poller/Nbtstat.pm
|
|
||||||
lib/App/Netdisco/Daemon/Worker/Scheduler.pm
|
|
||||||
lib/App/Netdisco/DB.pm
|
lib/App/Netdisco/DB.pm
|
||||||
lib/App/Netdisco/DB/ExplicitLocking.pm
|
lib/App/Netdisco/DB/ExplicitLocking.pm
|
||||||
lib/App/Netdisco/DB/Result/Admin.pm
|
lib/App/Netdisco/DB/Result/Admin.pm
|
||||||
@@ -102,6 +119,7 @@ lib/App/Netdisco/GenericDB.pm
|
|||||||
lib/App/Netdisco/GenericDB/Result/Virtual/GenericReport.pm
|
lib/App/Netdisco/GenericDB/Result/Virtual/GenericReport.pm
|
||||||
lib/App/Netdisco/JobQueue.pm
|
lib/App/Netdisco/JobQueue.pm
|
||||||
lib/App/Netdisco/JobQueue/PostgreSQL.pm
|
lib/App/Netdisco/JobQueue/PostgreSQL.pm
|
||||||
|
lib/App/Netdisco/JobQueue/PostgreSQL.pm-e
|
||||||
lib/App/Netdisco/Manual/BSDInstall.pod
|
lib/App/Netdisco/Manual/BSDInstall.pod
|
||||||
lib/App/Netdisco/Manual/Configuration.pod
|
lib/App/Netdisco/Manual/Configuration.pod
|
||||||
lib/App/Netdisco/Manual/Deployment.pod
|
lib/App/Netdisco/Manual/Deployment.pod
|
||||||
@@ -122,7 +140,7 @@ lib/App/Netdisco/SSHCollector/Platform/IOSXR.pm
|
|||||||
lib/App/Netdisco/SSHCollector/Platform/Linux.pm
|
lib/App/Netdisco/SSHCollector/Platform/Linux.pm
|
||||||
lib/App/Netdisco/SSHCollector/Platform/NXOS.pm
|
lib/App/Netdisco/SSHCollector/Platform/NXOS.pm
|
||||||
lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm
|
lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm
|
||||||
lib/App/Netdisco/Util/Daemon.pm
|
lib/App/Netdisco/Util/Backend.pm
|
||||||
lib/App/Netdisco/Util/Device.pm
|
lib/App/Netdisco/Util/Device.pm
|
||||||
lib/App/Netdisco/Util/DNS.pm
|
lib/App/Netdisco/Util/DNS.pm
|
||||||
lib/App/Netdisco/Util/ExpandParams.pm
|
lib/App/Netdisco/Util/ExpandParams.pm
|
||||||
@@ -420,6 +438,7 @@ share/views/sidebar/report/subnets.tt
|
|||||||
share/views/sidebar/search/device.tt
|
share/views/sidebar/search/device.tt
|
||||||
share/views/sidebar/search/node.tt
|
share/views/sidebar/search/node.tt
|
||||||
share/views/sidebar/search/port.tt
|
share/views/sidebar/search/port.tt
|
||||||
|
t/20-checkacl.t
|
||||||
xt/10-sort_port.t
|
xt/10-sort_port.t
|
||||||
xt/11-portsort.t
|
xt/11-portsort.t
|
||||||
xt/20-checkacl.t
|
xt/20-checkacl.t
|
||||||
|
|||||||
90
META.json
90
META.json
@@ -104,6 +104,48 @@
|
|||||||
"App::Netdisco::AnyEvent::Nbtstat" : {
|
"App::Netdisco::AnyEvent::Nbtstat" : {
|
||||||
"file" : "lib/App/Netdisco/AnyEvent/Nbtstat.pm"
|
"file" : "lib/App/Netdisco/AnyEvent/Nbtstat.pm"
|
||||||
},
|
},
|
||||||
|
"App::Netdisco::Backend::Job" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Job.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Util" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Util.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Common" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Common.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Interactive::DeviceActions" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Interactive/DeviceActions.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Interactive::PortActions" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Interactive/PortActions.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Manager" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Manager.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Poller" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Poller.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Poller::Arpnip" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Poller/Arpnip.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Poller::Common" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Poller/Common.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Poller::Device" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Poller/Device.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Poller::Expiry" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Poller/Expiry.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Poller::Macsuck" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Poller/Macsuck.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Poller::Nbtstat" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Poller/Nbtstat.pm"
|
||||||
|
},
|
||||||
|
"App::Netdisco::Backend::Worker::Scheduler" : {
|
||||||
|
"file" : "lib/App/Netdisco/Backend/Worker/Scheduler.pm"
|
||||||
|
},
|
||||||
"App::Netdisco::Configuration" : {
|
"App::Netdisco::Configuration" : {
|
||||||
"file" : "lib/App/Netdisco/Configuration.pm"
|
"file" : "lib/App/Netdisco/Configuration.pm"
|
||||||
},
|
},
|
||||||
@@ -315,48 +357,6 @@
|
|||||||
"App::Netdisco::DB::ResultSet::Subnet" : {
|
"App::Netdisco::DB::ResultSet::Subnet" : {
|
||||||
"file" : "lib/App/Netdisco/DB/ResultSet/Subnet.pm"
|
"file" : "lib/App/Netdisco/DB/ResultSet/Subnet.pm"
|
||||||
},
|
},
|
||||||
"App::Netdisco::Daemon::Job" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Job.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Util" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Util.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Common" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Common.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Interactive::DeviceActions" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Interactive/DeviceActions.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Interactive::PortActions" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Interactive/PortActions.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Manager" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Manager.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Poller" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Poller.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Poller::Arpnip" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Poller/Arpnip.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Poller::Common" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Poller/Common.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Poller::Device" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Poller/Device.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Poller::Expiry" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Poller/Expiry.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Poller::Macsuck" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Poller/Macsuck.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Poller::Nbtstat" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Poller/Nbtstat.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Daemon::Worker::Scheduler" : {
|
|
||||||
"file" : "lib/App/Netdisco/Daemon/Worker/Scheduler.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Environment" : {
|
"App::Netdisco::Environment" : {
|
||||||
"file" : "lib/App/Netdisco/Environment.pm"
|
"file" : "lib/App/Netdisco/Environment.pm"
|
||||||
},
|
},
|
||||||
@@ -405,12 +405,12 @@
|
|||||||
"App::Netdisco::SSHCollector::Platform::PaloAlto" : {
|
"App::Netdisco::SSHCollector::Platform::PaloAlto" : {
|
||||||
"file" : "lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm"
|
"file" : "lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm"
|
||||||
},
|
},
|
||||||
|
"App::Netdisco::Util::Backend" : {
|
||||||
|
"file" : "lib/App/Netdisco/Util/Backend.pm"
|
||||||
|
},
|
||||||
"App::Netdisco::Util::DNS" : {
|
"App::Netdisco::Util::DNS" : {
|
||||||
"file" : "lib/App/Netdisco/Util/DNS.pm"
|
"file" : "lib/App/Netdisco/Util/DNS.pm"
|
||||||
},
|
},
|
||||||
"App::Netdisco::Util::Daemon" : {
|
|
||||||
"file" : "lib/App/Netdisco/Util/Daemon.pm"
|
|
||||||
},
|
|
||||||
"App::Netdisco::Util::Device" : {
|
"App::Netdisco::Util::Device" : {
|
||||||
"file" : "lib/App/Netdisco/Util/Device.pm"
|
"file" : "lib/App/Netdisco/Util/Device.pm"
|
||||||
},
|
},
|
||||||
|
|||||||
60
META.yml
60
META.yml
@@ -21,6 +21,34 @@ provides:
|
|||||||
version: '2.035006'
|
version: '2.035006'
|
||||||
App::Netdisco::AnyEvent::Nbtstat:
|
App::Netdisco::AnyEvent::Nbtstat:
|
||||||
file: lib/App/Netdisco/AnyEvent/Nbtstat.pm
|
file: lib/App/Netdisco/AnyEvent/Nbtstat.pm
|
||||||
|
App::Netdisco::Backend::Job:
|
||||||
|
file: lib/App/Netdisco/Backend/Job.pm
|
||||||
|
App::Netdisco::Backend::Util:
|
||||||
|
file: lib/App/Netdisco/Backend/Util.pm
|
||||||
|
App::Netdisco::Backend::Worker::Common:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Common.pm
|
||||||
|
App::Netdisco::Backend::Worker::Interactive::DeviceActions:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Interactive/DeviceActions.pm
|
||||||
|
App::Netdisco::Backend::Worker::Interactive::PortActions:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Interactive/PortActions.pm
|
||||||
|
App::Netdisco::Backend::Worker::Manager:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Manager.pm
|
||||||
|
App::Netdisco::Backend::Worker::Poller:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Poller.pm
|
||||||
|
App::Netdisco::Backend::Worker::Poller::Arpnip:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Poller/Arpnip.pm
|
||||||
|
App::Netdisco::Backend::Worker::Poller::Common:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Poller/Common.pm
|
||||||
|
App::Netdisco::Backend::Worker::Poller::Device:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Poller/Device.pm
|
||||||
|
App::Netdisco::Backend::Worker::Poller::Expiry:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Poller/Expiry.pm
|
||||||
|
App::Netdisco::Backend::Worker::Poller::Macsuck:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Poller/Macsuck.pm
|
||||||
|
App::Netdisco::Backend::Worker::Poller::Nbtstat:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Poller/Nbtstat.pm
|
||||||
|
App::Netdisco::Backend::Worker::Scheduler:
|
||||||
|
file: lib/App/Netdisco/Backend/Worker/Scheduler.pm
|
||||||
App::Netdisco::Configuration:
|
App::Netdisco::Configuration:
|
||||||
file: lib/App/Netdisco/Configuration.pm
|
file: lib/App/Netdisco/Configuration.pm
|
||||||
App::Netdisco::Core::Arpnip:
|
App::Netdisco::Core::Arpnip:
|
||||||
@@ -162,34 +190,6 @@ provides:
|
|||||||
file: lib/App/Netdisco/DB/ResultSet/NodeWireless.pm
|
file: lib/App/Netdisco/DB/ResultSet/NodeWireless.pm
|
||||||
App::Netdisco::DB::ResultSet::Subnet:
|
App::Netdisco::DB::ResultSet::Subnet:
|
||||||
file: lib/App/Netdisco/DB/ResultSet/Subnet.pm
|
file: lib/App/Netdisco/DB/ResultSet/Subnet.pm
|
||||||
App::Netdisco::Daemon::Job:
|
|
||||||
file: lib/App/Netdisco/Daemon/Job.pm
|
|
||||||
App::Netdisco::Daemon::Util:
|
|
||||||
file: lib/App/Netdisco/Daemon/Util.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Common:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Common.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Interactive::DeviceActions:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Interactive/DeviceActions.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Interactive::PortActions:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Interactive/PortActions.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Manager:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Manager.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Poller:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Poller.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Poller::Arpnip:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Poller/Arpnip.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Poller::Common:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Poller/Common.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Poller::Device:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Poller/Device.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Poller::Expiry:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Poller/Expiry.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Poller::Macsuck:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Poller/Macsuck.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Poller::Nbtstat:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Poller/Nbtstat.pm
|
|
||||||
App::Netdisco::Daemon::Worker::Scheduler:
|
|
||||||
file: lib/App/Netdisco/Daemon/Worker/Scheduler.pm
|
|
||||||
App::Netdisco::Environment:
|
App::Netdisco::Environment:
|
||||||
file: lib/App/Netdisco/Environment.pm
|
file: lib/App/Netdisco/Environment.pm
|
||||||
App::Netdisco::GenericDB:
|
App::Netdisco::GenericDB:
|
||||||
@@ -222,10 +222,10 @@ provides:
|
|||||||
file: lib/App/Netdisco/SSHCollector/Platform/NXOS.pm
|
file: lib/App/Netdisco/SSHCollector/Platform/NXOS.pm
|
||||||
App::Netdisco::SSHCollector::Platform::PaloAlto:
|
App::Netdisco::SSHCollector::Platform::PaloAlto:
|
||||||
file: lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm
|
file: lib/App/Netdisco/SSHCollector/Platform/PaloAlto.pm
|
||||||
|
App::Netdisco::Util::Backend:
|
||||||
|
file: lib/App/Netdisco/Util/Backend.pm
|
||||||
App::Netdisco::Util::DNS:
|
App::Netdisco::Util::DNS:
|
||||||
file: lib/App/Netdisco/Util/DNS.pm
|
file: lib/App/Netdisco/Util/DNS.pm
|
||||||
App::Netdisco::Util::Daemon:
|
|
||||||
file: lib/App/Netdisco/Util/Daemon.pm
|
|
||||||
App::Netdisco::Util::Device:
|
App::Netdisco::Util::Device:
|
||||||
file: lib/App/Netdisco/Util/Device.pm
|
file: lib/App/Netdisco/Util/Device.pm
|
||||||
App::Netdisco::Util::ExpandParams:
|
App::Netdisco::Util::ExpandParams:
|
||||||
|
|||||||
186
bin/netdisco-backend
Executable file
186
bin/netdisco-backend
Executable file
@@ -0,0 +1,186 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
our $home;
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
use FindBin;
|
||||||
|
FindBin::again();
|
||||||
|
|
||||||
|
my $me = File::Spec->catfile($FindBin::RealBin, $FindBin::RealScript);
|
||||||
|
my $uid = (stat($me))[4] || 0;
|
||||||
|
|
||||||
|
$home = ($ENV{NETDISCO_HOME} || (getpwuid($uid))[7] || $ENV{HOME});
|
||||||
|
|
||||||
|
# try to find a localenv if one isn't already in place.
|
||||||
|
if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
|
||||||
|
use File::Spec;
|
||||||
|
my $localenv = File::Spec->catfile($FindBin::Bin, 'localenv');
|
||||||
|
exec($localenv, $0, @ARGV) if -f $localenv;
|
||||||
|
$localenv = File::Spec->catfile($home, 'perl5', 'bin', 'localenv');
|
||||||
|
exec($localenv, $0, @ARGV) if -f $localenv;
|
||||||
|
|
||||||
|
die "Sorry, can't find libs required for App::Netdisco.\n"
|
||||||
|
if !exists $ENV{PERLBREW_PERL};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
use Path::Class;
|
||||||
|
|
||||||
|
# stuff useful locations into @INC and $PATH
|
||||||
|
unshift @INC,
|
||||||
|
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
|
||||||
|
dir($FindBin::RealBin, 'lib')->stringify;
|
||||||
|
|
||||||
|
use Config;
|
||||||
|
$ENV{PATH} = $FindBin::RealBin . $Config{path_sep} . $ENV{PATH};
|
||||||
|
}
|
||||||
|
|
||||||
|
use Daemon::Control;
|
||||||
|
use Filesys::Notify::Simple;
|
||||||
|
use File::Copy;
|
||||||
|
|
||||||
|
use App::Netdisco::Environment;
|
||||||
|
my $config = ($ENV{PLACK_ENV} || $ENV{DANCER_ENVIRONMENT}) .'.yml';
|
||||||
|
|
||||||
|
my $netdisco = file($FindBin::RealBin, 'netdisco-backend-fg');
|
||||||
|
my @args = (scalar @ARGV > 1 ? @ARGV[1 .. $#ARGV] : ());
|
||||||
|
|
||||||
|
my $log_dir = dir($home, 'logs');
|
||||||
|
mkdir $log_dir if ! -d $log_dir;
|
||||||
|
my $log_file = file($log_dir, 'netdisco-backend.log');
|
||||||
|
|
||||||
|
my $uid = (stat($netdisco->stringify))[4] || 0;
|
||||||
|
my $gid = (stat($netdisco->stringify))[5] || 0;
|
||||||
|
|
||||||
|
Daemon::Control->new({
|
||||||
|
name => 'Netdisco Backend',
|
||||||
|
program => \&restarter,
|
||||||
|
program_args => [@args],
|
||||||
|
pid_file => file($home, 'netdisco-backend.pid'),
|
||||||
|
stderr_file => $log_file,
|
||||||
|
stdout_file => $log_file,
|
||||||
|
redirect_before_fork => 0,
|
||||||
|
uid => $uid, gid => $gid,
|
||||||
|
})->run;
|
||||||
|
|
||||||
|
# the guts of this are borrowed from Plack::Loader::Restarter - many thanks!!
|
||||||
|
my $child = 0;
|
||||||
|
|
||||||
|
sub restarter {
|
||||||
|
my ($daemon, @program_args) = @_;
|
||||||
|
$0 = 'netdisco-backend';
|
||||||
|
|
||||||
|
$child = fork_and_start($daemon, @program_args);
|
||||||
|
exit(1) unless $child;
|
||||||
|
|
||||||
|
my $watcher = Filesys::Notify::Simple->new([$ENV{DANCER_ENVDIR}, $log_dir]);
|
||||||
|
warn "config watcher: watching $ENV{DANCER_ENVDIR} for updates.\n";
|
||||||
|
|
||||||
|
local $SIG{TERM} = sub { $child = signal_child('TERM', $child); exit(0); };
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
my @restart;
|
||||||
|
|
||||||
|
# this is blocking
|
||||||
|
$watcher->wait(sub {
|
||||||
|
my @events = @_;
|
||||||
|
@events = grep {$_->{path} eq $log_file or
|
||||||
|
file($_->{path})->basename eq $config} @events;
|
||||||
|
return unless @events;
|
||||||
|
@restart = @events;
|
||||||
|
});
|
||||||
|
|
||||||
|
my ($hupit, $rotate) = (0, 0);
|
||||||
|
next unless @restart;
|
||||||
|
|
||||||
|
foreach my $f (@restart) {
|
||||||
|
if ($f->{path} eq $log_file) {
|
||||||
|
++$rotate;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
warn "-- $f->{path} updated.\n";
|
||||||
|
++$hupit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rotate_logs($child, $daemon, @program_args) if $rotate;
|
||||||
|
if ($hupit) {
|
||||||
|
signal_child('TERM', $child);
|
||||||
|
$child = fork_and_start($daemon, @program_args);
|
||||||
|
exit(1) unless $child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub fork_and_start {
|
||||||
|
my ($daemon, @daemon_args) = @_;
|
||||||
|
my $pid = fork;
|
||||||
|
die "Can't fork: $!" unless defined $pid;
|
||||||
|
|
||||||
|
if ($pid == 0) { # child
|
||||||
|
$daemon->redirect_filehandles;
|
||||||
|
exec( $netdisco->stringify, @daemon_args );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $pid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub signal_child {
|
||||||
|
my ($signal, $pid) = @_;
|
||||||
|
return unless $signal and $pid;
|
||||||
|
warn "config watcher: sending $signal to the server (pid:$pid)...\n";
|
||||||
|
kill $signal => $pid;
|
||||||
|
waitpid($pid, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub rotate_logs {
|
||||||
|
my $child = shift;
|
||||||
|
|
||||||
|
return unless (-f $log_file) and
|
||||||
|
((-s $log_file) > (10 * 1024768));
|
||||||
|
|
||||||
|
my @files = glob file($log_dir, '*');
|
||||||
|
foreach my $f (reverse sort @files) {
|
||||||
|
next unless $f =~ m/$log_file\.(\d)$/;
|
||||||
|
my $pos = $1;
|
||||||
|
unlink $f if $pos == 7;
|
||||||
|
my $next = $pos + 1;
|
||||||
|
(my $newf = $f) =~ s/\.$pos$/.$next/;
|
||||||
|
rename $f, $newf;
|
||||||
|
}
|
||||||
|
|
||||||
|
# if the log file's about 10M then the race condition in copy/truncate
|
||||||
|
# has a low risk of data loss. if the file's larger, then we rename and
|
||||||
|
# kill.
|
||||||
|
if ((-s $log_file) > (12 * 1024768)) {
|
||||||
|
rename $log_file, $log_file .'.1';
|
||||||
|
signal_child('TERM', $child);
|
||||||
|
$child = fork_and_start(@_);
|
||||||
|
exit(1) unless $child;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
copy $log_file, $log_file .'.1';
|
||||||
|
truncate $log_file, 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
netdisco-backend - Job Control Daemon for Netdisco
|
||||||
|
|
||||||
|
=head1 SEE ALSO
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item *
|
||||||
|
|
||||||
|
L<App::Netdisco>
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
109
bin/netdisco-backend-fg
Executable file
109
bin/netdisco-backend-fg
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use FindBin;
|
||||||
|
FindBin::again();
|
||||||
|
use Path::Class 'dir';
|
||||||
|
|
||||||
|
# get a segfault if we load this later
|
||||||
|
use if $^O eq 'linux', 'Sys::Proctitle';
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
# stuff useful locations into @INC
|
||||||
|
unshift @INC,
|
||||||
|
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
|
||||||
|
dir($FindBin::RealBin, 'lib')->stringify;
|
||||||
|
|
||||||
|
unshift @INC,
|
||||||
|
split m/:/, ($ENV{NETDISCO_INC} || '');
|
||||||
|
}
|
||||||
|
|
||||||
|
use App::Netdisco;
|
||||||
|
use Dancer qw/:moose :script/;
|
||||||
|
warning sprintf "App::Netdisco %s backend", ($App::Netdisco::VERSION || 'HEAD');
|
||||||
|
|
||||||
|
use App::Netdisco::Util::Backend;
|
||||||
|
use NetAddr::IP::Lite ':lower'; # to quench AF_INET6 symbol errors
|
||||||
|
use Role::Tiny::With;
|
||||||
|
|
||||||
|
# preload all worker modules into shared memory
|
||||||
|
use App::Netdisco::Backend::Job ();
|
||||||
|
use App::Netdisco::Backend::Util ();
|
||||||
|
use App::Netdisco::Backend::Worker::Common ();
|
||||||
|
use App::Netdisco::Backend::Worker::Interactive::DeviceActions ();
|
||||||
|
use App::Netdisco::Backend::Worker::Interactive::PortActions ();
|
||||||
|
use App::Netdisco::Backend::Worker::Manager ();
|
||||||
|
use App::Netdisco::Backend::Worker::Poller::Arpnip ();
|
||||||
|
use App::Netdisco::Backend::Worker::Poller::Common ();
|
||||||
|
use App::Netdisco::Backend::Worker::Poller::Device ();
|
||||||
|
use App::Netdisco::Backend::Worker::Poller::Expiry ();
|
||||||
|
use App::Netdisco::Backend::Worker::Poller::Macsuck ();
|
||||||
|
use App::Netdisco::Backend::Worker::Poller::Nbtstat ();
|
||||||
|
use App::Netdisco::Backend::Worker::Poller ();
|
||||||
|
use App::Netdisco::Backend::Worker::Scheduler ();
|
||||||
|
|
||||||
|
use MCE::Signal '-setpgrp';
|
||||||
|
use MCE::Flow Sereal => 1;
|
||||||
|
use MCE::Queue;
|
||||||
|
|
||||||
|
# set temporary MCE files' location in home directory
|
||||||
|
my $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
|
||||||
|
my $tmp_dir = ($ENV{NETDISCO_TEMP} || dir($home, 'tmp'));
|
||||||
|
mkdir $tmp_dir if ! -d $tmp_dir;
|
||||||
|
|
||||||
|
# process-table text
|
||||||
|
prctl 'netdisco-backend: master';
|
||||||
|
|
||||||
|
# shared local job queue
|
||||||
|
my $queue = MCE::Queue->new;
|
||||||
|
|
||||||
|
# support a scheduler-only node
|
||||||
|
setting('workers')->{'no_manager'} = 1
|
||||||
|
if setting('workers')->{tasks} eq '0';
|
||||||
|
|
||||||
|
# MCE::Util has a limit of ncpu if AUTO is used in max_workers,
|
||||||
|
# so we parse the field ourselves.
|
||||||
|
my $max_workers = parse_max_workers( setting('workers')->{tasks} ) || 0;
|
||||||
|
|
||||||
|
mce_flow {
|
||||||
|
task_name => [qw/ scheduler manager poller /],
|
||||||
|
max_workers => [ 1, 1, $max_workers ],
|
||||||
|
tmp_dir => $tmp_dir,
|
||||||
|
on_post_exit => sub { MCE->restart_worker },
|
||||||
|
}, _mk_wkr('Scheduler'), _mk_wkr('Manager'), _mk_wkr('Poller');
|
||||||
|
|
||||||
|
sub _mk_wkr {
|
||||||
|
my $role = shift;
|
||||||
|
return sub {
|
||||||
|
my $self = shift;
|
||||||
|
$self->{queue} = $queue;
|
||||||
|
|
||||||
|
prctl sprintf 'netdisco-backend: worker #%s %s: init', MCE->wid, lc($role);
|
||||||
|
info sprintf 'applying role %s to worker %s', $role, MCE->wid;
|
||||||
|
|
||||||
|
# post-fork, become manager, scheduler, poller, etc
|
||||||
|
Role::Tiny->apply_roles_to_object(
|
||||||
|
$self => "App::Netdisco::Backend::Worker::$role");
|
||||||
|
|
||||||
|
$self->worker_begin if $self->can('worker_begin');
|
||||||
|
$self->worker_body;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
netdisco-backend-fg - Job Control for Netdisco
|
||||||
|
|
||||||
|
=head1 SEE ALSO
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item *
|
||||||
|
|
||||||
|
L<App::Netdisco>
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
@@ -3,184 +3,17 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
our $home;
|
use File::Spec;
|
||||||
|
use Cwd 'realpath';
|
||||||
|
|
||||||
BEGIN {
|
use FindBin;
|
||||||
use FindBin;
|
FindBin::again();
|
||||||
FindBin::again();
|
|
||||||
|
|
||||||
my $me = File::Spec->catfile($FindBin::RealBin, $FindBin::RealScript);
|
my $backend =
|
||||||
my $uid = (stat($me))[4] || 0;
|
File::Spec->catfile(
|
||||||
|
(File::Spec->splitpath(
|
||||||
|
realpath(File::Spec->catfile( $FindBin::RealBin, $FindBin::RealScript ))
|
||||||
|
))[1],
|
||||||
|
'netdisco-backend');
|
||||||
|
|
||||||
$home = ($ENV{NETDISCO_HOME} || (getpwuid($uid))[7] || $ENV{HOME});
|
exec {$backend} 'netdisco-backend', @ARGV;
|
||||||
|
|
||||||
# try to find a localenv if one isn't already in place.
|
|
||||||
if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
|
|
||||||
use File::Spec;
|
|
||||||
my $localenv = File::Spec->catfile($FindBin::Bin, 'localenv');
|
|
||||||
exec($localenv, $0, @ARGV) if -f $localenv;
|
|
||||||
$localenv = File::Spec->catfile($home, 'perl5', 'bin', 'localenv');
|
|
||||||
exec($localenv, $0, @ARGV) if -f $localenv;
|
|
||||||
|
|
||||||
die "Sorry, can't find libs required for App::Netdisco.\n"
|
|
||||||
if !exists $ENV{PERLBREW_PERL};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BEGIN {
|
|
||||||
use Path::Class;
|
|
||||||
|
|
||||||
# stuff useful locations into @INC and $PATH
|
|
||||||
unshift @INC,
|
|
||||||
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
|
|
||||||
dir($FindBin::RealBin, 'lib')->stringify;
|
|
||||||
|
|
||||||
use Config;
|
|
||||||
$ENV{PATH} = $FindBin::RealBin . $Config{path_sep} . $ENV{PATH};
|
|
||||||
}
|
|
||||||
|
|
||||||
use Daemon::Control;
|
|
||||||
use Filesys::Notify::Simple;
|
|
||||||
use File::Copy;
|
|
||||||
|
|
||||||
use App::Netdisco::Environment;
|
|
||||||
my $config = ($ENV{PLACK_ENV} || $ENV{DANCER_ENVIRONMENT}) .'.yml';
|
|
||||||
|
|
||||||
my $netdisco = file($FindBin::RealBin, 'netdisco-daemon-fg');
|
|
||||||
my @args = (scalar @ARGV > 1 ? @ARGV[1 .. $#ARGV] : ());
|
|
||||||
|
|
||||||
my $log_dir = dir($home, 'logs');
|
|
||||||
mkdir $log_dir if ! -d $log_dir;
|
|
||||||
my $log_file = file($log_dir, 'netdisco-daemon.log');
|
|
||||||
|
|
||||||
my $uid = (stat($netdisco->stringify))[4] || 0;
|
|
||||||
my $gid = (stat($netdisco->stringify))[5] || 0;
|
|
||||||
|
|
||||||
Daemon::Control->new({
|
|
||||||
name => 'Netdisco Daemon',
|
|
||||||
program => \&restarter,
|
|
||||||
program_args => [@args],
|
|
||||||
pid_file => file($home, 'netdisco-daemon.pid'),
|
|
||||||
stderr_file => $log_file,
|
|
||||||
stdout_file => $log_file,
|
|
||||||
redirect_before_fork => 0,
|
|
||||||
uid => $uid, gid => $gid,
|
|
||||||
})->run;
|
|
||||||
|
|
||||||
# the guts of this are borrowed from Plack::Loader::Restarter - many thanks!!
|
|
||||||
my $child = 0;
|
|
||||||
|
|
||||||
sub restarter {
|
|
||||||
my ($daemon, @program_args) = @_;
|
|
||||||
$0 = 'netdisco-daemon';
|
|
||||||
|
|
||||||
$child = fork_and_start($daemon, @program_args);
|
|
||||||
exit(1) unless $child;
|
|
||||||
|
|
||||||
my $watcher = Filesys::Notify::Simple->new([$ENV{DANCER_ENVDIR}, $log_dir]);
|
|
||||||
warn "config watcher: watching $ENV{DANCER_ENVDIR} for updates.\n";
|
|
||||||
|
|
||||||
local $SIG{TERM} = sub { $child = signal_child('TERM', $child); exit(0); };
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
my @restart;
|
|
||||||
|
|
||||||
# this is blocking
|
|
||||||
$watcher->wait(sub {
|
|
||||||
my @events = @_;
|
|
||||||
@events = grep {$_->{path} eq $log_file or
|
|
||||||
file($_->{path})->basename eq $config} @events;
|
|
||||||
return unless @events;
|
|
||||||
@restart = @events;
|
|
||||||
});
|
|
||||||
|
|
||||||
my ($hupit, $rotate) = (0, 0);
|
|
||||||
next unless @restart;
|
|
||||||
|
|
||||||
foreach my $f (@restart) {
|
|
||||||
if ($f->{path} eq $log_file) {
|
|
||||||
++$rotate;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
warn "-- $f->{path} updated.\n";
|
|
||||||
++$hupit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rotate_logs($child, $daemon, @program_args) if $rotate;
|
|
||||||
if ($hupit) {
|
|
||||||
signal_child('TERM', $child);
|
|
||||||
$child = fork_and_start($daemon, @program_args);
|
|
||||||
exit(1) unless $child;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub fork_and_start {
|
|
||||||
my ($daemon, @daemon_args) = @_;
|
|
||||||
my $pid = fork;
|
|
||||||
die "Can't fork: $!" unless defined $pid;
|
|
||||||
|
|
||||||
if ($pid == 0) { # child
|
|
||||||
$daemon->redirect_filehandles;
|
|
||||||
exec( $netdisco->stringify, @daemon_args );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return $pid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub signal_child {
|
|
||||||
my ($signal, $pid) = @_;
|
|
||||||
return unless $signal and $pid;
|
|
||||||
warn "config watcher: sending $signal to the server (pid:$pid)...\n";
|
|
||||||
kill $signal => $pid;
|
|
||||||
waitpid($pid, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub rotate_logs {
|
|
||||||
my $child = shift;
|
|
||||||
|
|
||||||
return unless (-f $log_file) and
|
|
||||||
((-s $log_file) > (10 * 1024768));
|
|
||||||
|
|
||||||
my @files = glob file($log_dir, '*');
|
|
||||||
foreach my $f (reverse sort @files) {
|
|
||||||
next unless $f =~ m/$log_file\.(\d)$/;
|
|
||||||
my $pos = $1;
|
|
||||||
unlink $f if $pos == 7;
|
|
||||||
my $next = $pos + 1;
|
|
||||||
(my $newf = $f) =~ s/\.$pos$/.$next/;
|
|
||||||
rename $f, $newf;
|
|
||||||
}
|
|
||||||
|
|
||||||
# if the log file's about 10M then the race condition in copy/truncate
|
|
||||||
# has a low risk of data loss. if the file's larger, then we rename and
|
|
||||||
# kill.
|
|
||||||
if ((-s $log_file) > (12 * 1024768)) {
|
|
||||||
rename $log_file, $log_file .'.1';
|
|
||||||
signal_child('TERM', $child);
|
|
||||||
$child = fork_and_start(@_);
|
|
||||||
exit(1) unless $child;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
copy $log_file, $log_file .'.1';
|
|
||||||
truncate $log_file, 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
=head1 NAME
|
|
||||||
|
|
||||||
netdisco-daemon - Job Control Daemon for Netdisco
|
|
||||||
|
|
||||||
=head1 SEE ALSO
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item *
|
|
||||||
|
|
||||||
L<App::Netdisco>
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|||||||
@@ -3,107 +3,17 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
|
use File::Spec;
|
||||||
|
use Cwd 'realpath';
|
||||||
|
|
||||||
use FindBin;
|
use FindBin;
|
||||||
FindBin::again();
|
FindBin::again();
|
||||||
use Path::Class 'dir';
|
|
||||||
|
|
||||||
# get a segfault if we load this later
|
my $backend =
|
||||||
use if $^O eq 'linux', 'Sys::Proctitle';
|
File::Spec->catfile(
|
||||||
|
(File::Spec->splitpath(
|
||||||
|
realpath(File::Spec->catfile( $FindBin::RealBin, $FindBin::RealScript ))
|
||||||
|
))[1],
|
||||||
|
'netdisco-backend-fg');
|
||||||
|
|
||||||
BEGIN {
|
exec {$backend} 'netdisco-backend-fg', @ARGV;
|
||||||
# stuff useful locations into @INC
|
|
||||||
unshift @INC,
|
|
||||||
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
|
|
||||||
dir($FindBin::RealBin, 'lib')->stringify;
|
|
||||||
|
|
||||||
unshift @INC,
|
|
||||||
split m/:/, ($ENV{NETDISCO_INC} || '');
|
|
||||||
}
|
|
||||||
|
|
||||||
use App::Netdisco;
|
|
||||||
use Dancer qw/:moose :script/;
|
|
||||||
warning sprintf "App::Netdisco %s backend", ($App::Netdisco::VERSION || 'HEAD');
|
|
||||||
|
|
||||||
use App::Netdisco::Util::Daemon;
|
|
||||||
use NetAddr::IP::Lite ':lower'; # to quench AF_INET6 symbol errors
|
|
||||||
use Role::Tiny::With;
|
|
||||||
|
|
||||||
# preload all worker modules into shared memory
|
|
||||||
use App::Netdisco::Daemon::Job ();
|
|
||||||
use App::Netdisco::Daemon::Util ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Common ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Interactive::DeviceActions ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Interactive::PortActions ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Manager ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Poller::Arpnip ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Poller::Common ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Poller::Device ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Poller::Expiry ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Poller::Macsuck ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Poller::Nbtstat ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Poller ();
|
|
||||||
use App::Netdisco::Daemon::Worker::Scheduler ();
|
|
||||||
|
|
||||||
use MCE::Signal '-setpgrp';
|
|
||||||
use MCE::Flow Sereal => 1;
|
|
||||||
use MCE::Queue;
|
|
||||||
|
|
||||||
# set temporary MCE files' location in home directory
|
|
||||||
my $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
|
|
||||||
my $tmp_dir = ($ENV{NETDISCO_TEMP} || dir($home, 'tmp'));
|
|
||||||
mkdir $tmp_dir if ! -d $tmp_dir;
|
|
||||||
|
|
||||||
# process-table text
|
|
||||||
prctl 'netdisco-daemon: master';
|
|
||||||
|
|
||||||
# shared local job queue
|
|
||||||
my $queue = MCE::Queue->new;
|
|
||||||
|
|
||||||
# support a scheduler-only node
|
|
||||||
setting('workers')->{'no_manager'} = 1
|
|
||||||
if setting('workers')->{tasks} eq '0';
|
|
||||||
|
|
||||||
# MCE::Util has a limit of ncpu if AUTO is used in max_workers,
|
|
||||||
# so we parse the field ourselves.
|
|
||||||
my $max_workers = parse_max_workers( setting('workers')->{tasks} ) || 0;
|
|
||||||
|
|
||||||
mce_flow {
|
|
||||||
task_name => [qw/ scheduler manager poller /],
|
|
||||||
max_workers => [ 1, 1, $max_workers ],
|
|
||||||
tmp_dir => $tmp_dir,
|
|
||||||
on_post_exit => sub { MCE->restart_worker },
|
|
||||||
}, _mk_wkr('Scheduler'), _mk_wkr('Manager'), _mk_wkr('Poller');
|
|
||||||
|
|
||||||
sub _mk_wkr {
|
|
||||||
my $role = shift;
|
|
||||||
return sub {
|
|
||||||
my $self = shift;
|
|
||||||
$self->{queue} = $queue;
|
|
||||||
|
|
||||||
prctl sprintf 'netdisco-daemon: worker #%s %s: init', MCE->wid, lc($role);
|
|
||||||
info sprintf 'applying role %s to worker %s', $role, MCE->wid;
|
|
||||||
|
|
||||||
# post-fork, become manager, scheduler, poller, etc
|
|
||||||
Role::Tiny->apply_roles_to_object(
|
|
||||||
$self => "App::Netdisco::Daemon::Worker::$role");
|
|
||||||
|
|
||||||
$self->worker_begin if $self->can('worker_begin');
|
|
||||||
$self->worker_body;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
=head1 NAME
|
|
||||||
|
|
||||||
netdisco-daemon-fg - Job Control for Netdisco
|
|
||||||
|
|
||||||
=head1 SEE ALSO
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item *
|
|
||||||
|
|
||||||
L<App::Netdisco>
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ BEGIN {
|
|||||||
|
|
||||||
# for netdisco app config
|
# for netdisco app config
|
||||||
use App::Netdisco;
|
use App::Netdisco;
|
||||||
use App::Netdisco::Daemon::Job;
|
use App::Netdisco::Backend::Job;
|
||||||
use Dancer qw/:moose :script/;
|
use Dancer qw/:moose :script/;
|
||||||
|
|
||||||
info "App::Netdisco version $App::Netdisco::VERSION loaded.";
|
info "App::Netdisco version $App::Netdisco::VERSION loaded.";
|
||||||
@@ -104,13 +104,13 @@ unless ($action) {
|
|||||||
use App::Netdisco::Util::Device
|
use App::Netdisco::Util::Device
|
||||||
qw/get_device delete_device renumber_device/;
|
qw/get_device delete_device renumber_device/;
|
||||||
|
|
||||||
with 'App::Netdisco::Daemon::Worker::Poller::Device';
|
with 'App::Netdisco::Backend::Worker::Poller::Device';
|
||||||
with 'App::Netdisco::Daemon::Worker::Poller::Arpnip';
|
with 'App::Netdisco::Backend::Worker::Poller::Arpnip';
|
||||||
with 'App::Netdisco::Daemon::Worker::Poller::Macsuck';
|
with 'App::Netdisco::Backend::Worker::Poller::Macsuck';
|
||||||
with 'App::Netdisco::Daemon::Worker::Poller::Nbtstat';
|
with 'App::Netdisco::Backend::Worker::Poller::Nbtstat';
|
||||||
with 'App::Netdisco::Daemon::Worker::Poller::Expiry';
|
with 'App::Netdisco::Backend::Worker::Poller::Expiry';
|
||||||
with 'App::Netdisco::Daemon::Worker::Interactive::DeviceActions';
|
with 'App::Netdisco::Backend::Worker::Interactive::DeviceActions';
|
||||||
with 'App::Netdisco::Daemon::Worker::Interactive::PortActions';
|
with 'App::Netdisco::Backend::Worker::Interactive::PortActions';
|
||||||
|
|
||||||
eval { Module::Load::load 'App::Netdisco::Util::Graph' };
|
eval { Module::Load::load 'App::Netdisco::Util::Graph' };
|
||||||
sub graph {
|
sub graph {
|
||||||
@@ -233,7 +233,7 @@ foreach my $host (@hostlist) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# what job are we asked to do?
|
# what job are we asked to do?
|
||||||
my $job = App::Netdisco::Daemon::Job->new({
|
my $job = App::Netdisco::Backend::Job->new({
|
||||||
job => 0,
|
job => 0,
|
||||||
action => $action,
|
action => $action,
|
||||||
device => $dev,
|
device => $dev,
|
||||||
|
|||||||
@@ -134,10 +134,10 @@ Link some of the newly installed apps into a handy location:
|
|||||||
ln -s ~/perl5/bin/{localenv,netdisco-*} ~/bin/
|
ln -s ~/perl5/bin/{localenv,netdisco-*} ~/bin/
|
||||||
|
|
||||||
Test the installation by running the following command, which should only
|
Test the installation by running the following command, which should only
|
||||||
produce a status message (it's just a test - you'll start the daemon properly,
|
produce a status message (it's just a test - you'll start the daemons
|
||||||
later on):
|
properly, later on):
|
||||||
|
|
||||||
~/bin/netdisco-daemon status
|
~/bin/netdisco-backend status
|
||||||
|
|
||||||
=head1 Configuration
|
=head1 Configuration
|
||||||
|
|
||||||
@@ -167,8 +167,8 @@ details.
|
|||||||
|
|
||||||
The database either needs configuring if new, or updating from the current
|
The database either needs configuring if new, or updating from the current
|
||||||
release of Netdisco (1.x). You also need vendor MAC address prefixes (OUI
|
release of Netdisco (1.x). You also need vendor MAC address prefixes (OUI
|
||||||
data) and some MIBs if you want to run the daemon. The following script will
|
data) and some MIBs if you want to run the backend daemon. The following
|
||||||
take care of all this for you:
|
script will take care of all this for you:
|
||||||
|
|
||||||
~/bin/netdisco-deploy
|
~/bin/netdisco-deploy
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ Run the following command to start the web-app server as a backgrounded daemon
|
|||||||
|
|
||||||
Run the following command to start the job control daemon (port control, etc):
|
Run the following command to start the job control daemon (port control, etc):
|
||||||
|
|
||||||
~/bin/netdisco-daemon start
|
~/bin/netdisco-backend start
|
||||||
|
|
||||||
You should take care not to run this Netdisco daemon and the Netdisco 1.x
|
You should take care not to run this Netdisco daemon and the Netdisco 1.x
|
||||||
daemon at the same time. Similarly, if you use the device discovery with
|
daemon at the same time. Similarly, if you use the device discovery with
|
||||||
@@ -207,6 +207,7 @@ Notes|App::Netdisco::Manual::ReleaseNotes>. Then, the process is as follows:
|
|||||||
|
|
||||||
# upgrade Netdisco
|
# upgrade Netdisco
|
||||||
~/bin/localenv cpanm --notest App::Netdisco
|
~/bin/localenv cpanm --notest App::Netdisco
|
||||||
|
ln -s ~/perl5/bin/{localenv,netdisco-*} ~/bin/
|
||||||
|
|
||||||
# apply database schema updates
|
# apply database schema updates
|
||||||
~/bin/netdisco-deploy
|
~/bin/netdisco-deploy
|
||||||
@@ -215,7 +216,7 @@ Notes|App::Netdisco::Manual::ReleaseNotes>. Then, the process is as follows:
|
|||||||
~/bin/netdisco-web restart
|
~/bin/netdisco-web restart
|
||||||
|
|
||||||
# restart job daemon (if you use it)
|
# restart job daemon (if you use it)
|
||||||
~/bin/netdisco-daemon restart
|
~/bin/netdisco-backend restart
|
||||||
|
|
||||||
=head1 Tips and Tricks
|
=head1 Tips and Tricks
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package App::Netdisco::Daemon::Job;
|
package App::Netdisco::Backend::Job;
|
||||||
|
|
||||||
use Moo;
|
use Moo;
|
||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package App::Netdisco::Daemon::Util;
|
package App::Netdisco::Backend::Util;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
# support utilities for Daemon Actions
|
# support utilities for Backend Actions
|
||||||
|
|
||||||
use base 'Exporter';
|
use base 'Exporter';
|
||||||
our @EXPORT = ();
|
our @EXPORT = ();
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Common;
|
package App::Netdisco::Backend::Worker::Common;
|
||||||
|
|
||||||
use Dancer qw/:moose :syntax :script/;
|
use Dancer qw/:moose :syntax :script/;
|
||||||
|
|
||||||
use Try::Tiny;
|
use Try::Tiny;
|
||||||
use App::Netdisco::Util::Daemon;
|
use App::Netdisco::Util::Backend;
|
||||||
|
|
||||||
use Role::Tiny;
|
use Role::Tiny;
|
||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
@@ -18,7 +18,7 @@ sub worker_body {
|
|||||||
my $wid = $self->wid;
|
my $wid = $self->wid;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
prctl sprintf 'netdisco-daemon: worker #%s poller: idle', $wid;
|
prctl sprintf 'netdisco-backend: worker #%s poller: idle', $wid;
|
||||||
|
|
||||||
my $job = $self->{queue}->dequeue(1);
|
my $job = $self->{queue}->dequeue(1);
|
||||||
next unless defined $job;
|
next unless defined $job;
|
||||||
@@ -26,7 +26,7 @@ sub worker_body {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$job->started(scalar localtime);
|
$job->started(scalar localtime);
|
||||||
prctl sprintf 'netdisco-daemon: worker #%s poller: working on #%s: %s',
|
prctl sprintf 'netdisco-backend: worker #%s poller: working on #%s: %s',
|
||||||
$wid, $job->job, $job->summary;
|
$wid, $job->job, $job->summary;
|
||||||
info sprintf "pol (%s): starting %s job(%s) at %s",
|
info sprintf "pol (%s): starting %s job(%s) at %s",
|
||||||
$wid, $action, $job->job, $job->started;
|
$wid, $action, $job->job, $job->started;
|
||||||
@@ -50,7 +50,7 @@ sub close_job {
|
|||||||
my ($self, $job) = @_;
|
my ($self, $job) = @_;
|
||||||
my $now = scalar localtime;
|
my $now = scalar localtime;
|
||||||
|
|
||||||
prctl sprintf 'netdisco-daemon: worker #%s poller: wrapping up %s #%s: %s',
|
prctl sprintf 'netdisco-backend: worker #%s poller: wrapping up %s #%s: %s',
|
||||||
$self->wid, $job->action, $job->job, $job->status;
|
$self->wid, $job->action, $job->job, $job->status;
|
||||||
info sprintf "pol (%s): wrapping up %s job(%s) - status %s at %s",
|
info sprintf "pol (%s): wrapping up %s job(%s) - status %s at %s",
|
||||||
$self->wid, $job->action, $job->job, $job->status, $now;
|
$self->wid, $job->action, $job->job, $job->status, $now;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Interactive::DeviceActions;
|
package App::Netdisco::Backend::Worker::Interactive::DeviceActions;
|
||||||
|
|
||||||
use App::Netdisco::Util::SNMP 'snmp_connect_rw';
|
use App::Netdisco::Util::SNMP 'snmp_connect_rw';
|
||||||
use App::Netdisco::Util::Device 'get_device';
|
use App::Netdisco::Util::Device 'get_device';
|
||||||
use App::Netdisco::Daemon::Util ':all';
|
use App::Netdisco::Backend::Util ':all';
|
||||||
|
|
||||||
use Role::Tiny;
|
use Role::Tiny;
|
||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Interactive::PortActions;
|
package App::Netdisco::Backend::Worker::Interactive::PortActions;
|
||||||
|
|
||||||
use App::Netdisco::Util::Port ':all';
|
use App::Netdisco::Util::Port ':all';
|
||||||
use App::Netdisco::Util::SNMP 'snmp_connect_rw';
|
use App::Netdisco::Util::SNMP 'snmp_connect_rw';
|
||||||
use App::Netdisco::Util::Device 'get_device';
|
use App::Netdisco::Util::Device 'get_device';
|
||||||
use App::Netdisco::Daemon::Util ':all';
|
use App::Netdisco::Backend::Util ':all';
|
||||||
|
|
||||||
use Role::Tiny;
|
use Role::Tiny;
|
||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Manager;
|
package App::Netdisco::Backend::Worker::Manager;
|
||||||
|
|
||||||
use Dancer qw/:moose :syntax :script/;
|
use Dancer qw/:moose :syntax :script/;
|
||||||
|
|
||||||
use List::Util 'sum';
|
use List::Util 'sum';
|
||||||
use App::Netdisco::Util::Daemon;
|
use App::Netdisco::Util::Backend;
|
||||||
|
|
||||||
use Role::Tiny;
|
use Role::Tiny;
|
||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
@@ -35,12 +35,12 @@ sub worker_body {
|
|||||||
my $wid = $self->wid;
|
my $wid = $self->wid;
|
||||||
|
|
||||||
if (setting('workers')->{'no_manager'}) {
|
if (setting('workers')->{'no_manager'}) {
|
||||||
prctl sprintf 'netdisco-daemon: worker #%s manager: inactive', $wid;
|
prctl sprintf 'netdisco-backend: worker #%s manager: inactive', $wid;
|
||||||
return debug "mgr ($wid): no need for manager... quitting"
|
return debug "mgr ($wid): no need for manager... quitting"
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
prctl sprintf 'netdisco-daemon: worker #%s manager: gathering', $wid;
|
prctl sprintf 'netdisco-backend: worker #%s manager: gathering', $wid;
|
||||||
my $num_slots = 0;
|
my $num_slots = 0;
|
||||||
|
|
||||||
$num_slots = parse_max_workers( setting('workers')->{tasks} )
|
$num_slots = parse_max_workers( setting('workers')->{tasks} )
|
||||||
@@ -78,7 +78,7 @@ sub worker_body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
debug "mgr ($wid): sleeping now...";
|
debug "mgr ($wid): sleeping now...";
|
||||||
prctl sprintf 'netdisco-daemon: worker #%s manager: idle', $wid;
|
prctl sprintf 'netdisco-backend: worker #%s manager: idle', $wid;
|
||||||
sleep( setting('workers')->{sleep_time} || 1 );
|
sleep( setting('workers')->{sleep_time} || 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
18
lib/App/Netdisco/Backend/Worker/Poller.pm
Normal file
18
lib/App/Netdisco/Backend/Worker/Poller.pm
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package App::Netdisco::Backend::Worker::Poller;
|
||||||
|
|
||||||
|
use Role::Tiny;
|
||||||
|
use namespace::clean;
|
||||||
|
|
||||||
|
# main worker body
|
||||||
|
with 'App::Netdisco::Backend::Worker::Common';
|
||||||
|
|
||||||
|
# add dispatch methods for poller tasks
|
||||||
|
with 'App::Netdisco::Backend::Worker::Poller::Device',
|
||||||
|
'App::Netdisco::Backend::Worker::Poller::Arpnip',
|
||||||
|
'App::Netdisco::Backend::Worker::Poller::Macsuck',
|
||||||
|
'App::Netdisco::Backend::Worker::Poller::Nbtstat',
|
||||||
|
'App::Netdisco::Backend::Worker::Poller::Expiry',
|
||||||
|
'App::Netdisco::Backend::Worker::Interactive::DeviceActions',
|
||||||
|
'App::Netdisco::Backend::Worker::Interactive::PortActions';
|
||||||
|
|
||||||
|
1;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Poller::Arpnip;
|
package App::Netdisco::Backend::Worker::Poller::Arpnip;
|
||||||
|
|
||||||
use App::Netdisco::Core::Arpnip 'do_arpnip';
|
use App::Netdisco::Core::Arpnip 'do_arpnip';
|
||||||
use App::Netdisco::Util::Device 'is_arpnipable';
|
use App::Netdisco::Util::Device 'is_arpnipable';
|
||||||
@@ -6,7 +6,7 @@ use App::Netdisco::Util::Device 'is_arpnipable';
|
|||||||
use Role::Tiny;
|
use Role::Tiny;
|
||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
|
|
||||||
with 'App::Netdisco::Daemon::Worker::Poller::Common';
|
with 'App::Netdisco::Backend::Worker::Poller::Common';
|
||||||
|
|
||||||
sub arpnip_action { \&do_arpnip }
|
sub arpnip_action { \&do_arpnip }
|
||||||
sub arpnip_filter { \&is_arpnipable }
|
sub arpnip_filter { \&is_arpnipable }
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Poller::Common;
|
package App::Netdisco::Backend::Worker::Poller::Common;
|
||||||
|
|
||||||
use Dancer qw/:moose :syntax :script/;
|
use Dancer qw/:moose :syntax :script/;
|
||||||
|
|
||||||
use App::Netdisco::Util::SNMP 'snmp_connect';
|
use App::Netdisco::Util::SNMP 'snmp_connect';
|
||||||
use App::Netdisco::Util::Device 'get_device';
|
use App::Netdisco::Util::Device 'get_device';
|
||||||
use App::Netdisco::Daemon::Util ':all';
|
use App::Netdisco::Backend::Util ':all';
|
||||||
use App::Netdisco::JobQueue qw/jq_queued jq_insert/;
|
use App::Netdisco::JobQueue qw/jq_queued jq_insert/;
|
||||||
|
|
||||||
use Dancer::Plugin::DBIC 'schema';
|
use Dancer::Plugin::DBIC 'schema';
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Poller::Device;
|
package App::Netdisco::Backend::Worker::Poller::Device;
|
||||||
|
|
||||||
use Dancer qw/:moose :syntax :script/;
|
use Dancer qw/:moose :syntax :script/;
|
||||||
|
|
||||||
use App::Netdisco::Util::SNMP 'snmp_connect';
|
use App::Netdisco::Util::SNMP 'snmp_connect';
|
||||||
use App::Netdisco::Util::Device qw/get_device is_discoverable/;
|
use App::Netdisco::Util::Device qw/get_device is_discoverable/;
|
||||||
use App::Netdisco::Core::Discover ':all';
|
use App::Netdisco::Core::Discover ':all';
|
||||||
use App::Netdisco::Daemon::Util ':all';
|
use App::Netdisco::Backend::Util ':all';
|
||||||
use App::Netdisco::JobQueue qw/jq_queued jq_insert/;
|
use App::Netdisco::JobQueue qw/jq_queued jq_insert/;
|
||||||
|
|
||||||
use Dancer::Plugin::DBIC 'schema';
|
use Dancer::Plugin::DBIC 'schema';
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Poller::Expiry;
|
package App::Netdisco::Backend::Worker::Poller::Expiry;
|
||||||
|
|
||||||
use Dancer qw/:moose :syntax :script/;
|
use Dancer qw/:moose :syntax :script/;
|
||||||
use Dancer::Plugin::DBIC 'schema';
|
use Dancer::Plugin::DBIC 'schema';
|
||||||
|
|
||||||
use App::Netdisco::Daemon::Util ':all';
|
use App::Netdisco::Backend::Util ':all';
|
||||||
|
|
||||||
use Role::Tiny;
|
use Role::Tiny;
|
||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Poller::Macsuck;
|
package App::Netdisco::Backend::Worker::Poller::Macsuck;
|
||||||
|
|
||||||
use App::Netdisco::Core::Macsuck 'do_macsuck';
|
use App::Netdisco::Core::Macsuck 'do_macsuck';
|
||||||
use App::Netdisco::Util::Device 'is_macsuckable';
|
use App::Netdisco::Util::Device 'is_macsuckable';
|
||||||
@@ -6,7 +6,7 @@ use App::Netdisco::Util::Device 'is_macsuckable';
|
|||||||
use Role::Tiny;
|
use Role::Tiny;
|
||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
|
|
||||||
with 'App::Netdisco::Daemon::Worker::Poller::Common';
|
with 'App::Netdisco::Backend::Worker::Poller::Common';
|
||||||
|
|
||||||
sub macsuck_action { \&do_macsuck }
|
sub macsuck_action { \&do_macsuck }
|
||||||
sub macsuck_filter { \&is_macsuckable }
|
sub macsuck_filter { \&is_macsuckable }
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Poller::Nbtstat;
|
package App::Netdisco::Backend::Worker::Poller::Nbtstat;
|
||||||
|
|
||||||
use Dancer qw/:moose :syntax :script/;
|
use Dancer qw/:moose :syntax :script/;
|
||||||
use Dancer::Plugin::DBIC 'schema';
|
use Dancer::Plugin::DBIC 'schema';
|
||||||
@@ -6,7 +6,7 @@ use Dancer::Plugin::DBIC 'schema';
|
|||||||
use App::Netdisco::Core::Nbtstat qw/nbtstat_resolve_async store_nbt/;
|
use App::Netdisco::Core::Nbtstat qw/nbtstat_resolve_async store_nbt/;
|
||||||
use App::Netdisco::Util::Node 'is_nbtstatable';
|
use App::Netdisco::Util::Node 'is_nbtstatable';
|
||||||
use App::Netdisco::Util::Device qw/get_device is_discoverable/;
|
use App::Netdisco::Util::Device qw/get_device is_discoverable/;
|
||||||
use App::Netdisco::Daemon::Util ':all';
|
use App::Netdisco::Backend::Util ':all';
|
||||||
|
|
||||||
use NetAddr::IP::Lite ':lower';
|
use NetAddr::IP::Lite ':lower';
|
||||||
use Time::HiRes 'gettimeofday';
|
use Time::HiRes 'gettimeofday';
|
||||||
@@ -14,7 +14,7 @@ use Time::HiRes 'gettimeofday';
|
|||||||
use Role::Tiny;
|
use Role::Tiny;
|
||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
|
|
||||||
with 'App::Netdisco::Daemon::Worker::Poller::Common';
|
with 'App::Netdisco::Backend::Worker::Poller::Common';
|
||||||
|
|
||||||
sub nbtstat_action { \&do_nbtstat }
|
sub nbtstat_action { \&do_nbtstat }
|
||||||
sub nbtstat_filter { \&is_nbtstatable }
|
sub nbtstat_filter { \&is_nbtstatable }
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Scheduler;
|
package App::Netdisco::Backend::Worker::Scheduler;
|
||||||
|
|
||||||
use Dancer qw/:moose :syntax :script/;
|
use Dancer qw/:moose :syntax :script/;
|
||||||
|
|
||||||
use Algorithm::Cron;
|
use Algorithm::Cron;
|
||||||
use App::Netdisco::Util::Daemon;
|
use App::Netdisco::Util::Backend;
|
||||||
|
|
||||||
use Role::Tiny;
|
use Role::Tiny;
|
||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
@@ -39,7 +39,7 @@ sub worker_body {
|
|||||||
my $wid = $self->wid;
|
my $wid = $self->wid;
|
||||||
|
|
||||||
unless (setting('schedule')) {
|
unless (setting('schedule')) {
|
||||||
prctl sprintf 'netdisco-daemon: worker #%s scheduler: inactive', $wid;
|
prctl sprintf 'netdisco-backend: worker #%s scheduler: inactive', $wid;
|
||||||
return debug "sch ($wid): no need for scheduler... quitting"
|
return debug "sch ($wid): no need for scheduler... quitting"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,11 +47,11 @@ sub worker_body {
|
|||||||
# sleep until some point in the next minute
|
# sleep until some point in the next minute
|
||||||
my $naptime = 60 - (time % 60) + int(rand(45));
|
my $naptime = 60 - (time % 60) + int(rand(45));
|
||||||
|
|
||||||
prctl sprintf 'netdisco-daemon: worker #%s scheduler: idle', $wid;
|
prctl sprintf 'netdisco-backend: worker #%s scheduler: idle', $wid;
|
||||||
debug "sched ($wid): sleeping for $naptime seconds";
|
debug "sched ($wid): sleeping for $naptime seconds";
|
||||||
|
|
||||||
sleep $naptime;
|
sleep $naptime;
|
||||||
prctl sprintf 'netdisco-daemon: worker #%s scheduler: queueing', $wid;
|
prctl sprintf 'netdisco-backend: worker #%s scheduler: queueing', $wid;
|
||||||
|
|
||||||
# NB next_time() returns the next *after* win_start
|
# NB next_time() returns the next *after* win_start
|
||||||
my $win_start = time - (time % 60) - 1;
|
my $win_start = time - (time % 60) - 1;
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package App::Netdisco::Daemon::Worker::Poller;
|
|
||||||
|
|
||||||
use Role::Tiny;
|
|
||||||
use namespace::clean;
|
|
||||||
|
|
||||||
# main worker body
|
|
||||||
with 'App::Netdisco::Daemon::Worker::Common';
|
|
||||||
|
|
||||||
# add dispatch methods for poller tasks
|
|
||||||
with 'App::Netdisco::Daemon::Worker::Poller::Device',
|
|
||||||
'App::Netdisco::Daemon::Worker::Poller::Arpnip',
|
|
||||||
'App::Netdisco::Daemon::Worker::Poller::Macsuck',
|
|
||||||
'App::Netdisco::Daemon::Worker::Poller::Nbtstat',
|
|
||||||
'App::Netdisco::Daemon::Worker::Poller::Expiry',
|
|
||||||
'App::Netdisco::Daemon::Worker::Interactive::DeviceActions',
|
|
||||||
'App::Netdisco::Daemon::Worker::Interactive::PortActions';
|
|
||||||
|
|
||||||
1;
|
|
||||||
@@ -3,7 +3,7 @@ package App::Netdisco::JobQueue::PostgreSQL;
|
|||||||
use Dancer qw/:moose :syntax :script/;
|
use Dancer qw/:moose :syntax :script/;
|
||||||
use Dancer::Plugin::DBIC 'schema';
|
use Dancer::Plugin::DBIC 'schema';
|
||||||
|
|
||||||
use App::Netdisco::Daemon::Job;
|
use App::Netdisco::Backend::Job;
|
||||||
use Net::Domain 'hostfqdn';
|
use Net::Domain 'hostfqdn';
|
||||||
use Module::Load ();
|
use Module::Load ();
|
||||||
use Try::Tiny;
|
use Try::Tiny;
|
||||||
@@ -38,7 +38,7 @@ sub _getsome {
|
|||||||
|
|
||||||
my @returned = ();
|
my @returned = ();
|
||||||
while (my $job = $rs->next) {
|
while (my $job = $rs->next) {
|
||||||
push @returned, App::Netdisco::Daemon::Job->new({ $job->get_columns });
|
push @returned, App::Netdisco::Backend::Job->new({ $job->get_columns });
|
||||||
}
|
}
|
||||||
return @returned;
|
return @returned;
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ sub jq_locked {
|
|||||||
->search({status => "queued-$fqdn"});
|
->search({status => "queued-$fqdn"});
|
||||||
|
|
||||||
while (my $job = $rs->next) {
|
while (my $job = $rs->next) {
|
||||||
push @returned, App::Netdisco::Daemon::Job->new({ $job->get_columns });
|
push @returned, App::Netdisco::Backend::Job->new({ $job->get_columns });
|
||||||
}
|
}
|
||||||
return @returned;
|
return @returned;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ App::Netdisco::Manual::Deployment - Tips and Tricks for Deployment
|
|||||||
The Netdisco applications will generate RC scripts suitable for Linux systems:
|
The Netdisco applications will generate RC scripts suitable for Linux systems:
|
||||||
|
|
||||||
bin/netdisco-web get_init_file
|
bin/netdisco-web get_init_file
|
||||||
bin/netdisco-daemon get_init_file
|
bin/netdisco-backend get_init_file
|
||||||
|
|
||||||
On C<systemd>-based systems please see L<our systemd
|
On C<systemd>-based systems please see L<our systemd
|
||||||
guide|App::Netdisco::Manual::Systemd>.
|
guide|App::Netdisco::Manual::Systemd>.
|
||||||
|
|||||||
@@ -51,14 +51,14 @@ directory
|
|||||||
You might also want to set C<check_userlog> to C<false> in your config to
|
You might also want to set C<check_userlog> to C<false> in your config to
|
||||||
quieten some of the web client callbacks.
|
quieten some of the web client callbacks.
|
||||||
|
|
||||||
For the daemon, it's very similar:
|
For the backend daemon, it's very similar:
|
||||||
|
|
||||||
DBIC_TRACE=1 ~/bin/localenv bin/netdisco-daemon-fg
|
DBIC_TRACE=1 ~/bin/localenv bin/netdisco-backend-fg
|
||||||
|
|
||||||
You can point at a different database without editing C<deployment.yml>:
|
You can point at a different database without editing C<deployment.yml>:
|
||||||
|
|
||||||
NETDISCO_DBNAME=testdb DBIC_TRACE=1 ~/bin/localenv plackup -R share,lib -p 5001 bin/netdisco-web-fg
|
NETDISCO_DBNAME=testdb DBIC_TRACE=1 ~/bin/localenv plackup -R share,lib -p 5001 bin/netdisco-web-fg
|
||||||
NETDISCO_DBNAME=testdb DBIC_TRACE=1 ~/bin/localenv bin/netdisco-daemon-fg
|
NETDISCO_DBNAME=testdb DBIC_TRACE=1 ~/bin/localenv bin/netdisco-backend-fg
|
||||||
|
|
||||||
It's recommended to delete the "C<~/perl5/lib/perl5/App/Netdisco>"
|
It's recommended to delete the "C<~/perl5/lib/perl5/App/Netdisco>"
|
||||||
directory to avoid accidentally picking up old Netdisco code. For working on
|
directory to avoid accidentally picking up old Netdisco code. For working on
|
||||||
@@ -398,7 +398,7 @@ database connection management features mentioned above.
|
|||||||
|
|
||||||
The job daemon is backwards compatible with the old Netdisco database job
|
The job daemon is backwards compatible with the old Netdisco database job
|
||||||
requests table. All code for the job daemon lives under the
|
requests table. All code for the job daemon lives under the
|
||||||
L<App::Netdisco::Daemon> namespace and like the rest of Netdisco is broken
|
L<App::Netdisco::Backend> namespace and like the rest of Netdisco is broken
|
||||||
down into manageable chunks.
|
down into manageable chunks.
|
||||||
|
|
||||||
=head2 Running the Job Daemon
|
=head2 Running the Job Daemon
|
||||||
@@ -407,10 +407,10 @@ Like the web application, the job daemon is fully self contained and runs via
|
|||||||
two simple scripts shipped with the distribution - one for foreground and one
|
two simple scripts shipped with the distribution - one for foreground and one
|
||||||
for background execution (see the user docs for instructions).
|
for background execution (see the user docs for instructions).
|
||||||
|
|
||||||
The C<netdisco-daemon> script uses L<Daemon::Control> to daemonize so you can
|
The C<netdisco-backend> script uses L<Daemon::Control> to daemonize so you can
|
||||||
fire-and-forget the Netdisco job daemon without much trouble at all. This
|
fire-and-forget the Netdisco job daemon without much trouble at all. This
|
||||||
script in turn calls C<netdisco-daemon-fg> which is the real application, that
|
script in turn calls C<netdisco-backend-fg> which is the real application,
|
||||||
runs in the foreground if called on its own.
|
that runs in the foreground if called on its own.
|
||||||
|
|
||||||
=head2 Daemon Engineering
|
=head2 Daemon Engineering
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,22 @@ deploy script for App::Netdisco will make some schema changes to the database,
|
|||||||
but they are backwards compatible.
|
but they are backwards compatible.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
=head1 2.036000
|
||||||
|
|
||||||
|
=head2 Health Advice
|
||||||
|
|
||||||
|
In this release the apps C<netdisco-daemon> and C<netdisco-daemon-fg> have
|
||||||
|
been renamed to C<netdisco-backend> and C<netdisco-backend-fg> respectively.
|
||||||
|
|
||||||
|
This better reflects the function of the two programs. If you still have
|
||||||
|
scripts using C<netdisco-daemon> or C<netdisco-daemon-fg> commands, they
|
||||||
|
should continue to work, as these apps still exist and simply exec() to the
|
||||||
|
new scripts on start.
|
||||||
|
|
||||||
|
However, it would be best if you replace any custom management config to
|
||||||
|
point to the new app names, going forward. Remember to do this on upgrade:
|
||||||
|
|
||||||
|
ln -s ~/perl5/bin/{localenv,netdisco-*} ~/bin/
|
||||||
|
|
||||||
=head1 2.035007
|
=head1 2.035007
|
||||||
|
|
||||||
|
|||||||
@@ -10,21 +10,21 @@ instructions apply to your local installation and use at your own risk.
|
|||||||
|
|
||||||
=head1 Files
|
=head1 Files
|
||||||
|
|
||||||
=head2 C<< /etc/systemd/system/netdisco-daemon.service >>
|
=head2 C<< /etc/systemd/system/netdisco-backend.service >>
|
||||||
|
|
||||||
This should be set mode 644 and owned by user and group C<root>.
|
This should be set mode 644 and owned by user and group C<root>.
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Netdisco Daemon Service
|
Description=Netdisco Backend Service
|
||||||
AssertFileIsExecutable=/home/netdisco/bin/netdisco-daemon
|
AssertFileIsExecutable=/home/netdisco/bin/netdisco-backend
|
||||||
After=syslog.target network-online.target
|
After=syslog.target network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
User=netdisco
|
User=netdisco
|
||||||
Group=netdisco
|
Group=netdisco
|
||||||
ExecStart=/home/netdisco/bin/netdisco-daemon start
|
ExecStart=/home/netdisco/bin/netdisco-backend start
|
||||||
ExecStop=/home/netdisco/bin/netdisco-daemon stop
|
ExecStop=/home/netdisco/bin/netdisco-backend stop
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=60
|
RestartSec=60
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ This should be set mode 644 and owned by user and group C<root>.
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Netdisco Web Service
|
Description=Netdisco Web Service
|
||||||
AssertFileIsExecutable=/home/netdisco/bin/netdisco-web
|
AssertFileIsExecutable=/home/netdisco/bin/netdisco-web
|
||||||
After=syslog.target network-online.target netdisco-daemon.service
|
After=syslog.target network-online.target netdisco-backend.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
@@ -56,15 +56,15 @@ This should be set mode 644 and owned by user and group C<root>.
|
|||||||
|
|
||||||
To enable Netdisco in systemd:
|
To enable Netdisco in systemd:
|
||||||
|
|
||||||
systemctl enable netdisco-daemon.service
|
systemctl enable netdisco-backend.service
|
||||||
systemctl enable netdisco-web.service
|
systemctl enable netdisco-web.service
|
||||||
|
|
||||||
To start Netdisco:
|
To start Netdisco:
|
||||||
|
|
||||||
systemctl start netdisco-daemon.service
|
systemctl start netdisco-backend.service
|
||||||
systemctl start netdisco-web.service
|
systemctl start netdisco-web.service
|
||||||
|
|
||||||
May also need to run C<systemctl daemon-reload> depending on the order you do
|
May also need to run C<systemctl netdisco-backend reload> depending on the
|
||||||
these steps.
|
order you do these steps.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package App::Netdisco::Util::Daemon;
|
package App::Netdisco::Util::Backend;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# This is the main configuration file for Netdisco web and daemon apps
|
# This is the main configuration file for Netdisco web and backend apps
|
||||||
#
|
#
|
||||||
# DO NOT EDIT THIS FILE
|
# DO NOT EDIT THIS FILE
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ discover_no_type:
|
|||||||
- '(?i)phone'
|
- '(?i)phone'
|
||||||
- '(?i)(?:wap|wireless)'
|
- '(?i)(?:wap|wireless)'
|
||||||
|
|
||||||
# number of SNMP workers to run in parallel (in netdisco-daemon).
|
# number of SNMP workers to run in parallel (in netdisco-backend).
|
||||||
# the default is twice the number of CPU cores. increase this if
|
# the default is twice the number of CPU cores. increase this if
|
||||||
# your system has few cores and the schedule is taking too long.
|
# your system has few cores and the schedule is taking too long.
|
||||||
# ```````````````````````````````````````````````````````````````
|
# ```````````````````````````````````````````````````````````````
|
||||||
|
|||||||
Reference in New Issue
Block a user