We have some files that the user needs to access on some agents but not others. As such we do not want the sync process to run for these files across the cluster. I believe you can upload these to a specific element if required:
However, we would like to edit some pre-existing documents that were uploaded either on the backend or through the main Documents section. This would be from "All" to "<Agent Name>", but for others, there may be interest of moving between two elements/agents.
- Where is this "Hosting Agent" property stored?
- Is it possible to edit this property retrospectively (without deleting and re-uploading the file)?
- If a file is stored on an agent over 20MB, does it sync to its failover partner? If so, is there a way to suppress the notice?
- We have a script which uploads a file to this folder - is there an argument/preset that can be used to specify the Hosting Agent rather than "All" (I understand this is based on our custom code, but maybe someone else has written a driver to do similar)?
Any answers to any of the above will be greatly appreciated
Hey Jack,
Thank you for the questions, we will try to answer them to the best of our ability.
Before we start with the questions, lets first review the types of documents. DataMiner supports 3 types of documents (Global, Protocol and Element). Both the Global and Protocol are synced in the cluster whilst the Element one is kept with the element folder. This means that a Document is not tied to an agent (see DataMiner help).
- This property is not stored in the sense that it saved in a database or a configuration file, rather it gets resolved based on where the document is saved. For documents that have hosting agent "all" these are saved under C:\skyline dataminer\documents folder, so each file in this folder will have the property All. Other documents are tied to an element, they get saved with the specific element under C:\skyline dataminer\elements\<elementname>\documents. These documents will take the agentname of the hostingAgent of that element.
- As stated before as this property is resolved based on what type of document it is, and where it is stored, it is not possible to change this property. However in the case of Element documents, DELT-ing/migrating the element will change it.
- The DMA will attempt to sync these, however this will fail and the error will be logged. There is no way to suppress this notice but you can increase this threshold in the MaintenanceSettings.xml (See Document.MaxSize).
- To send a document to all the agents you use a "AddDocumentMessage". To upload a document for a specific element (and thus to a specific DMA) you use the "AddElementDocumentMessage" and fill in the correct DataMinerID of the Element hostingAgent and the element-name (see example below)
![](https://community.dataminer.services/wp-content/uploads/wp-user-manager-uploads/2021/01/IMG_20200303_1234431-1.jpg)
Hey James,
I used the following snippet of code to make this work
public class Script
{
public void Run(Engine engine)
{
var fi = new FileInfo(@”c:\test\testFile.txt”);
var Element = engine.FindElement(“Basic”);
fi.CopyTo(String.Format(@”C:\Skyline Dataminer\elements\{0}\Documents\{1}”, Element.ElementName, fi.Name));
var adm = new AddElementDocumentMessage(){
DataMinerID=Element.DmaId,
Element = Element.ElementName,
FileName =fi.Name,
HostingDataMinerID=Element.DmaId};
engine.SendSLNetSingleResponseMessage(adm);
}
}
With this snippet of code on my machine the file got copied and added to the view in cube (without refreshing). What version are you testing this on?
Hey Brent,
Using your Syntax, I was able to get the files to update correctly, however the hosting agent is still set to “All”, is there any way to have it set to the local agent through this method?
Cheers
Hi Brent,
I’m trying to implement this through an automation script. Do element documents support folders? I can copy a folder containing files (A) to the element document folder (B). However, even after sending an AddElementDocumentMessage() for each file in that subfolder, the element document folder (B) remains empty, despite the files existing on the machine. I also tried just using files (A) without a subfolder, but these also do not show up. Uploading a file manually through the UI seems to refresh dataminer and show the files, so I think the issue lies in the AddElementDocumentMessage call.
Any help is greatly appreciated, cheers.