xM Agent breaks writeFile() function

Not Yet Reviewed

I'm running into a weird problem here. We have a server which has the xM Agent on it. It's got a bunch of Node Scripts which ping the API and generate reports. 

Once those reports are complete, it saves them as CSV files to a LAN folder, which exists outside of the server.

Problem is, when I run the scripts locally from the server (log into server remotely and manually execute from cmd line), it runs without issue and even saves to the LAN folder in question.

If I do the same exact thing, except this time execute the script via a Shell script from Flow, it will not save to the LAN folder. At first I thought maybe it wasn't being called at all, so I changed the destination to be local to the server, ran it again and it was in fact working. It was generating the report and saving it locally on the server if executed via xMatters but will not do it when the destination is the LAN folder.

Any ideas on what could be causing this? I don't even really know where to begin on debugging it as I am not much of a network guy so even an idea of where to begin looking could be helpful. 




Date Votes

Please sign in to leave a comment.

  • My first thought would be to checking the permissions. Perhaps your account (used when you log into the server and manually execute) has permissions to save to the LAN folder in question, but the account Flow/xM Agent is using does not have that same permission?

  • I would agree with Sean to check on the permissions. Can you share more details about the environment? I think you mentioned this is a windows machine? How is the folder shared? What happens if you execute a copy command to the LAN folder after the script runs?

    I'll harass the engineers and see if they have any ideas. 

    Happy Wednesday! It is Wednesday, right? Sure. 

  • Oh, and what is the path you are using to write to? I'm wondering if it is a string escape issue.

    EDIT: Oh, I see it works if you execute the script without the agent. So that might not be it. 

  • I got an update from the engineers. Can you check out:

    • The permissions on the LAN folder
    • The permissions on the xAgent folder

    I think it also might be good to print the results of the whoami command in the agent script and again when you execute the nodejs script and compare the results. I'm pretty sure this is related to permissions or account the agent is running as. 


  • Michael,

    I am following this topic and hope you can resolve it. I am also interested in the information you are including in the reports.

    If there is information not available from the UI that we have to generate reports for, it would be useful to gather that and present it to xMatters. Some information I would like to be able to get in the UI includes:

    1) Users who are not a member of any group

    2) Groups with gaps in shifts

    3) Groups with overlapping shifts

    4) Groups without a roster

    5) Groups and their supervisors

  • Colum, thanks for the follow up post. Our product team would like an opportunity to talk with you about these specific items. One our xPerts will reach out to set up a convenient time.

  • Apologies for the super late reply, this got lost in the shuffle. As it turns out, it had to do with permissions and access. Something I thought I had configured properly but ultimately fell short. Once I solved that, all the problems went away and it's been smooth sailing since. Thanks again!


Didn't find what you were looking for?

New post