|
# nagios definitions for the universal ctags command line application |
|
# Copyright © 2018 Henrik Lindgren |
|
# |
|
# This program is free software; you can redistribute it and/or modify |
|
# it under the terms of the GNU General Public License as published by |
|
# the Free Software Foundation; either version 2 of the License, or |
|
# (at your option) any later version. |
|
# |
|
# This program is distributed in the hope that it will be useful, |
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
# GNU General Public License for more details. |
|
# |
|
# You should have received a copy of the GNU General Public License |
|
# along with this program; if not, see <http://www.gnu.org/licenses/>. |
|
|
|
# To creat tags file for vim from bash: |
|
# ctags\ --format=2\ --kinds-nagios=-F\ --language-force=nagios\ *.cfg |
|
# |
|
# Or add following to a Makefile in the nagios dir: |
|
# |
|
# tags: clean |
|
# › ctags --format=2 --languages=nagios objects/*.cfg nagios.cfg private/*.cfg |
|
# |
|
# clean: |
|
# › rm -vf tags 2>/dev/null |
|
|
|
|
|
|
|
|
|
--langdef=nagios |
|
--langmap=nagios:(*.cfg) |
|
|
|
# command |
|
--regex-nagios=/^[ \t]*define[ \t]+command[ \t]*[{][ \t]*/command/d,definition/{placeholder}{scope=set} |
|
--regex-nagios=/^[ \t]*command_name[ \t]*([0-9a-zA-Z_-]+)/\1/a,command/{scope=ref} |
|
--regex-nagios=/^[ \t]*[}][ \t]*//{placeholder}{scope=clear} |
|
|
|
# page |
|
--regex-nagios=/^[ \t]*define[ \t]+page[ \t]*[{][ \t]*/page/d,definition/{placeholder}{scope=set} |
|
--regex-nagios=/^[ \t]*page_name[ \t]*([0-9a-zA-Z_-]+)/\1/p,page/{scope=ref} |
|
--regex-nagios=/^[ \t]*[}][ \t]*//{placeholder}{scope=clear} |
|
|
|
# timeperiod |
|
--regex-nagios=/^[ \t]*define[ \t]+timeperiod[ \t]*[{][ \t]*/timeperiod/d,definition/{placeholder}{scope=set} |
|
--regex-nagios=/^[ \t]*timeperiod_name[ \t]*([0-9a-zA-Z_-]+)/\1/t,timeperiod/{scope=ref} |
|
--regex-nagios=/^[ \t]*[}][ \t]*//{placeholder}{scope=clear} |
|
|
|
# schedule |
|
--regex-nagios=/^[ \t]*define[ \t]+schedule[ \t]*[{][ \t]*/schedule/d,definition/{placeholder}{scope=set} |
|
--regex-nagios=/^[ \t]*schedule_name[ \t]*([0-9a-zA-Z_-]+)/\1/T,schedule/{scope=ref} |
|
--regex-nagios=/^[ \t]*[}][ \t]*//{placeholder}{scope=clear} |
|
|
|
# graph |
|
--regex-nagios=/^[ \t]*define[ \t]+graph[ \t]*[{][ \t]*/graph/d,definition/{placeholder}{scope=set} |
|
--regex-nagios=/^[ \t]*graph_name[ \t]*([0-9a-zA-Z_-]+)/\1/g,graph/{scope=ref} |
|
--regex-nagios=/^[ \t]*[}][ \t]*//{placeholder}{scope=clear} |
|
|
|
# host |
|
--regex-nagios=/^[ \t]*define[ \t]+host[ \t]*[{][ \t]*/host/d,definition/{placeholder}{scope=set} |
|
--regex-nagios=/^[ \t]*host_name[ \t]*([A-Za-z0-9_-]+[^,!])$/\1/h,hostname/{scope=ref} |
|
--regex-nagios=/^[ \t]*[}][ \t]*//{placeholder}{scope=clear} |
|
|
|
|
|
# hostgroup |
|
--regex-nagios=/^[ \t]*define[ \t]+hostgroup[ \t]*[{][ \t]*/hostgroup/d,definition/{placeholder}{scope=set} |
|
--regex-nagios=/^[ \t]*hostgroup_name[ \t]*([0-9a-zA-Z_-]+)/\1/H,hostgroupname/{scope=ref} |
|
--regex-nagios=/^[ \t]*[}][ \t]*//{placeholder}{scope=clear} |
|
|
|
# contact |
|
--regex-nagios=/^[ \t]*define[ \t]+contact[ \t]*[{][ \t]*/contact/d,definition/{placeholder}{scope=set} |
|
--regex-nagios=/^[ \t]*contact_name[ \t]*([0-9a-zA-Z_-]+)/\1/c,contact/{scope=ref} |
|
--regex-nagios=/^[ \t]*[}][ \t]*//{placeholder}{scope=clear} |
|
|
|
# contactgroup |
|
--regex-nagios=/^[ \t]*define[ \t]+contactgroup[ \t]*[{][ \t]*/contactgroup/d,definition/{placeholder}{scope=set} |
|
--regex-nagios=/^[ \t]*contactgroup_name[ \t]*([0-9a-zA-Z_-]+)/\1/C,contactgroup/{scope=ref} |
|
--regex-nagios=/^[ \t]*[}][ \t]*//{placeholder}{scope=clear} |
|
|
|
|
|
# service |
|
--regex-nagios=/^[ \t]*define[ \t]+service[ \t]*[{][ \t]*/service/d,definition/{placeholder}{scope=set} |
|
--regex-nagios=/^[ \t]*service_name[ \t]*([0-9a-zA-Z_-]+)/\1/s,service/{scope=ref} |
|
--regex-nagios=/^[ \t]*[}][ \t]*//{placeholder}{scope=clear} |
|
|
|
# servicegroup |
|
--regex-nagios=/^[ \t]*define[ \t]+servicegroup[ \t]*[{][ \t]*/servicegroup/d,definition/{placeholder}{scope=set} |
|
--regex-nagios=/^[ \t]*servicegroup_name[ \t]*([0-9a-zA-Z_-]+)/\1/S,servicegroup/{scope=ref} |
|
--regex-nagios=/^[ \t]*[}][ \t]*//{placeholder}{scope=clear} |
|
|
|
# user variables |
|
--regex-nagios=/^\$(USER[0-9]+)\$[=]/\1/v,variable/ |
|
|
|
# DEBUG: |
|
# run from nagios root dir |
|
# grep -oPR '^define *\K[^{]*' | cut -f2 -d':' | sort -u |
|
# this should show all definitions |
|
|
|
# vim: set ts=4 sw=4 tw=0 expandtab foldenable foldexpr=^-- foldmethod=expr foldclose=all : |
I would like to recommend you to use
--kinddef-nagios=...
option.