Switch port status

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
devildog31415
Posts: 48
Joined: Thu Jun 12, 2014 10:55 am

Re: Switch port status

Post by devildog31415 »

You are awesome.. it works.
Now I just need to test across a port of each possible type and then get your advise on how to make a mass change to 700 ports to use this new check :)

More to follow.
devildog31415
Posts: 48
Joined: Thu Jun 12, 2014 10:55 am

Re: Switch port status

Post by devildog31415 »

It now works.
I need to change, for several switches, the "check command" and the value of "$ARG3$ from "-v 2" to just "2".
See attached.

Suggestions?
You do not have the required permissions to view the files attached to this post.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Switch port status

Post by tmcdonald »

That... is a bit trickier. The problem with args is that they are all very specific to the plugin you are using, the command that runs the plugin, and the specific service. You can't easily make a blanket change to the args without breaking a lot of services. If you have a common template they all use you could try to edit the template, but then *anything* using that template will inherit the new changes. Further, whatever you have specified at the service level will overwrite anything in a template, so if that is the case they will need to be changed per service.

Historically this has been a problem that gets harder to solve the longer it is around. If you have to manually edit 5 things it's not a problem, but once you get into the 50+ range...

Technically this could probably be done with some custom SQL commands, but that is dangerous dangerous territory and not something I would do outside of a remote session with a ton of testing and planning.
Former Nagios employee
devildog31415
Posts: 48
Joined: Thu Jun 12, 2014 10:55 am

Re: Switch port status

Post by devildog31415 »

TWo things:
1) are you saying chagning the command is hard also or just the ARG, because I would like to know how to change the command if that is easier?
2) Can you tell me how to query for all $ARG3$ that are set to "-v 2" so that I can review and see if they all belong to switch services with the word "status" in the name?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Switch port status

Post by slansing »

I believe what Trevor was saying is that you can indeed change the command, but it may be easier to create a template, or create a duplicate command with a different name before you do so. Editing any of the xi_commands could be dangerous as they are commonly used by wizards, so once you change that command at it's heart, the wizards will use it regardless, and may not accept the hard coded changes you make.
devildog31415
Posts: 48
Joined: Thu Jun 12, 2014 10:55 am

Re: Switch port status

Post by devildog31415 »

I suspect I'm missing something. I don't want to "modify" a command. I want to replace what specific command is tied to an already existing service.
Please note the screenshot I attached, 2 posts ago.. I just want to replace the 2 things circled in red on 500-700 existing service checks.
I have no desire to modify an already existing xi command.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Switch port status

Post by tmcdonald »

devildog, I think we are on the same page and slansing needs coffee :)

Changing what command is used is possible, but then you need to change the args as well and that is harder. If you know for certain that each service will need to same exact command and args it's a piece of cake. But as soon as you need different args (maybe a new SNMP string or something) then it gets messy. This is something we will need to look into, as it is a feature I believe should be in XI but is just not an easy fix.
Former Nagios employee
devildog31415
Posts: 48
Joined: Thu Jun 12, 2014 10:55 am

Re: Switch port status

Post by devildog31415 »

What would be the next step?
What can I do to "help you.... help me"? :)
devildog31415
Posts: 48
Joined: Thu Jun 12, 2014 10:55 am

Re: Switch port status

Post by devildog31415 »

I modified my sw.....cfg file and did a find/replace on all instances of the xi command to my custom command and also changed all instances of "-v 2" to "2" and it is working fine.

Thank you!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Switch port status

Post by tmcdonald »

A few things to point out here:

1.) As soon as you do any Apply Config from the Core Config Manager, those changes could go away. As of 2014R1.2 an Apply Config will overwrite any changed config files (as opposed to the old method where it overwrote them regardless). So even if you just change one config option the others that you made to the .cfg files will be blown away.

2.) I would be careful with making global changes that way, as some other plugins might have a "-v 2" switch for other reasons, or a different service might run the same plugin and still need that switch and it has now been changed to just "2". And as above, any changes in the CCM will overwrite this.

Like I said before, this is a change that needs to be done carefully and with some forethought. It can be done, but it might not be one easy step. Let me get back to you in a bit and we can discuss it more.

Update: A better solution if you are comfortable working on the CLI (which it seems you are) is to do a very precise replace like you did (making sure to only change what needs to be) and copy out those new configs to a /tmp directory. Then delete the existing services in the CCM and follow this guide to re-import the changed configs:

http://assets.nagios.com/downloads/nagi ... ios-XI.pdf
Former Nagios employee
Locked