periodically update system info

This commit is contained in:
wh1te909 2020-09-12 22:11:21 +00:00
parent b2452c261c
commit 89ce732f85
3 changed files with 23 additions and 0 deletions

View File

@ -252,6 +252,10 @@ def system_info():
}
def local_sys_info():
return __salt__["cmd.run_bg"]([TAC_RMM, "-m", "sysinfo"])
def get_procs():
ret = []

View File

@ -96,6 +96,21 @@ def batch_sync_modules_task():
sleep(10)
@app.task
def batch_sysinfo_task():
# update system info using WMI
agents = Agent.objects.all()
online = [
i.salt_id
for i in agents
if not i.not_supported("0.11.0") and i.status == "online"
]
chunks = (online[i : i + 30] for i in range(0, len(online), 30))
for chunk in chunks:
Agent.salt_batch_async(minions=chunk, func="win_agent.local_sys_info")
sleep(10)
@app.task
def uninstall_agent_task(salt_id):
attempts = 0

View File

@ -37,6 +37,10 @@ app.conf.beat_schedule = {
"task": "agents.tasks.batch_sync_modules_task",
"schedule": crontab(minute=40, hour="*/4"),
},
"sys-info": {
"task": "agents.tasks.batch_sysinfo_task",
"schedule": crontab(minute=15, hour="*/2"),
},
}