Nagios Graph - Action URL to include "*%2Cdata"

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Nagios Graph - Action URL to include "*%2Cdata"

Post by gshergill »

Hi Nagios Community,

So I decided to set up Nagios Graph and everything installed/works fine.

I added an action_url to a service template so I can check a service's graph in one simple click. However, this wasn't the case...

The graphs themselves are great, but clicking the action_url displayed all the graphs for the service (day, week, month, year) and the data on the graph was quite a lot.

I changed the action_url to below:

Code: Select all

action_url /nagios/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&expand_period=day,week' onMouseOver='showGraphPopup(this)' onMouseOut='hideGraphPopup()' rel='/nagiosgraph/cgi-bin/showgraph.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&period=week&rrdopts=-w+450+-j
The change being adding:

Code: Select all

&expand_period=day,week
This leads to the URL below, which hides Month/Year:
http://nagios_ip/nagios/cgi-bin/show.cgi?host=<HOST>&service=<SERVICE>&expand_period=day,week

But the graphs are still a bit cluttered... it shows crit, data, min and warn all at once. I tried to customise the URL to only show data by changing it to below:

Code: Select all

action_url /nagios/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&expand_period=day,week&db=*%2Cdata
The reason for using "*" instead of, for example with bandwidth usage, "db=out%2Cdata" is because it changes with nearly every service and I was hoping that "*" would mean anything preceding the word data, which of course it doesn't seem to.

So my question is:
Is there any symbol I can add to a config file line, such as action_url, which means "anything"? Or is the only option here to create multiple templates each with their own action_url, changing based on the "db=......%2Cdata" in question?

Hope that made sense.... I can post some examples if you need.

Thank you.

Kind Regards,

Gary Shergill
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios Graph - Action URL to include "*%2Cdata"

Post by abrist »

The action url is just a url with the interpreted macros replaced. Unfortunately, as wildcards are not supported in standard urls, neither are they supported by the action url.
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
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Nagios Graph - Action URL to include "*%2Cdata"

Post by gshergill »

Hi abrist,

Thanks for the reply, had a feeling wildcards (couldn't remember that word!) wouldn't work =(

Any chance a workaround is known?

Thanks.

Kind Regards,

Gary Shergill
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios Graph - Action URL to include "*%2Cdata"

Post by abrist »

Could you post a specific example? You might be able to use macros/free variables to get some of the functionality you are looking for. But I think I need a real world use case to help me conceptualize what you are looking for.
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
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Nagios Graph - Action URL to include "*%2Cdata"

Post by gshergill »

Hi abrist,

Sure, here a few URLs for %2Cdata:

Code: Select all

http://<nagios-ip>/nagios/cgi-bin/show.cgi?host=brains&service=PING&expand_period=day,week&geom=1000x200&db=rta%2Cdata

http://<nagios-ip>/nagios/cgi-bin/show.cgi?host=brains&service=Memory%20Usage&expand_period=day,week&geom=1000x200&db=Memory%20usage%2Cdata

http://<nagios-ip>/nagios/cgi-bin/show.cgi?host=brains&service=CPU%20Load&expand_controls&expand_period=day,week&geom=1000x200&db=10%20min%20avg%20Load%2Cdata
Please ask if you need some more.

Thank you.

Kind Regards,

Gary Shergill
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios Graph - Action URL to include "*%2Cdata"

Post by abrist »

Essentially, you are trying to eliminate the warn/crit/min/max lines/data from the graphs so that the graph just includes the data?

I was thinking you might be able to use db=$SERVICEDESC$%2Cdata, but not all of the graphs are consistent with that naming convention. . .

You may be stuck with templates as that is the *intended* implementation method. I will think about this some more though.
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
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Nagios Graph - Action URL to include "*%2Cdata"

Post by gshergill »

Hi abrist,

I'm not able to check at the moment, but wouldn't that only work for Memory Usage from the below examples? Others would just say:

Code: Select all

db=PING%2Cdata
Which would be an error, because it is not in that format?
Essentially, you are trying to eliminate the warn/crit/min/max lines/data from the graphs so that the graph just includes the data?
Yeah I just want to display the data and remove the warn, crit, min and max lines because most the time the crit and min are far from each other, so I can't actually see the real data properly...

Thank you, in the mean time I'll have a look as well, might be something which refers to a service's current data.

Kind Regards,

Gary Shergill
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios Graph - Action URL to include "*%2Cdata"

Post by abrist »

gshergill wrote: I'm not able to check at the moment, but wouldn't that only work for Memory Usage from the below examples? Others would just say:
db=PING%2Cdata
Yeah, that was my concern, I thought I would mention it though as it was one of my ideas. The problem is that some of the metrics get the service description while others have a different label. I will run through possible solutions with my coworkers over lunch here. Report back if you get any inspiration as well.
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
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Nagios Graph - Action URL to include "*%2Cdata"

Post by gshergill »

Hi abrist,

One thing I tried using was $SERVICENOTES$, which works if I put the "notes" in the service definition as the required %2Cdata, but that might get a bit complicated as there are a number of services per core machine (although this is preferable to simply creating a load of templates).

Of course a problem arises with the fact that the notes are displayed on the web page when looking at a service which could seem a bit odd... e.g. It would randomly display, for example, "rta" or "pl" for ping services.

Any luck on your side? I've check through the macros and there doesn't seem to be anything related to this kind of data.

Thank you.

Kind Regards,

Gary Shergill

EDIT: I'm running 3.4.1 if that's a problem? Can upgrade if required, don't see it causing any problems...
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios Graph - Action URL to include "*%2Cdata"

Post by abrist »

No luck on my side either. I will ask the big guns tomorrow, but this one is a real stumper.
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.
Locked