Custom Quick Actions

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Custom Quick Actions

Post by WillemDH »

Hello,

Remember I wrote some Powershell script that installs the NSCP Agent on a Windows server? http://support.nagios.com/forum/viewtop ... l&start=10

This is working fine in the meantime, but I have a new issue popping up as we have more and more endusers wanting acces to the Nagios data.

So I made an account with read-only permissions that has only acces to four hosts, but it seems the quick actions that link to the Powershell scripts are also shown for users with read-only permissions. This is really not acceptable, as I don't want endusers to start re-installing NSCP, updating nsclient.ini etc...

Is there a way to prevent my actions to show up in the quick actions of 'users'. Ideally they should only show up on the quick actions of users with admin permissions.

Thanks for any feedback. Let me know if I should make a feature request.

Grtz..

Willem
Nagios XI 5.8.1
https://outsideit.net
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Custom Quick Actions

Post by lmiltchev »

It's a good idea for a feature request for the "Actions" component. It would be nice to be able to limit who can view custom actions, based on the user's type, regex filtering, etc. I already filed an internal feature request. You are welcome to file another one on the public site if you wish.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Custom Quick Actions

Post by BanditBBS »

fully agree this is a needed feature. I have a hack for you WillemDH, look here: http://support.nagios.com/forum/viewtop ... 135#p82915

I did that to remove "disable notifications" but you could put in there the is_admin() or is_advanced_user() and only display something for the advanced users and/or admins.

keep in mind, you will have to redo this "hack" any time you perform an upgrade.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Custom Quick Actions

Post by WillemDH »

Feature request made => http://tracker.nagios.com/view.php?id=509

I'll try that Bandit, thanks for the tip.
Nagios XI 5.8.1
https://outsideit.net
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Custom Quick Actions

Post by slansing »

Thank you for the submission, let us know if the "hack" works out for you in the meantime.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Custom Quick Actions

Post by abrist »

I updated the internal bug report to include your hack bandit.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Custom Quick Actions

Post by WillemDH »

For ajaxhelpers-hoststatus.inc.php I suspect I would need to change the following:

Code: Select all

		
		$cbdata=array(
			"hostname" => $hostname,
			"host_id" => $host_id,
			"hoststatus_xml" => $xml,
			"actions" => array(),
			);
		do_callbacks(CALLBACK_HOST_DETAIL_ACTION_LINK,$cbdata);
		$customactions=grab_array_var($cbdata,"actions",array());
		foreach($customactions as $ca){
			$output.=$ca;
			}

For ajaxhelpers-servicestatus.inc.php

Code: Select all

		$cbdata=array(
			"hostname" => $hostname,
			"servicename" => $servicename,
			"service_id" => $service_id,
			"servicestatus_xml" => $xml,
			"actions" => array(),
			);
		do_callbacks(CALLBACK_SERVICE_DETAIL_ACTION_LINK,$cbdata);
		$customactions=grab_array_var($cbdata,"actions",array());
		foreach($customactions as $ca){
			$output.=$ca;
			}
Where exactly should I put is_admin() or is_advanced_user() ?
Nagios XI 5.8.1
https://outsideit.net
User avatar
BanditBBS
Posts: 2474
Joined: Tue May 31, 2011 12:57 pm
Location: Scio, OH
Contact:

Re: Custom Quick Actions

Post by BanditBBS »

You would wrap an is_admin around there somewhere...but it will affect ALL custom actions.

Something like this:

Code: Select all

if is_admin() {
      $cbdata=array(
         "hostname" => $hostname,
         "servicename" => $servicename,
         "service_id" => $service_id,
         "servicestatus_xml" => $xml,
         "actions" => array(),
         );
      do_callbacks(CALLBACK_SERVICE_DETAIL_ACTION_LINK,$cbdata);
      $customactions=grab_array_var($cbdata,"actions",array());
      foreach($customactions as $ca){
         $output.=$ca;
         }
}
Make a backup of the file and give it a shot...or better yet, if you have a dev server do it there :)
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Custom Quick Actions

Post by lmiltchev »

We will do some testing on our end and will keep you posted.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Custom Quick Actions

Post by WillemDH »

Well I still didn't find the time to setup a test server :| I fear it will take some time before I can find some time.
But I'll wait for the results of the test by lmitchev..

Grtz..
Nagios XI 5.8.1
https://outsideit.net
Locked