Hello,
I already asked if it's possible to use a 'user' macro, so we can pass the user initiating the event chain to scripts for logging etc. https://support.nagios.com/forum/viewto ... actor+user where TASK ID 5801 was created by Sean.
But now I have the same question for Nagios XI. I don't see an existing macro in the actions component documentation for the Nagios user initiating an action. As we have multiple actions where we need to know who initiated the action, I was wondering if it is already possible to somehow retrieve the user initiating the action in Nagios XI.
If not, please let me know, then I'll create a feature request for this.
Grtz
Willem
User macro for actions component
User macro for actions component
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: User macro for actions component
Looks like it would be possible:
If you edit:
And add (around line 973):
So it looks like:
Then at around line 1050 as well:
Then you could use %username% in the action URL and it would work for you.
I've also submitted a feature request for it:
If you edit:
Code: Select all
/usr/local/nagiosxi/html/includes/components/actions/actions.inc.phpCode: Select all
"username" => "$_SESSION[username]",Code: Select all
$objectvars = array(
"objecttype" => "host",
"username" => "$_SESSION[username]",
"host" => $hostname,Code: Select all
$objectvars = array(
"objecttype" => "service",
"username" => "$_SESSION[username]",
"service" => $servicename,Code: Select all
http://my.test.url/do_the_thing/?servicename=%servicename%&username=%username%Code: Select all
NEW TASK ID 6244 created - Nagios XI Feature Request: Add the ability to use %username% in the actions componentRe: User macro for actions component
Sean,
It seems to work, but there is something weird. I set "Nagios - %username%" in the Comment field in the Actions component. After Saving the actions, the field appears to be empty again. When executing the chain, it does seem to work however. if I set just Nagios - %username% (without the double quotes, it does show.
Anyway it works. This particular use case I implemented it for was an event chain to initiate a VMware snapshot by the way. By providing the username, our VMware admins can easily see who created the snashot. i'll see if I can find some time to release these scripts on the Nagios Exchange.
If one day we could provide field values in the Reactor action popup window, it would be perfect, then our sysadmins can also provide the reason for the snapshot for example. See https://support.nagios.com/forum/viewto ... t=+reactor
Have a nice day and thanks alot.
Willem
It seems to work, but there is something weird. I set "Nagios - %username%" in the Comment field in the Actions component. After Saving the actions, the field appears to be empty again. When executing the chain, it does seem to work however. if I set just Nagios - %username% (without the double quotes, it does show.
Anyway it works. This particular use case I implemented it for was an event chain to initiate a VMware snapshot by the way. By providing the username, our VMware admins can easily see who created the snashot. i'll see if I can find some time to release these scripts on the Nagios Exchange.
If one day we could provide field values in the Reactor action popup window, it would be perfect, then our sysadmins can also provide the reason for the snapshot for example. See https://support.nagios.com/forum/viewto ... t=+reactor
Have a nice day and thanks alot.
Willem
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: User macro for actions component
Hmm, it's working for me in all the fields which field are you talking about, I don't see a comment field. Do you mean the command field? Can you send me a sanitized screenshot or paste the text with the field name?
Re: User macro for actions component
I'm sorry if I wasn't clear. The comment field is a field from my "NAF - Initiate VMware Snapshot" event chain. See screenshot.
You do not have the required permissions to view the files attached to this post.
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: User macro for actions component
I believe we are running into the same type of bug as this (that we submitted earlier):
https://support.nagios.com/forum/viewto ... 54#p143154
https://support.nagios.com/forum/viewto ... 54#p143154
Re: User macro for actions component
That is possible Sean. Although I thought this other issue was solved. Anyway this thread can be closed. Tx!
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: User macro for actions component
Thanks for the feedback, Willem. I'll close this one.WillemDH wrote:That is possible Sean. Although I thought this other issue was solved. Anyway this thread can be closed. Tx!
Former Nagios Employee.
me.
me.