From 46f25ea6169fee41da6cdfcf631206b8b0f79012 Mon Sep 17 00:00:00 2001 From: Jon Date: Sat, 24 Feb 2024 22:00:46 +0930 Subject: [PATCH] feat(server): Update the time of last access for scan agent !11 closes #5 --- .../collection/phpipam_scan_agent/index.md | 11 +++++++++++ playbooks/server.yaml | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/docs/projects/ansible/collection/phpipam_scan_agent/index.md b/docs/projects/ansible/collection/phpipam_scan_agent/index.md index 92a4672..b94082d 100644 --- a/docs/projects/ansible/collection/phpipam_scan_agent/index.md +++ b/docs/projects/ansible/collection/phpipam_scan_agent/index.md @@ -75,6 +75,17 @@ When this setting is enabled, the scanner will scan the entire subnet that has b This is displayed within the subnet interface next to the `Discover new hosts` field. Whenever a scan report is received by the server this filed is updated to reflect the last scan time. +### Scan Agent + +- Location `Administration -> Scan agents [Last access]` + +This is displayed within the Scan Agent table in column `Last access`. When ever the scanner checks in, the time of the checkin is used to update the field. + +- Location `Subnet -> Scan agent [Last Check]` + +This is displayed within the subnet interface next to `Scan agent` field. When ever the scanner checks in, the time of the checkin is used to update the field. + + ## Development Notes Contributions to this project are welcome. Below you will find some useful commands for use during development. diff --git a/playbooks/server.yaml b/playbooks/server.yaml index d740d90..d007e47 100644 --- a/playbooks/server.yaml +++ b/playbooks/server.yaml @@ -38,6 +38,24 @@ register: mysql_query_agent_details + - name: Update Scan Agent Last seen + community.mysql.mysql_query: + login_host: "{{ nofusscomputing_phpipam_scan_server.mysql_host }}" + login_port: "{{ nofusscomputing_phpipam_scan_server.mysql_port | default(3306) | int }}" + login_user: "{{ nofusscomputing_phpipam_scan_server.mysql_user }}" + login_password: "{{ nofusscomputing_phpipam_scan_server.mysql_password }}" + + login_db: 'phpipam' + query: |- + UPDATE + scanAgents + SET + last_access = '{{ ('%Y-%m-%d %H:%M:%S' | strftime) }}' + WHERE + id = '{{ mysql_query_agent_details.query_result[0][0].id }}' + single_transaction: true + + - name: Confirm Subnet Assignment community.mysql.mysql_query: login_host: "{{ nofusscomputing_phpipam_scan_server.mysql_host }}"