Downtime: Can't remove downtime on service with a 'slash' in the service name
Closed this issue · 27 comments
I will look at it.
Indeed, I just saw the source code, in shinken-actions.js
we split the element name on the /, because it is supposed to be the element of separation between the host name and the service name.
Right now I can't think about a nice fix, because if we admit / are allowed in hosts or services names, the / could be everywhere.
I think you should really avoid having / in service names.
I'm curious @serge-marie, is it the only thing that don't work in the webui? Everything else is OK with the /?
@maethor : a solution would be to use another separator in the HTML built with the templates. Let's say host_name$service_description
and then split on $
rather than /
In helper.py:
def get_uri_name(self, elt):
name = elt.get_name()
if 'service_description' in elt:
name = "%s$%s" % (name, elt.get_name())
return name.replace(' ', '%20')
This function is supposed to be called for each parameter from Python to Javascript ... I hope so :)
I suppose it is used almost everywhere, but not in shinken-actions.js
get_elements
function.
And what if some users have services with $ in them?
As far as I remember, $ is not allowed in a service description.
See illegal_object_name_chars
that defines the non-authorized characters in objects names is as default: ``~!$%^&*"|'<>?,()=`
oh, that's nice. So | may be ok too…
I will see if I can replace it in all the app.
It seems like after some macros and replacements, the command sent by the WebUI to shinken uses ;
to separate the host and the service:
4807:[1496236089] INFO: [broker-master] [WebUI-actions] got command: SCHEDULE_SVC_DOWNTIME with args: ['www.sysnove.fr', 'Http', '1496236080', '1496408880', '1', '0', '0', 'admin', 'Downtime scheduled from WebUI by admin'].
4808:[1496236089] INFO: [broker-master] [WebUI-actions] external command: [1496236089] SCHEDULE_SVC_DOWNTIME;www.sysnove.fr;Http;1496236080;1496408880;1;0;0;admin;Downtime scheduled from WebUI by admin.
So I don't understand why ;
is the only character not listed in your list @mohierf 😄
Yet I'm not sure to understand how it how it works, because I don't see where that ;
is defined. But I will find it.
So ;
should be a pretty good character to use, since it's what shinken is using?
Beware @maethor that the ;
is the Nagios legacy separator for the external commands. It is not forbidden to use it but it is a Nagios trick 😉 Never use this character in a service_description or forget the external commands ...
See action.py, line 100 where an ExternalCommand is built to be push to the broker that runs the WebUI module ...
OK, I see it no, in the try catch.
So, that's exactly what I'm saying, ;
is already forbidden in host_name and service_description, so I can use it as a separator instead of /
.
Anyway, if you think $
is the better choice, let's use it 😄
What I find strange is that you succeed to put a downtime, but not to remove it. I will try to reproduce this bug tonight.
So it doesn't seem to come from the /. Everything is working fine on my test : ack, downtime, remove downtime, remove ack.
- @serge-marie can you precise exactly how to reproduce your problem?
- Is it the only thing that don't work in the webui?
- Everything else is OK with the /?
- What is the exact version of your webui?
You can answer in french if that's easier for you.
@mohierf OK, so now I think I understand the mecanics between shinken-actions.js and action.py. It's really ugly, I mean… it's awful… but I don't see any bug in it. /
in service names seems to be managed properly.
- The first
/
is kept, but the nexts are replaced by$SLASH$
in shinken-actions.js/get_elements function - Then in action.py, the
/
is replaced by;
, and then$SLASH$
are replaced by/
.
I could rewrite that, but if it's working…
I have a question. Do you this /
should be also possible in host_name? I really don't think shinken core can manage that.
@serge-marie if you have the possibility to upgrade to develop, I think you should try to reproduce the bug on it. If not, please answer my questions, yes :)
Good night ;)
I'm sorry but your image doesn't display. Could you please respond directly on github?
Hi,
This is my webui version :
This is how I can reproduce the problem :
I have an host :
I use "Select all elements" -> "Execute an action" -> "Schedule a downtime".
I have :
Services are "downtimed" :
I remove the downtime with "Click on hostname" -> "Delete all downtimes"
I have :
And when I refresh the page, downtimes on services are always set :
Only the downtime on the host is removed :
If I remove downtime on each service with the button "" at the right of the service.
When I do it on a service without a "/" in the name, it's working :
And the downtime disappears.
But on a service with a "/" in the name (the first one only) I have the same window but the downtime is still here after click.
After that, on another service with a "/" I have also : (on the same service too)
After all the click :
All downtimes on those services are still presents ...
I hope that is helpfull for you to understand my problem.
Serge
I forgot to precise that we use mongodb-dt-ct-retention-scheduler module.
For data retention of comments and downtimes.
Ok, so you are still on 2.4.2c and you describes 2 differents problems that I I have found and fixed in 2.5:
- When we add a downtime on a host, by default the downtime is added on all the services. But when you remove the downtime, it is removed only on the host. This is fixed.
- The problem with the / in the service name. This is fixed.
2.5 is not published yet. I still have a major regression to fix and then I will publish it. I can't give you a deadline, could be a week or two.
@serge-marie As promised, I published 2.5.0 today. It should be available tomorrow on shinken.io. Please close this issue if the new version is fixing your problem.