Skip to end of metadata
Go to start of metadata

Table of contents

Disclaimer

THE CODE ON THIS PAGE IS PROVIDED BY INTERNET2 ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTERNET2 OR
THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS CODE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Description

The plugin could be kind of nasty depending on how familiar you are with
programming.  The more of a programmer you are, the more nasty it might
look so I apologize since my background is not in programming and I only
do so on a need-be basis.   

This is not a step by step guide on how to implement the plugin, but a
guide to the files and execution procedure.  All the file included are
RTF files so they can just be opened, but will need to rename them
accordingly.  If you have questions, please let me know.

Step 1: Grab the information from the VCS 

The file *1vcsstatus_grabSH.rtf *is a bash script that when executed
will grab status information from the VCS listed in the script.  The
main line is:

*echo 'xstatus zones' | ssh -l admin a.b.c.d >>
/home/some_user/vcs_scripts/navcsStatus;* Notice there is no password. The VCS's will not allow you to store keys from servers and I did not store the password in the file. So when you execute it, you will need to manually enter the password for the admin account on the VCS. This is the largest downside to the plugin method. If we can add ssh keys to the VCS's, then this part could be automated securely.

 

1vcsstatus_grabSH.rtf:

Step 2:  Parse the output from Step 1

 

The file *2statusparsePL.rtf *is a perl script that takes the output
from Step 1, and formats into a simple readable method that will be used
by the actual plugin.  When you look at the script, I tried to add as
much comment code as possible but if you have questions, again, just ask.

The output will be a sequential list of zones that look like this:
 *1:Internet2 Commons - Old:Active*

Here you will need to make sure you pay attention to the number and
name.  When you go to create the host file for Nagios/Icinga, the number
will be important in making sure it executes properly for that zone.  If
not, you may end up with false reports.

 

2statusparsePL.rtf

 

Step 3:  The Plugin

The plugin is the actual script that Nagios/Icinga will execute when it
reads it host configurations.  The file for the plugin script
is *3check_neighbor_status-PLUGIN.rtf*.  This should go into the plugins
folder of Nagios/Icinga and defined in the appropriate files.
 
3check_neighbor_status-PLUGIN.rtf

Step 4: The Host Configuration


From here, you will still need to define your host configuration that Nagios/Icinga will actually use to populate its system and know what checks to run. The file *host_definition_example.rtf* is sort of a template you can use for this. Notice the check command line: *check_command check_neighbor_status!X* The "X" here is the number of the host as a result from the output of Step 2. So for here I would name my first host "Internet2 Commons – Old", and when I get to check_command line, it would be: *check_command check_neighbor_status!1* I already had my host configuration set but if you are doing this all from scratch, you could easily write a perl script to take the names and zone number from the output of Step 2 and write your entire host configuration file from it. I did not need to, but it shouldn't be too difficult when using the host configuration template. That is it for the plugin and files. Let me know your thoughts. Feel free to modify. Any major changes you make that you think will improve upon it, let me know so I can keep it up to date. If this is something everyone thinks is very usefully, I can more formalize the files and implementation procedure and place it on the wiki.
 
host_definition_example.rtf

Feedback

Comments and feedback to the above can be sent to Nicholas Thompson nick (at) internet2.edu

 

  • No labels