User story #7206
closedTouch local file on inventory upload
Description
Hi,
Could you please touch a local file by the rudder-agent when an Inventory is successfully uploaded?
I am monitoring the nodes for this, and currently I could only do it (AFAIK) by grepping through the log files.
thanks.
JM
Updated by Matthieu CERDA about 9 years ago
- Status changed from New to Discussion
- Assignee set to Janos Mattyasovszky
- Priority changed from N/A to 4
- Target version set to Ideas (not version specific)
Hello Janos,
All the inventories that the server receives are also dropped in /var/rudder/inventories/received, maybe you could monitor those files instead ?
Updated by Janos Mattyasovszky about 9 years ago
The Background for the request: We are having a very extensive Nagios-Monitoring set up, that is checking all our systems over SSH, and is executing local tests, and according to that, creates notification, that is hooked into a ticketing system, and according to the host the notification is originating to, the appropriate support group is determined...
The idea would be good to start with, however, it has some bottlenecks, you'd need to:- monitor server-A if you would check for server-B's inventory;
- somehow parse the inventory to get the info of which node's inventory you are actually checking for;
- have some kind of inotify set up, as the agent's run forwards the inventory and removes if afterwards;
There is currently a file being updated when the policy is fetched from the policy server, we'd be happy to have a similar file when the inventory upload has been executed successfully (I don't think the effort in touching a file on a successful upload would be that hard or break anything, as it's a new file).
Proposed patchset:
# diff -u8 /var/rudder/cfengine-community/inputs/inventory/1.0/fusionAgent.cf{.orig,} --- /var/rudder/cfengine-community/inputs/inventory/1.0/fusionAgent.cf.orig 2015-10-05 16:54:38.000000000 +0200 +++ /var/rudder/cfengine-community/inputs/inventory/1.0/fusionAgent.cf 2015-10-05 17:02:17.000000000 +0200 @@ -442,16 +442,21 @@ !windows.inventory_sent.!cant_send_inventory:: "${g.rudder_inventories}" transformer => "${g.rudder_rm} -f ${this.promiser}", depth_search => recurse_visible(1), file_select => inventory_files, classes => if_else("inventory_file_deleted", "cant_delete_inventory_file"), comment => "Cleaning up inventory files already sent to the server"; + "${g.rudder_base}/etc/inventory_uploaded" + create => "true", + touch => "true", + comment => "Create local info about successful upload"; + "${g.rudder_var_tmp}/inventory" transformer => "${g.rudder_rm} -f ${this.promiser}", depth_search => recurse_visible(1), file_select => inventory_files, classes => if_else("inventory_file_deleted", "cant_delete_inventory_file"), comment => "Cleaning up inventory files already sent to the server"; reports:
Test looks OK:
node:~ # ll /opt/rudder/etc/inventory_uploaded -rw------- 1 root root 0 Oct 5 17:01 /opt/rudder/etc/inventory_uploaded node:~ # rudder agent inventory > /dev/null node:~ # ll /opt/rudder/etc/inventory_uploaded -rw------- 1 root root 0 Oct 5 17:04 /opt/rudder/etc/inventory_uploaded node:~ #
Updated by Benoît PECCATTE about 9 years ago
Janos, there is indeed something that is touched when an inventory is sent, it's the inventory directory.
If the last inventory has failed to be sent, this directory contains the inventory file.
Otherwise, the modification time of this directory is the last successful inventory time.
Is this enough for you or do you still need a specific file to be touched ?
Updated by Janos Mattyasovszky about 9 years ago
Well, the problem is if I'd like to check for a valid inventory sent, I'd have to check the dir's timestamp and also if there are any files within.
That would be a lot of error-prone than just having to check the modification time of a dedicated file.
As the classes are already defined and used, the change would be minor (however, probably not what I googled together on cf-engine syntax...).
I would be happy if that additional file-touching could be implemented...
Updated by Benoît PECCATTE about 9 years ago
OK, we just need to define the right place to put the timestamp file.
It doesn't really belong to etc/
I'd prefer to use something like /opt/rudder/var/fusioninventory or something under /var/rudder/tmp/
Updated by Janos Mattyasovszky about 9 years ago
- Pull Request set to https://github.com/Normation/rudder-techniques/pull/757
Updated by Anonymous about 9 years ago
- Status changed from Discussion to Pending release
- % Done changed from 0 to 100
Applied in changeset rudder-techniques|59ed05c4b05f291337da779899adb4ee472f2df6.
Updated by Benoît PECCATTE about 9 years ago
Applied in changeset rudder-techniques|b4d4d6ea9b58175fcc478b250671388fbd12879d.
Updated by Vincent MEMBRÉ about 9 years ago
- Category changed from Agent to System techniques
- Target version changed from Ideas (not version specific) to 2.11.16
Updated by Vincent MEMBRÉ about 9 years ago
- Status changed from Pending release to Released
Updated by Vincent MEMBRÉ about 9 years ago
- Status changed from Released to Pending release
- Target version changed from 2.11.16 to Ideas (not version specific)
Updated by Vincent MEMBRÉ about 9 years ago
- Target version deleted (
Ideas (not version specific))
Updated by Jonathan CLARKE almost 9 years ago
- Related to Bug #7782: inventory sent file timestamp not updated in normal run (system techniques) added
Updated by Jonathan CLARKE almost 9 years ago
- Status changed from Pending release to Released