Page 1 of 1

HowTo : Change service name in host

Posted: Fri Feb 09, 2018 9:53 am
by Aezox
Hi community !

I'm new here and I hope this topic has not been already posted :)
I'm trying to change a service name in a specific host.
I'm trying to use macros or variable but I cannot manage a success on this :(

I explain the situation :
I have a standard service with variables inside that will monitor a specific component on a host.
This service is defined in a hostgroup which is defined in a host.
In the host free variables I set the variables of my service to return me the component I want.
Until this everything works wonderfully.

My service description has a standard name that is not very talkative to my users when it appear in the dashboards.
What I want is to keep the standard service description for the admin part. And on the other hand that the service name is equal to a variable defined in my host to display on the dashboard.
Please see attached file for explanation

I hope I've been understood :)
Feel free to ask me for more explanation
Thy in advance for your help

Re: HowTo : Change service name in host

Posted: Fri Feb 09, 2018 2:37 pm
by npolovenko
Hello, @Aezox. Can you take a screenshot of the whole page? I have some trouble figuring out which dashboard it is. So you have a service check, and you want it to be called one name when logged in as an admin user, and a different name when logged in as a non-admin user?
Are you trying to use a macro inside the service name field? That is not going to work.
Can you also upload the host definition, the service check definition?

Re: HowTo : Change service name in host

Posted: Mon Feb 12, 2018 4:01 am
by Aezox
Hello @npolovenko ,

Thank you for your reply ! I've linked a full definition of how my service is working and called out.
mqstest_def.jpg
So, my service is calling a script on the host server ; inside the service definition you have a standard name used for admin users. It is using variables in the $ARG2$ which are defined in the host free variables". This service is assigned to a hostgroup.
Then ; in my host definition I point to this hostgroup which will call for the service. In "Misc Settings" of my host I define the variables and their value in the "Free Variable" window.
On the middle-right part of the screenshot is the service status screen of my host ; what I want is to rename the service name "AG: MQS Queue Test" to the name of the variable defined in the host (the green part in the "Status Information" cell) or a custom name. By doing this my users will be able to know what is been monitored behind this service.
I've tried unsuccessfully with the macros and I found out later this it was not possible.
I know my demand is a bit tricky :)
Thanks in advance for your help
By the way, I'm using Nagios XI 5.4.9

Regards,

Re: HowTo : Change service name in host

Posted: Mon Feb 12, 2018 12:33 pm
by npolovenko
Well explained, @Aezox. Unfortunately, Service Name, also known as Description is pretty much a static entry in MySQL. Meaning it get's assigned only once when you create a service check. So yes, macros wouldn't work. The only way I could think of is to write a custom script that will run a check, cut out a part of the returned "Status Information" with the service name in it and create a new service with that name. It will be a custom Configurations Wizard at this point.

Re: HowTo : Change service name in host

Posted: Tue Feb 13, 2018 4:44 am
by Aezox
Thank you for your reply @npolovenko ! I will try this when I can :)
I'll give feedback on this post if you are interested in it
Thanks anyway for your help

Re: HowTo : Change service name in host

Posted: Tue Feb 13, 2018 10:30 am
by tmcdonald
We will keep this topic open - please only reply if you have more to add or if you wish us to close the thread.