Hashtag preventing graph Explorer graphs from loading

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
meganwilliford
Posts: 101
Joined: Tue Aug 06, 2019 7:49 am

Hashtag preventing graph Explorer graphs from loading

Post by meganwilliford »

Hello,

I think I've gotten to the bottom of why the multistacked performance graphs will not load for some hosts but I have no idea how to get around it.

We use a # as an indicator in the host name of some of the hosts we monitor. Come to find out, I think it is preventing multistacked performance data to load. This is not an issue with the normal performance graphs, only the graphs in the graph explorer.

The hosts are collecting and are reporting performance data, it just will not load in the graph explorer. Is there a way to get it to load while keeping the # in front of the server name?

I've attached two pictures with what I'm talking about. Same server is used in both examples. First example the # exists before the host name. Second example I removed the # and the data populates.
withhash.png
withouthash.png
You do not have the required permissions to view the files attached to this post.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Hashtag preventing graph Explorer graphs from loading

Post by gsmith »

Hi,

Go to Configure, Core Config Manager. click on Hosts, and then change the "Host Name" field:
Image1.jpg
Save it, Apply Configuration.

Please let me know how things turn out.

Thanks
You do not have the required permissions to view the files attached to this post.
meganwilliford
Posts: 101
Joined: Tue Aug 06, 2019 7:49 am

Re: Hashtag preventing graph Explorer graphs from loading

Post by meganwilliford »

Hi, we use # as an indicator. It is intentionally in front of the host name and do not want to remove it from the host name. Is there a way to get the performance data to load while keeping the # in front of the host name?
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Hashtag preventing graph Explorer graphs from loading

Post by gsmith »

Hi,

There isn't a way to get the host performance data with a leading "#".

Could you use some other indicator? I jut tried _#hostname and it looks like it works.

Could you tell me how you are using it as an indicator in case there is already some functionality
that can do this?

Thanks
meganwilliford
Posts: 101
Joined: Tue Aug 06, 2019 7:49 am

Re: Hashtag preventing graph Explorer graphs from loading

Post by meganwilliford »

We have a ServiceNow integration set up to ingest the objects/statehistory api data and process into events. There are some scenarios we don't want ServiceNow to process events for. There is a rule on the ServiceNow side to ignore host events with a # in front. Is there a way to optionally ignore objects/statehistory data? We had no luck, hence the #.
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Hashtag preventing graph Explorer graphs from loading

Post by gsmith »

Hi,

I think I found a way!

If you want a host ignored put something in the alias field, say "no servicenow"
Image10.jpg
Image11.jpg
Now in your API request add "customvars=1"

Code: Select all

 curl -XGET "http://192.168.23.82/nagiosxi/api/v1/objects/servicestatus?apikey=224nEJb8u3ANILBsvlSpnr6fa0JhdVAj5lLfgFkUbrNcAOCWiUri8Nm9L0ceSVin&customvars=1&pretty=1
"

The result is something like:

Code: Select all

        },
        {
            "host_name": "192.168.23.81",
            "service_description": "ens160 Bandwidth - Outbound",
            "display_name": "ens160 Bandwidth - Outbound",
            "host_object_id": "193",
            "host_address": "192.168.23.81",
            "host_alias": "no servicenow",
            "icon_image": "",
            "icon_image_alt": "",
            "notes": "",
Now instead of keying off the host name, have servicenow look at the alias field to decide if it should
process the event.

Please let me know how this works for you.

Thanks
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Hashtag preventing graph Explorer graphs from loading

Post by ssax »

This looks like a bug.

# is not listed in the illegal object name chars so it should be available for use:

Code: Select all

illegal_object_name_chars=`~!$%^&*|'"<>?,()=

Please edit this file:

Code: Select all

/usr/local/nagiosxi/html/includes/components/graphexplorer/graphexplorer.js
Change this (around line 88):

Code: Select all

        host = v.host.replace(/ /g, "_");
        service = v.service.replace(/ /g, "_");
To this:

Code: Select all

        host = encodeURIComponent(v.host.replace(/ /g, "_"));
        service = encodeURIComponent(v.service.replace(/ /g, "_"));
Then clear your browser cache or try to shift+reload the web page and let us know if that resolves your issue.
meganwilliford
Posts: 101
Joined: Tue Aug 06, 2019 7:49 am

Re: Hashtag preventing graph Explorer graphs from loading

Post by meganwilliford »

@gsmith, thanks so much for the alias tip! We will definitely explore using that option in the future.

In the meantime, the trick @ssax gave worked like a charm!

I really really appreciate your help.

You can close this post!