salt.modules.nagios

Run nagios plugins/checks from salt and get the return as data.

salt.modules.nagios.list_plugins()

List all the nagios plugins

命令行接口CLI 范例:

salt '*' nagios.list_plugins
salt.modules.nagios.retcode(plugin, args='', key_name=None)

Run one nagios plugin and return retcode of the execution

salt.modules.nagios.retcode_pillar(pillar_name)

Run one or more nagios plugins from pillar data and get the result of cmd.retcode The pillar have to be in this format:

------
webserver:
    Ping_google:
        - check_icmp: 8.8.8.8
        - check_icmp: google.com
    Load:
        - check_load: -w 0.8 -c 1
    APT:
        - check_apt
-------

webserver is the role to check, the next keys are the group and the items the check with the arguments if needed

You must to group different checks(one o more) and always it will return the highest value of all the checks

命令行接口CLI 范例:

salt '*' nagios.retcode webserver
salt.modules.nagios.run(plugin, args='')

Run nagios plugin and return all the data execution with cmd.run

命令行接口CLI 范例:

salt '*' nagios.run check_apt
salt '*' nagios.run check_icmp '8.8.8.8'
salt.modules.nagios.run_all(plugin, args='')

Run nagios plugin and return all the data execution with cmd.run_all

salt.modules.nagios.run_all_pillar(pillar_name)

Run one or more nagios plugins from pillar data and get the result of cmd.run_all The pillar have to be in this format:

------
webserver:
    Ping_google:
        - check_icmp: 8.8.8.8
        - check_icmp: google.com
    Load:
        - check_load: -w 0.8 -c 1
    APT:
        - check_apt
-------

webserver is the role to check, the next keys are the group and the items the check with the arguments if needed

You have to group different checks in a group

命令行接口CLI 范例:

salt '*' nagios.run webserver
salt.modules.nagios.run_pillar(pillar_name)

Run one or more nagios plugins from pillar data and get the result of cmd.run The pillar have to be in this format:

------
webserver:
    Ping_google:
        - check_icmp: 8.8.8.8
        - check_icmp: google.com
    Load:
        - check_load: -w 0.8 -c 1
    APT:
        - check_apt
-------

webserver is the role to check, the next keys are the group and the items the check with the arguments if needed

You have to group different checks in a group

命令行接口CLI 范例:

salt '*' nagios.run webserver