I'm performing some custom logic where my user commands are using a shell script on disk. So a typical command would look like
Subject: |
RE: Getting username in user commands |
Author: |
Michael De Simone |
Posted: |
2018-12-13 09:29 |
You can use ${dev/zCommandUsername} to get the userid Zenoss is using to ssh to the device. I think that's what you are looking for. If you are just executing the commands on the Zenoss server, everything is run as the zenoss user.
------------------------------
Michael De Simone
Zenoss
------------------------------
/bin/sh /var/zenoss/command.sh actionX ${device/id}
In my command.sh script for example, actionX is $1, ${device/id} is $2.
This is a very custom setup where we are doing some custom work to execute commands on devices. This is working for us right now.
I would like to be able to catch the user id of the user who performed this command in the same script. So my command would now look like:
/bin/sh /var/zenoss/command.sh actionX ${device/id} ${user/id}
(if there is such a thing)
------------------------------
Jad
------------------------------
Subject: |
RE: Getting username in user commands |
Author: |
Jason Olson |
Posted: |
2018-12-13 10:56 |
Further to that, if the command is run from within Zenoss, the username and password is defined in the zCommandUsername and zCommandPassword properties, which make for a generic command ID and not who initiated the command within the application. I suspect you're looking for an audit trail, which doesn't exist in the community edition. You'll need to purchase a subscription to Resource Manager to get that.
------------------------------
Jason Olson
------------------------------