[Check_mk (english)] How to create a "settings" page for a custom check in WATO?

Hi,

  I've created a few custom checks for our purposes. Now, for the I've built something that would need an easy way to parametrize.

  I've done a (basically) simple check that just looks at ip-forwarding MIB (SNMP) to check if a route exists in a routing table of a device

  The check accepts two parameters: What routing protocols and subnets to inventorize (according to the MIB). The check then returns whether the route exists (OK) or not (UNKNOWN, I'm thinking about making that configurable as well to return either CRIT or UNKNOWN). I can specify such parameters in rules.mk, but how can I include this stuff in WATO configuration pages?

  I've looked into the documentation (e.g. http://mathias-kettner.com/checkmk_devel_factorysettings.html) and while they cover writing the checks quite well, adding them to WATO doesn't seem to be covered.

  I found a huge (416k) file check_parameters.py that seems to include the Wato rules structure that has a ton of register_check_parameters calls, can we include such a call in our own checks?

  Thanks.

···

--
- Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
- Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

1 Like

Hi Antti,

you can create your own settings for WATO inside /local/share/check_mk/web/plugins/wato folder.

I will paste an example from one of my checks.

register_check_parameters(

subgroup_os,

“win_cert”,

_(“Windows System Certificates”),

Tuple(

title = _(“Time left for installed certificates before renew is needed”),

help = _(“This rule sets the days before a certificate needs renew.”),

elements = [

Integer(title = _(“Warning at”), unit = _(“days”), default_value = 30),

Integer(title = _(“Critical at”), unit = _(“days”), default_value = 15)

],

),

None,

“first”

)

Inside your check you need to define the “check_group”

check_info[‘win_cert’] = {

“inventory_function” : inventory_win_cert,

“check_function” : check_win_cert,

“group” : “win_cert”,

“service_description” : “System Certificates”,

}

This group must match your definition inside the WATO rule.

Best regards

Andreas

···

Mäkelä, Antti Antti.Makela@vintor.fi schrieb am Mi., 15. Feb. 2017 um 08:19 Uhr:

Hi,

I’ve created a few custom checks for our purposes. Now, for the I’ve built something that would need an easy way to parametrize.

I’ve done a (basically) simple check that just looks at ip-forwarding MIB (SNMP) to check if a route exists in a routing table of a device

The check accepts two parameters: What routing protocols and subnets to inventorize (according to the MIB). The check then returns whether the route exists (OK) or not (UNKNOWN, I’m thinking about making that configurable as well to return either CRIT or UNKNOWN). I can specify such parameters in rules.mk, but how can I include this stuff in WATO configuration pages?

I’ve looked into the documentation (e.g. http://mathias-kettner.com/checkmk_devel_factorysettings.html) and while they cover writing the checks quite well, adding them to WATO doesn’t seem to be covered.

I found a huge (416k) file check_parameters.py that seems to include the Wato rules structure that has a ton of register_check_parameters calls, can we include such a call in our own checks?

Thanks.

  • Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -

  • Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -


checkmk-en mailing list

checkmk-en@lists.mathias-kettner.de

http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

Thanks.

I'm placing this in subgroup_networking.

Is there a documentation for the "ValueSpec"? The examples in the builtin seems to include e.g. Tuple, ListofStrings, DropDownChoice, RegExpUnicode and who knows what.

Right now I'm looking for a way to allow user to select and include multiple values according to the ipCidrRouteProto object (2 = local, 8 = rip, 14 = bgp and so on). The second parameter is IP Subnet(s) (one or several).

Based on simple testing of example, it would seem that ListOfStrings would work for the subnets, and a generic ListOf DropdownChoice(s) would work for the routing protocol. But it would really be nice to know these for sure :slight_smile:

···

--
- Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
- Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

-----Original Message-----
From: Andreas Döhler [mailto:andreas.doehler@gmail.com]
Sent: 15. helmikuuta 2017 9:50
To: Mäkelä, Antti; checkmk-en@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] How to create a "settings" page for a custom check in WATO?

Hi Antti,

you can create your own settings for WATO inside /local/share/check_mk/web/plugins/wato folder.
I will paste an example from one of my checks.

register_check_parameters(
    subgroup_os,
    "win_cert",
    _("Windows System Certificates"),
          Tuple(
              title = _("Time left for installed certificates before renew is needed"),
              help = _("This rule sets the days before a certificate needs renew."),
              elements = [
                  Integer(title = _("Warning at"), unit = _("days"), default_value = 30),
                  Integer(title = _("Critical at"), unit = _("days"), default_value = 15)
              ],
          ),
    None,
    "first"
)

Inside your check you need to define the "check_group"
check_info['win_cert'] = {
    "inventory_function" : inventory_win_cert,
    "check_function" : check_win_cert,
    "group" : "win_cert",
    "service_description" : "System Certificates",
}

This group must match your definition inside the WATO rule.

Best regards
Andreas

Mäkelä, Antti <Antti.Makela@vintor.fi> schrieb am Mi., 15. Feb. 2017 um 08:19 Uhr:

  Hi,
  
    I've created a few custom checks for our purposes. Now, for the I've built something that would need an easy way to parametrize.
  
    I've done a (basically) simple check that just looks at ip-forwarding MIB (SNMP) to check if a route exists in a routing table of a device
  
    The check accepts two parameters: What routing protocols and subnets to inventorize (according to the MIB). The check then returns whether the route exists (OK) or not (UNKNOWN, I'm thinking about making that configurable as well to return either CRIT or UNKNOWN). I can specify such parameters in rules.mk, but how can I include this stuff in WATO configuration pages?
  
    I've looked into the documentation (e.g. http://mathias-kettner.com/checkmk_devel_factorysettings.html) and while they cover writing the checks quite well, adding them to WATO doesn't seem to be covered.
  
    I found a huge (416k) file check_parameters.py that seems to include the Wato rules structure that has a ton of register_check_parameters calls, can we include such a call in our own checks?
  
    Thanks.
  --
  - Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
  - Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -
  
  _______________________________________________
  checkmk-en mailing list
  checkmk-en@lists.mathias-kettner.de
  http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

I got my rules in place.

One last question: How do I access the rules from within the check itself. Actually, I have rules for both inventory portion (which routes to inventory) and for the check portion (like I said, what state to set the service to if the route is missing). So how do I refer to my Wato-set configuration?

···

--
- Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
- Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

-----Original Message-----
From: checkmk-en-bounces@lists.mathias-kettner.de [mailto:checkmk-en-bounces@lists.mathias-kettner.de] On Behalf Of Mäkelä, Antti
Sent: 15. helmikuuta 2017 10:05
To: Andreas Döhler; checkmk-en@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] How to create a "settings" page for a custom check in WATO?

[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

Thanks.

I'm placing this in subgroup_networking.

Is there a documentation for the "ValueSpec"? The examples in the builtin seems to include e.g. Tuple, ListofStrings, DropDownChoice, RegExpUnicode and who knows what.

Right now I'm looking for a way to allow user to select and include multiple values according to the ipCidrRouteProto object (2 = local, 8 = rip, 14 = bgp and so on). The second parameter is IP Subnet(s) (one or several).

Based on simple testing of example, it would seem that ListOfStrings would work for the subnets, and a generic ListOf DropdownChoice(s) would work for the routing protocol. But it would really be nice to know these for sure :slight_smile:

--
- Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
- Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

-----Original Message-----
From: Andreas Döhler [mailto:andreas.doehler@gmail.com]
Sent: 15. helmikuuta 2017 9:50
To: Mäkelä, Antti; checkmk-en@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] How to create a "settings" page for a custom check in WATO?

Hi Antti,

you can create your own settings for WATO inside /local/share/check_mk/web/plugins/wato folder.
I will paste an example from one of my checks.

register_check_parameters(
    subgroup_os,
    "win_cert",
    _("Windows System Certificates"),
          Tuple(
              title = _("Time left for installed certificates before renew is needed"),
              help = _("This rule sets the days before a certificate needs renew."),
              elements = [
                  Integer(title = _("Warning at"), unit = _("days"), default_value = 30),
                  Integer(title = _("Critical at"), unit = _("days"), default_value = 15)
              ],
          ),
    None,
    "first"
)

Inside your check you need to define the "check_group"
check_info['win_cert'] = {
    "inventory_function" : inventory_win_cert,
    "check_function" : check_win_cert,
    "group" : "win_cert",
    "service_description" : "System Certificates",
}

This group must match your definition inside the WATO rule.

Best regards
Andreas

Mäkelä, Antti <Antti.Makela@vintor.fi> schrieb am Mi., 15. Feb. 2017 um 08:19 Uhr:

        Hi,

          I've created a few custom checks for our purposes. Now, for the I've built something that would need an easy way to parametrize.

          I've done a (basically) simple check that just looks at ip-forwarding MIB (SNMP) to check if a route exists in a routing table of a device

          The check accepts two parameters: What routing protocols and subnets to inventorize (according to the MIB). The check then returns whether the route exists (OK) or not (UNKNOWN, I'm thinking about making that configurable as well to return either CRIT or UNKNOWN). I can specify such parameters in rules.mk, but how can I include this stuff in WATO configuration pages?

          I've looked into the documentation (e.g. http://mathias-kettner.com/checkmk_devel_factorysettings.html) and while they cover writing the checks quite well, adding them to WATO doesn't seem to be covered.

          I found a huge (416k) file check_parameters.py that seems to include the Wato rules structure that has a ton of register_check_parameters calls, can we include such a call in our own checks?

          Thanks.
        --
        - Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
        - Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

        _______________________________________________
        checkmk-en mailing list
        checkmk-en@lists.mathias-kettner.de
        http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

_______________________________________________
checkmk-en mailing list
checkmk-en@lists.mathias-kettner.de
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

Hi,

Trying to follow e.g. win_dhcp_pools to get the parameters from Wato to my check.

It has

discovery_win_dhcp_pools = []

def inventory_win_dhcp_pools(info):
    settings = host_extra_conf_merged(g_hostname, discovery_win_dhcp_pools)

I've followed this example in my own check.

    settings = host_extra_conf_merged(g_hostname, ip_forwarding_rules)

  However, at this point the variable "settings" remains empty dictionary, {}.

WATO has written the following to rules.mk, so that part seems to be working. Now the only thing is that how I'm supposed to read this in?

checkgroup_parameters.setdefault('ip_forwarding_rules', [])

checkgroup_parameters['ip_forwarding_rules'] = [
  ( {'inventoried_networks': ['10.0.0.0/8', '172.29.0.0/24'], 'inventoried_routing_protocols': ['14']}, ['/' + FOLDER_PATH + '/+'], ['testhost'] ),
] + checkgroup_parameters['ip_forwarding_rules']

  I'd appreciate tips to get over this final hurdle...

···

--
- Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
- Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

-----Original Message-----
From: Mäkelä, Antti
Sent: 15. helmikuuta 2017 14:37
To: Andreas Döhler; checkmk-en@lists.mathias-kettner.de
Subject: RE: [Check_mk (english)] How to create a "settings" page for a custom check in WATO?

I got my rules in place.

One last question: How do I access the rules from within the check itself. Actually, I have rules for both inventory portion (which routes to inventory) and for the check portion (like I said, what state to set the service to if the route is missing). So how do I refer to my Wato-set configuration?

--
- Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
- Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

-----Original Message-----
From: checkmk-en-bounces@lists.mathias-kettner.de [mailto:checkmk-en-bounces@lists.mathias-kettner.de] On Behalf Of Mäkelä, Antti
Sent: 15. helmikuuta 2017 10:05
To: Andreas Döhler; checkmk-en@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] How to create a "settings" page for a custom check in WATO?

[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

Thanks.

I'm placing this in subgroup_networking.

Is there a documentation for the "ValueSpec"? The examples in the builtin seems to include e.g. Tuple, ListofStrings, DropDownChoice, RegExpUnicode and who knows what.

Right now I'm looking for a way to allow user to select and include multiple values according to the ipCidrRouteProto object (2 = local, 8 = rip, 14 = bgp and so on). The second parameter is IP Subnet(s) (one or several).

Based on simple testing of example, it would seem that ListOfStrings would work for the subnets, and a generic ListOf DropdownChoice(s) would work for the routing protocol. But it would really be nice to know these for sure :slight_smile:

--
- Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
- Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

-----Original Message-----
From: Andreas Döhler [mailto:andreas.doehler@gmail.com]
Sent: 15. helmikuuta 2017 9:50
To: Mäkelä, Antti; checkmk-en@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] How to create a "settings" page for a custom check in WATO?

Hi Antti,

you can create your own settings for WATO inside /local/share/check_mk/web/plugins/wato folder.
I will paste an example from one of my checks.

register_check_parameters(
    subgroup_os,
    "win_cert",
    _("Windows System Certificates"),
          Tuple(
              title = _("Time left for installed certificates before renew is needed"),
              help = _("This rule sets the days before a certificate needs renew."),
              elements = [
                  Integer(title = _("Warning at"), unit = _("days"), default_value = 30),
                  Integer(title = _("Critical at"), unit = _("days"), default_value = 15)
              ],
          ),
    None,
    "first"
)

Inside your check you need to define the "check_group"
check_info['win_cert'] = {
    "inventory_function" : inventory_win_cert,
    "check_function" : check_win_cert,
    "group" : "win_cert",
    "service_description" : "System Certificates",
}

This group must match your definition inside the WATO rule.

Best regards
Andreas

Mäkelä, Antti <Antti.Makela@vintor.fi> schrieb am Mi., 15. Feb. 2017 um 08:19 Uhr:

        Hi,

          I've created a few custom checks for our purposes. Now, for the I've built something that would need an easy way to parametrize.

          I've done a (basically) simple check that just looks at ip-forwarding MIB (SNMP) to check if a route exists in a routing table of a device

          The check accepts two parameters: What routing protocols and subnets to inventorize (according to the MIB). The check then returns whether the route exists (OK) or not (UNKNOWN, I'm thinking about making that configurable as well to return either CRIT or UNKNOWN). I can specify such parameters in rules.mk, but how can I include this stuff in WATO configuration pages?

          I've looked into the documentation (e.g. http://mathias-kettner.com/checkmk_devel_factorysettings.html) and while they cover writing the checks quite well, adding them to WATO doesn't seem to be covered.

          I found a huge (416k) file check_parameters.py that seems to include the Wato rules structure that has a ton of register_check_parameters calls, can we include such a call in our own checks?

          Thanks.
        --
        - Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
        - Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

        _______________________________________________
        checkmk-en mailing list
        checkmk-en@lists.mathias-kettner.de
        http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

_______________________________________________
checkmk-en mailing list
checkmk-en@lists.mathias-kettner.de
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

I can give you the settings from my check mentioned above.

As i define singe elements with integers the reading is very easy.

def check_win_cert(item, params, info):

info = win_cert_convert(info)

warn, crit = params

Params are two single values. As you have a dictionary, it is possible to access the values like this "networks = params[“inventoried_networks”]-

Best regards

Andreas

···

Mäkelä, Antti Antti.Makela@vintor.fi schrieb am Mi., 15. Feb. 2017 um 14:39 Uhr:

Hi,

Trying to follow e.g. win_dhcp_pools to get the parameters from Wato to my check.

It has

discovery_win_dhcp_pools =

def inventory_win_dhcp_pools(info):

settings = host_extra_conf_merged(g_hostname, discovery_win_dhcp_pools)

I’ve followed this example in my own check.

settings = host_extra_conf_merged(g_hostname, ip_forwarding_rules)

However, at this point the variable “settings” remains empty dictionary, {}.

WATO has written the following to rules.mk, so that part seems to be working. Now the only thing is that how I’m supposed to read this in?

checkgroup_parameters.setdefault(‘ip_forwarding_rules’, )

checkgroup_parameters[‘ip_forwarding_rules’] = [

( {‘inventoried_networks’: [‘10.0.0.0/8’, ‘172.29.0.0/24’], ‘inventoried_routing_protocols’: [‘14’]}, [’/’ + FOLDER_PATH + ‘/+’], [‘testhost’] ),

] + checkgroup_parameters[‘ip_forwarding_rules’]

I’d appreciate tips to get over this final hurdle…

  • Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -

  • Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

-----Original Message-----

From: Mäkelä, Antti

Sent: 15. helmikuuta 2017 14:37

To: Andreas Döhler; checkmk-en@lists.mathias-kettner.de

Subject: RE: [Check_mk (english)] How to create a “settings” page for a custom check in WATO?

I got my rules in place.

One last question: How do I access the rules from within the check itself. Actually, I have rules for both inventory portion (which routes to inventory) and for the check portion (like I said, what state to set the service to if the route is missing). So how do I refer to my Wato-set configuration?

  • Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -

  • Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

-----Original Message-----

From: checkmk-en-bounces@lists.mathias-kettner.de [mailto:checkmk-en-bounces@lists.mathias-kettner.de] On Behalf Of Mäkelä, Antti

Sent: 15. helmikuuta 2017 10:05

To: Andreas Döhler; checkmk-en@lists.mathias-kettner.de

Subject: Re: [Check_mk (english)] How to create a “settings” page for a custom check in WATO?

[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

Thanks.

I’m placing this in subgroup_networking.

Is there a documentation for the “ValueSpec”? The examples in the builtin seems to include e.g. Tuple, ListofStrings, DropDownChoice, RegExpUnicode and who knows what.

Right now I’m looking for a way to allow user to select and include multiple values according to the ipCidrRouteProto object (2 = local, 8 = rip, 14 = bgp and so on). The second parameter is IP Subnet(s) (one or several).

Based on simple testing of example, it would seem that ListOfStrings would work for the subnets, and a generic ListOf DropdownChoice(s) would work for the routing protocol. But it would really be nice to know these for sure :slight_smile:

  • Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -

  • Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

-----Original Message-----

From: Andreas Döhler [mailto:andreas.doehler@gmail.com]

Sent: 15. helmikuuta 2017 9:50

To: Mäkelä, Antti; checkmk-en@lists.mathias-kettner.de

Subject: Re: [Check_mk (english)] How to create a “settings” page for a custom check in WATO?

Hi Antti,

you can create your own settings for WATO inside /local/share/check_mk/web/plugins/wato folder.

I will paste an example from one of my checks.

register_check_parameters(

subgroup_os,

"win_cert",

_("Windows System Certificates"),

      Tuple(

          title = _("Time left for installed certificates before renew is needed"),

          help = _("This rule sets the days before a certificate needs renew."),

          elements = [

              Integer(title = _("Warning at"), unit = _("days"), default_value = 30),

              Integer(title = _("Critical at"), unit = _("days"), default_value = 15)

          ],

      ),

None,

"first"

)

Inside your check you need to define the “check_group”

check_info[‘win_cert’] = {

"inventory_function"    : inventory_win_cert,

"check_function"        : check_win_cert,

"group"                 : "win_cert",

"service_description"   : "System Certificates",

}

This group must match your definition inside the WATO rule.

Best regards

Andreas

Mäkelä, Antti Antti.Makela@vintor.fi schrieb am Mi., 15. Feb. 2017 um 08:19 Uhr:

    Hi,



      I've created a few custom checks for our purposes. Now, for the I've built something that would need an easy way to parametrize.



      I've done a (basically) simple check that just looks at ip-forwarding MIB (SNMP) to check if a route exists in a routing table of a device



      The check accepts two parameters: What routing protocols and subnets to inventorize (according to the MIB). The check then returns whether the route exists (OK) or not (UNKNOWN, I'm thinking about making that configurable as well to return either CRIT or UNKNOWN). I can specify such parameters in [rules.mk](http://rules.mk), but how can I include this stuff in WATO configuration pages?



      I've looked into the documentation (e.g. [http://mathias-kettner.com/checkmk_devel_factorysettings.html](http://mathias-kettner.com/checkmk_devel_factorysettings.html)) and while they cover writing the checks quite well, adding them to WATO doesn't seem to be covered.



      I found a huge (416k) file check_parameters.py that seems to include the Wato rules structure that has a ton of register_check_parameters calls, can we include such a call in our own checks?



      Thanks.

    --

    - Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -

    - Vintor Oy, Itsehallintokuja 6, 02600 Espoo | [www.vintor.fi](http://www.vintor.fi) -



    _______________________________________________

    checkmk-en mailing list

    checkmk-en@lists.mathias-kettner.de

    [http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en](http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en)

checkmk-en mailing list

checkmk-en@lists.mathias-kettner.de

http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

This answers how to access them during a check, thanks..

How about during the inventory phase?

···

--
- Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
- Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi -

________________________________________
From: Andreas Döhler <andreas.doehler@gmail.com>
Sent: Wednesday, February 15, 2017 16:27
To: Mäkelä, Antti; checkmk-en@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] How to create a "settings" page for a custom check in WATO?

I can give you the settings from my check mentioned above.

As i define singe elements with integers the reading is very easy.

def check_win_cert(item, params, info):
    info = win_cert_convert(info)
    warn, crit = params

Params are two single values. As you have a dictionary, it is possible to access the values like this "networks = params["inventoried_networks"]-

Best regards
Andreas

Mäkelä, Antti <Antti.Makela@vintor.fi<mailto:Antti.Makela@vintor.fi>> schrieb am Mi., 15. Feb. 2017 um 14:39 Uhr:
Hi,

Trying to follow e.g. win_dhcp_pools to get the parameters from Wato to my check.

It has

discovery_win_dhcp_pools = []

def inventory_win_dhcp_pools(info):
    settings = host_extra_conf_merged(g_hostname, discovery_win_dhcp_pools)

I've followed this example in my own check.

    settings = host_extra_conf_merged(g_hostname, ip_forwarding_rules)

  However, at this point the variable "settings" remains empty dictionary, {}.

WATO has written the following to rules.mk<http://rules.mk>, so that part seems to be working. Now the only thing is that how I'm supposed to read this in?

checkgroup_parameters.setdefault('ip_forwarding_rules', [])

checkgroup_parameters[‘ip_forwarding_rules’] = [
  ( {‘inventoried_networks’: [‘10.0.0.0/8<http://10.0.0.0/8>’, ‘172.29.0.0/24’<http://172.29.0.0/24’>], ‘inventoried_routing_protocols’: [‘14’]}, [’/’ + FOLDER_PATH + ‘/+’], [‘testhost’] ),
] + checkgroup_parameters[‘ip_forwarding_rules’]

  I'd appreciate tips to get over this final hurdle...
--
- Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
- Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi<http://www.vintor.fi> -

-----Original Message-----
From: Mäkelä, Antti
Sent: 15. helmikuuta 2017 14:37
To: Andreas Döhler; checkmk-en@lists.mathias-kettner.de<mailto:checkmk-en@lists.mathias-kettner.de>
Subject: RE: [Check_mk (english)] How to create a "settings" page for a custom check in WATO?

I got my rules in place.

One last question: How do I access the rules from within the check itself. Actually, I have rules for both inventory portion (which routes to inventory) and for the check portion (like I said, what state to set the service to if the route is missing). So how do I refer to my Wato-set configuration?

--
- Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
- Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi<http://www.vintor.fi> -

-----Original Message-----
From: checkmk-en-bounces@lists.mathias-kettner.de<mailto:checkmk-en-bounces@lists.mathias-kettner.de> [mailto:checkmk-en-bounces@lists.mathias-kettner.de] On Behalf Of Mäkelä, Antti
Sent: 15. helmikuuta 2017 10:05
To: Andreas Döhler; checkmk-en@lists.mathias-kettner.de<mailto:checkmk-en@lists.mathias-kettner.de>
Subject: Re: [Check_mk (english)] How to create a "settings" page for a custom check in WATO?

[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

Thanks.

I'm placing this in subgroup_networking.

Is there a documentation for the "ValueSpec"? The examples in the builtin seems to include e.g. Tuple, ListofStrings, DropDownChoice, RegExpUnicode and who knows what.

Right now I'm looking for a way to allow user to select and include multiple values according to the ipCidrRouteProto object (2 = local, 8 = rip, 14 = bgp and so on). The second parameter is IP Subnet(s) (one or several).

Based on simple testing of example, it would seem that ListOfStrings would work for the subnets, and a generic ListOf DropdownChoice(s) would work for the routing protocol. But it would really be nice to know these for sure :slight_smile:

--
- Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
- Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi<http://www.vintor.fi> -

-----Original Message-----
From: Andreas Döhler [mailto:andreas.doehler@gmail.com]
Sent: 15. helmikuuta 2017 9:50
To: Mäkelä, Antti; checkmk-en@lists.mathias-kettner.de<mailto:checkmk-en@lists.mathias-kettner.de>
Subject: Re: [Check_mk (english)] How to create a "settings" page for a custom check in WATO?

Hi Antti,

you can create your own settings for WATO inside /local/share/check_mk/web/plugins/wato folder.
I will paste an example from one of my checks.

register_check_parameters(
    subgroup_os,
    "win_cert",
    _("Windows System Certificates"),
          Tuple(
              title = _("Time left for installed certificates before renew is needed"),
              help = _("This rule sets the days before a certificate needs renew."),
              elements = [
                  Integer(title = _("Warning at"), unit = _("days"), default_value = 30),
                  Integer(title = _("Critical at"), unit = _("days"), default_value = 15)
              ],
          ),
    None,
    "first"
)

Inside your check you need to define the "check_group"
check_info['win_cert'] = {
    "inventory_function" : inventory_win_cert,
    "check_function" : check_win_cert,
    "group" : "win_cert",
    "service_description" : "System Certificates",
}

This group must match your definition inside the WATO rule.

Best regards
Andreas

Mäkelä, Antti <Antti.Makela@vintor.fi<mailto:Antti.Makela@vintor.fi>> schrieb am Mi., 15. Feb. 2017 um 08:19 Uhr:

        Hi,

          I've created a few custom checks for our purposes. Now, for the I've built something that would need an easy way to parametrize.

          I've done a (basically) simple check that just looks at ip-forwarding MIB (SNMP) to check if a route exists in a routing table of a device

          The check accepts two parameters: What routing protocols and subnets to inventorize (according to the MIB). The check then returns whether the route exists (OK) or not (UNKNOWN, I'm thinking about making that configurable as well to return either CRIT or UNKNOWN). I can specify such parameters in rules.mk<http://rules.mk>, but how can I include this stuff in WATO configuration pages?

          I've looked into the documentation (e.g. http://mathias-kettner.com/checkmk_devel_factorysettings.html) and while they cover writing the checks quite well, adding them to WATO doesn't seem to be covered.

          I found a huge (416k) file check_parameters.py that seems to include the Wato rules structure that has a ton of register_check_parameters calls, can we include such a call in our own checks?

          Thanks.
        --
        - Dr. Antti Mäkelä | Senior Architect | CCIE #20962 -
        - Vintor Oy, Itsehallintokuja 6, 02600 Espoo | www.vintor.fi<http://www.vintor.fi> -

        _______________________________________________
        checkmk-en mailing list
        checkmk-en@lists.mathias-kettner.de<mailto:checkmk-en@lists.mathias-kettner.de>
        http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

_______________________________________________
checkmk-en mailing list
checkmk-en@lists.mathias-kettner.de<mailto:checkmk-en@lists.mathias-kettner.de>
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en