diff --git a/api/tacticalrmm/agents/management/commands/fake_agents.py b/api/tacticalrmm/agents/management/commands/fake_agents.py index 9b7a829f..2adbd39f 100644 --- a/api/tacticalrmm/agents/management/commands/fake_agents.py +++ b/api/tacticalrmm/agents/management/commands/fake_agents.py @@ -27,6 +27,7 @@ from tacticalrmm.constants import ( EvtLogFailWhen, EvtLogNames, EvtLogTypes, + GoArch, PAAction, ScriptShell, TaskSyncStatus, @@ -47,10 +48,12 @@ from tacticalrmm.demo_data import ( temp_dir_stdout, wmi_deb, wmi_pi, + wmi_mac, + disks_mac, ) from winupdate.models import WinUpdate, WinUpdatePolicy -AGENTS_TO_GENERATE = 20 +AGENTS_TO_GENERATE = 100 SVCS = settings.BASE_DIR.joinpath("tacticalrmm/test_data/winsvcs.json") WMI_1 = settings.BASE_DIR.joinpath("tacticalrmm/test_data/wmi1.json") @@ -169,7 +172,7 @@ class Command(BaseCommand): for site in sites6: Site(client=client6, name=site).save() - hostnames = ( + win_hostnames = ( "DC-1", "DC-2", "FSV-1", @@ -194,6 +197,7 @@ class Command(BaseCommand): linux_deb_os = "Debian 11.2 x86_64 5.10.0-11-amd64" linux_pi_os = "Raspbian 11.2 armv7l 5.10.92-v7+" + mac_os = "Darwin 12.5.1 arm64 21.6.0" public_ips = ("65.234.22.4", "74.123.43.5", "44.21.134.45") @@ -311,20 +315,30 @@ class Command(BaseCommand): if plat_pick in (7, 11): agent.plat = AgentPlat.LINUX mode = AgentMonType.SERVER + agent.hostname = "db-aws-01" # pi arm if plat_pick == 7: - agent.goarch = "arm" + agent.goarch = GoArch.ARM32 agent.wmi_detail = wmi_pi agent.disks = disks_linux_pi agent.operating_system = linux_pi_os else: - agent.goarch = "amd64" + agent.goarch = GoArch.AMD64 agent.wmi_detail = wmi_deb agent.disks = disks_linux_deb agent.operating_system = linux_deb_os + elif plat_pick in (4, 14): + agent.plat = AgentPlat.DARWIN + agent.hostname = "Karens-MacBook-Air.local" + mode = random.choice([AgentMonType.SERVER, AgentMonType.WORKSTATION]) + agent.goarch = GoArch.ARM64 + agent.wmi_detail = wmi_mac + agent.disks = disks_mac + agent.operating_system = mac_os else: agent.plat = AgentPlat.WINDOWS - agent.goarch = "amd64" + agent.hostname = random.choice(win_hostnames) + agent.goarch = GoArch.AMD64 mode = random.choice(modes) agent.wmi_detail = random.choice(wmi_details) agent.services = services @@ -334,7 +348,6 @@ class Command(BaseCommand): else: agent.operating_system = random.choice(op_systems_workstations) - agent.hostname = random.choice(hostnames) agent.version = settings.LATEST_AGENT_VER agent.site = Site.objects.get(name=site) agent.agent_id = self.rand_string(40) diff --git a/api/tacticalrmm/tacticalrmm/demo_data.py b/api/tacticalrmm/tacticalrmm/demo_data.py index 2e283af6..fa824463 100644 --- a/api/tacticalrmm/tacticalrmm/demo_data.py +++ b/api/tacticalrmm/tacticalrmm/demo_data.py @@ -95,6 +95,41 @@ disks_linux_deb = [ }, ] +disks_mac = [ + { + "free": "94.2 GB", + "used": "134.1 GB", + "total": "228.3 GB", + "device": "/dev/disk3s1s1", + "fstype": "apfs", + "percent": 58, + }, + { + "free": "481.6 MB", + "used": "18.4 MB", + "total": "500.0 MB", + "device": "/dev/disk1s3", + "fstype": "apfs", + "percent": 3, + }, + { + "free": "3.4 GB", + "used": "1.6 GB", + "total": "5.0 GB", + "device": "/dev/disk2s1", + "fstype": "apfs", + "percent": 32, + }, + { + "free": "94.2 GB", + "used": "134.1 GB", + "total": "228.3 GB", + "device": "/dev/disk3s1", + "fstype": "apfs", + "percent": 58, + }, +] + wmi_deb = { "cpus": ["AMD Ryzen 9 3900X 12-Core Processor"], "gpus": ["Cirrus Logic GD 5446"], @@ -111,6 +146,22 @@ wmi_pi = { "make_model": "Raspberry Pi 2 Model B Rev 1.1", } +wmi_mac = { + "cpus": ["Apple M1"], + "gpus": [], + "disks": [ + "Apple APPLE SSD AP0256Q SCSI SSD disk0 233.8 GB", + "Apple APPLE SSD AP0256Q SCSI SSD disk1 500.0 MB", + "Apple APPLE SSD AP0256Q SCSI SSD disk2 5.0 GB", + "Apple APPLE SSD AP0256Q SCSI SSD disk3 228.3 GB", + ], + "local_ips": [ + "192.168.45.113/24", + "fe80::476:c390:c8dc:11af/64", + ], + "make_model": "MacBookAir10,1", +} + check_network_loc_aware_ps1 = r""" $networkstatus = Get-NetConnectionProfile | Select NetworkCategory | Out-String