Commit a60c529f094c739c85260f543ffc50d98ecf78a0

Authored by Eduardo Santos
Committed by Eduardo Santos
2 parents 55a73f12 3d84f59b
Exists in master

Comandos para monitoramento contínuo do diretório

Showing 2 changed files with 14 additions and 10 deletions   Show diff stats
README.md
... ... @@ -11,13 +11,3 @@ Para funcionar é necessário primeiro instalar o pacote da distribuição e só
11 11 virtualenv --system-site-packages -p /usr/bin/python2.7 cocar-agente
12 12 </pre>
13 13  
14   -Dependência de um módulo externo chamado pylanos
15   -
16   -<pre>
17   -cd /home/eduardo/srv/cocar-agente/src
18   -cd cocar-agente/cocar
19   -mkdir lib
20   -cd lib
21   -wget https://github.com/c0r3dump3d/pylanos/raw/master/PyLanOS.py
22   -mv PyLanOS.py pylanos.py
23   -</pre>
24 14 \ No newline at end of file
... ...
cocar/commands/scan_commands.py
... ... @@ -93,6 +93,9 @@ class ScanCommands(command.Command):
93 93 if cmd == 'continous_scan':
94 94 self.continuous_scan()
95 95 return
  96 + if cmd == 'printer_scan':
  97 + self.printer_scan()
  98 + return
96 99 else:
97 100 log.error('Command "%s" not recognized' % (cmd,))
98 101  
... ... @@ -281,6 +284,17 @@ class ScanCommands(command.Command):
281 284 while True:
282 285 self.scan_networks()
283 286  
  287 + def printer_scan(self):
  288 + """
  289 + Fica varrendo a rede e tenta encontrar as impressoras a cada 10min
  290 + """
  291 + print("*** Aperente CTRL+C para encerrar a execução ***")
  292 +
  293 + while True:
  294 + self.get_printers()
  295 + log.info("SCAN DE IMPRESSORAS FINALIZADO!!! Dormindo...")
  296 + time.sleep(600)
  297 +
284 298  
285 299 def make_query(host):
286 300 """This does the actual snmp query
... ...