Project

General

Profile

Actions

User story #7206

closed

Touch local file on inventory upload

Added by Janos Mattyasovszky over 8 years ago. Updated about 8 years ago.

Status:
Released
Priority:
4
Category:
System techniques
Target version:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
Fix check:
Regression:

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


Related issues 1 (0 open1 closed)

Related to Rudder - Bug #7782: inventory sent file timestamp not updated in normal run (system techniques)ReleasedNicolas CHARLES2016-01-15Actions
Actions #1

Updated by Matthieu CERDA over 8 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 ?

Actions #2

Updated by Janos Mattyasovszky over 8 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:~ #
Actions #3

Updated by Benoît PECCATTE over 8 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 ?

Actions #4

Updated by Janos Mattyasovszky over 8 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...

Actions #5

Updated by Benoît PECCATTE over 8 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/

Actions #6

Updated by Janos Mattyasovszky over 8 years ago

  • Pull Request set to https://github.com/Normation/rudder-techniques/pull/757
Actions #7

Updated by Janos Mattyasovszky over 8 years ago

Related to #7282

Actions #8

Updated by Anonymous over 8 years ago

  • Status changed from Discussion to Pending release
  • % Done changed from 0 to 100
Actions #10

Updated by Vincent MEMBRÉ over 8 years ago

  • Category changed from Agent to System techniques
  • Target version changed from Ideas (not version specific) to 2.11.16
Actions #11

Updated by Vincent MEMBRÉ over 8 years ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 2.11.16, 3.0.11 and 3.1.4 which were released today.

Actions #12

Updated by Vincent MEMBRÉ over 8 years ago

  • Status changed from Released to Pending release
  • Target version changed from 2.11.16 to Ideas (not version specific)
Actions #13

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version deleted (Ideas (not version specific))
Actions #14

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version set to 2.11.16
Actions #15

Updated by Jonathan CLARKE about 8 years ago

  • Related to Bug #7782: inventory sent file timestamp not updated in normal run (system techniques) added
Actions #16

Updated by Jonathan CLARKE about 8 years ago

  • Status changed from Pending release to Released
Actions

Also available in: Atom PDF