Nagios definition and subgroup in function list

Nagios definition and subgroup in function list

2
NewbieNewbie
2

    Sep 23, 2010#1

    Hello,

    On the forum I found a wordfile for Nagios CFG files. Great. But now I want more :)
    This is an example of code I have:

    Code: Select all

    define host{
            name                            linux-server     ; The name of this host template
            use                             generic-host     ; This template inherits other values from the generic-host template
            check_period                    24x7             ; By default, Linux hosts are checked round the clock
            check_interval                  5                ; Actively check the host every 5 minutes
            retry_interval                  1                ; Schedule host check retries at 1 minute intervals
            max_check_attempts              10               ; Check each Linux host 10 times (max)
            check_command                   check-host-alive ; Default command to check Linux hosts
            notification_period             workhours        ; Linux admins hate to be woken up, so we only notify during the day
                                                             ; Note that the notification_period variable is being overridden from
                                                             ; the value that is inherited from the generic-host template!
            notification_interval           120              ; Resend notifications every 2 hours
            notification_options            d,u,r            ; Only send notifications for specific host states
            contact_groups                  admins           ; Notifications get sent to the admins by default
            register                        0                ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
            }
    In the function list I see "host". Great, but as a subfunction I would like to see Name -> linux-server
    I have been experimenting with the sub function but I obviously don't grasp the syntax as I don't get it to work.
    Any help would be appreciated.

    Wim

    6,603548
    Grand MasterGrand Master
    6,603548

      Sep 23, 2010#2

      I don't know where you have found a wordfile for Nagios on this website. I could find UltraEdit Word File for Nagios Configuration Files which is a very good wordfile.

      Some improvements are nevertheless possible as you can see on wordfile ultraedit_nagios_wordfile_prior_v16_00.uew. I replaced in this file all [\w\d]+ by \w+ because \w used in a Perl regular expression search string includes already 0-9A-Za-z_ and all code page specific letters in any case. The searches for function strings are always executed case insensitive and therefore \w can be replaced in UltraEdit syntax by [0-9a-z_].

      For UltraEdit prior v13.10 it is necessary to convert the Perl regular expressions to UltraEdit regular expressions and therefore such UE users need ultraedit_nagios_wordfile_prior_v13_10.uew. Of course this wordfile can be used with all versions of UltraEdit. It is the most compatible version.

      The first problem for what you want is that UltraEdit is still not supporting function lists with subgroups using the Perl regular expression engine in current version 16.20.0.1011. Either the wordfile uses only top level which makes it possible to use Perl regular expressions, or the UltraEdit regular expression engine is used for a function list with subgroups. Later versions of UltraEdit may not have this problem anymore.

      The second problem is that with the UE regex engine only 1 string can be marked to be displayed in the function list while the Perl regex engine supports multiple marked strings. So what you want is not really possible at the moment, only a compromise: mark only 1 part of a line inside { }. It is up to you to move ^( and ^) depending on what you want to see in the function list view in the subgroup.

      So for UE v16.00 and later I added 3 different versions of the wordfile:

      ultraedit_nagios_wordfile_first.uew ... shows first word of a line inside { } in the subgroup.
      ultraedit_nagios_wordfile_second.uew ... shows second word of a line inside { } in the subgroup.
      ultraedit_nagios_wordfile_both.uew ... shows string beginning from first word to end of second word of a line inside { } in the subgroup.
      nagios_wordfiles.zip (5.05 KiB)   196
      5 different wordfiles for Nagios as explained above.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Sep 24, 2010#3

        Thanks Mofi, you once more do honor to the title "Grand Master" :)