]> granicus.if.org Git - icinga2/blobdiff - tools/icinga2-discover-agent.cmake
Implement support for hosts in the agent component.
[icinga2] / tools / icinga2-discover-agent.cmake
index 197172a6f9e8e288033f0f1c0f49be565c8e50ac..7ff76fd4ef9c05b52264ad5ec3e1e46b90eb2eb9 100644 (file)
@@ -109,7 +109,7 @@ class NetstringParser(object):
 # along with this program; if not, write to the Free Software Foundation
 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
-import socket, ssl, sys, json, os, hashlib
+import socket, ssl, sys, json, os, hashlib, time
 
 def warning(*objs):
     print(*objs, file=sys.stderr)
@@ -180,11 +180,12 @@ if method != "push_crs":
     warning("Agent did not return any check results. Make sure you're using the master certificate.")
     sys.exit(1)
 
-params = response['params']
+params = response["params"]
+params["seen"] = time.time()
 
 inventory_file = "@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/lib/icinga2/agent/inventory/" + hashlib.sha256(cn).hexdigest()
 fp = open(inventory_file, "w")
-inventory_info = { "identity": cn, "crs": params }
+inventory_info = { "identity": cn, "params": params }
 json.dump(inventory_info, fp)
 fp.close()