The Opsview Puppet module allows for the synchronization of Opsview configuration using Opsview’s REST API service and is divided into many types, each of which is focused on a specific area of the Opsview configuration.
NOTE: You will need to install the 'rest-client' Ruby library to use this module. If you use your vendor-packaged version of Puppet, then you can either use the vendor's version of this library, or use 'gem install rest-client'. However, if you use the PuppetLab's version then you will need to install development tools (such as gcc and make, amoungst others) and then use /opt/puppetlabs/puppet/bin/gem install rest-client
to ensure the library and its prerequisites are installed to the correct location.
The puppet module should be installed into the standard location for Puppet modules, depending on the particular version of Puppet that you have. For example, this might be /etc/puppet/modules
After installing the module, you will need to create a file located at /etc/puppet/opsview.conf that contains the URL, username, and password for connecting to the Opsview system’s REST API.
/etc/puppet/opsview.conf
url: http://opsview-master/rest
username: admin
password: initial
All puppet types take two parameters
Parameter | Description | Type |
---|---|---|
name | Name of the object | String |
reload_opsview | Puppet will perform a reload at the end of the sync process | Boolean |
Property | Description | Type |
---|---|---|
hosts | Hosts that make up the component | Array of strings |
host_template | Host template that the component is built on | String |
required_online | How many hosts are required to be online | String |
opsview_bsmcomponent{'example-component':
ensure => present,
reload_opsview => true,
hosts => ['hostA','hostB','hostC'],
host_template => 'Network - Base',
required_online => '2'
}
Property | Description | Type |
---|---|---|
components | Components that make up the BSM service | Array of strings |
opsview_bsmservice{'example-bsmservice':
ensure => present,
reload_opsview => true,
components => ['componentA','componentB','componentC']
}
Property | Description | Type |
---|---|---|
description | Provides more information about the contact | String |
full_name | Full name for the contact. Defaults to the name of the contact | String |
homepage_id | An ID number that identifies which navigation icon is the home icon. ID "2" is for the "Host groups, hosts, and service view" |
String |
language | Which language to use in the UI. "de" - German "es" - Spanish |
String |
password | Password for the contact. You can generate the encrypted value by running: openssl passwd -apr1 <password> |
String |
realm | The realm of the contact. Normally, this is 'local' or 'ldap' | String |
shared_notification_profiles | List of shared notification profiles that the contact is subscribed to | Array of strings |
tips | Controls if pop-up help windows appear when navigating new areas | Boolean |
variables | List of contact variables that the contact uses | Array of hashes |
opsview_contact{'example-contact':
description => 'Java developer',
full_name => 'John Smith',
homepage_id => '2',
language => 'en',
password => '$apr1$ADd0/BNL$XVPQgWENB6Bzg/M4QEZe20',
realm => 'local',
shared_notification_profiles => ['on-call'],
tips => true,
variables => [
{'name' => 'EMAIL', 'value' => 'your@email.com'},
{'name' => 'RSS_COLLAPSED', 'value' => '1'},
{'name' => 'RSS_MAXIMUM_AGE', 'value' => '1440'},
{'name' => 'RSS_MAXIMUM_ITEMS', 'value' => '30'}
]
Property | Description | Type |
---|---|---|
all_hosts | Globally tag all hosts with this hashtag | Boolean |
all_servicechecks | Globally tag all service checks with this hashtag | Boolean |
description | Provides a description for the hashtag | String |
exclude_handled | Do not consider handled service checks when calculating the overall hashtag state | Boolean |
hosts | List of hosts to tag | Array of strings |
public | Whether the hashtag is public (can view without logging in to Opsview) | Boolean |
servicechecks | List of service checks to tag | Array of strings |
show_contextual_menus | Whether to display contextual menus | Boolean |
style | Display style for the hashtag detail view. Available values: group_by_host group_by_service host_summary errors_and_host_cells performance |
String |
visible | Whether the hashtag is included on the status pages or not | Boolean |
opsview_hashtag{'example-hashtag':
all_hosts => false,
all_servicechecks => true,
description => 'My Opsview service checks',
exclude_handled => true,
hosts => ['opsview'],
servicechecks => [],
show_contextual_menus => true,
style => "group_by_host",
visible => true
}
opsview_hashtag{'example-hashtag':
all_hosts => true,
all_servicechecks => false,
description => 'MySQL checks',
servicechecks => ['MySQL DB Listener','MySQL DB Processes']
}
Property | Description | Type |
---|---|---|
arguments | The plugin arguments | String |
plugin | The plugin to use | String |
opsview_hostcheckcommand{'example-hostcheckcommand':
plugin => 'check_icmp',
arguments => '-H $HOSTADDRESS$'
}
Property | Description | Type |
---|---|---|
parent | The parent host group | String |
opsview_hostgroup{'example-hostgroup1':}
opsview_hostgroup{'example-hostgroup2':
parent => 'example-hostgroup1'
}
Property | Description | Type |
---|---|---|
check_attempts | The number of check attempts to use when running the host check for the host | String |
check_command | The name of the host check command to run | String |
check_interval | How often to run the host check | String |
check_period | The name of the check period to use | String |
Description | Provides a description of the host | String |
enable_rancid | Whether to enable the RANCID (Netaudit) module | Boolean |
enable_snmp | Whether to enable SNMP | Boolean |
event_handler | The name of the event handler to run when the host check changes state | String |
event_handler_always_execute | Whether to enable 'always execute' for event handlers | Boolean |
flap_detection | Whether flap detection is enabled | Boolean |
hashtags | List of hashtags to tag against the host | Array of strings |
hostgroup | Name of the host group to put the host in | String |
hosttemplates | List of host templates to apply to the host | Array of strings |
icon | The host icon to use | String |
ip | The address or hostname of the host | String |
monitored_by | The name of the monitoring server that the host uses | String |
notification_options | Defines which states are allowed to notify for host notifications. Format is a comma-separated list of the letters d, u, r, or f d - DOWN u - UNREACHABLE r - RECOVERY f - FLAPPING |
String |
notification_period | The name of the notification period to use | String |
other_addresses | List of additional IP addresses that the host has. Format is a comma-separated list of IP addresses |
String |
parents | List of parents for the host | Array of strings |
rancid_autoenable | Whether to set 'autoenable' mode for RANCID | Boolean |
rancid_connection_type | The connection method for RANCID. Values are: ssh telnet |
String |
rancid_password | Password for the RANCID user. You can generate the encrypted value by running: opsview_crypt |
String |
rancid_username | The RANCID user to connect as | String |
rancid_vendor | Name of the RANCID vendor to use Values are: AGM |
String |
renotification_interval | How often to resend alerts. Format is [NUMBER1][UNIT1] [NUMBER2][UNIT2] .. [NUMBERn][UNITn] where UNIT can be s (seconds), m (minutes), h (hours), or d (days) |
String |
retry_check_interval | How long to wait before attempting a host check again | String |
servicechecks | The service checks to set for the host. This includes options for setting event handlers, exceptions, and timed exceptions. If you aren't interested in setting event handlers, exceptions, or timed exceptions, you can simply supply a string with the name of the service check.
To set the advanced fields, you will need to make use of a hash as seen below:
These two different types can be combined:
|
Array of strings and/or Array of hashes |
snmp_community | Community string for the device. You can generate the encrypted value by running: opsview_crypt |
String |
snmp_extended_throughput_data | Boolean | |
snmp_interfaces |
List of SNMP interfaces to monitor. This includes the thresholds for throughput, errors, and discards. Note: The default thresholds are set using an interface name of "" Note: Setting a threshold value to '-' will disable it and "" will use the default value. Example input:
|
Array of hashes |
snmp_message_size | The SNMP message size. Might need to be increased for certain devices to work properly. Values can be: default 1Kio 2Kio 4Kio 8Kio 16Kio 32Kio 64Kio |
String |
snmp_port | UDP port for SNMP communication | String |
snmp_use_getnext | Boolean | |
snmp_use_ifname | Boolean | |
snmp_version | Version of SNMP to use. Values can be: 1 2c 3 |
String |
snmp_ifdescr_level | Tidy up the interface names based on level - higher numbers tidy up more. Values can be: off 0 1 2 3 4 5 6 |
String |
snmpv3_authentication_password | Password for SNMPv3 authentication. You can generate the encrypted value by running: opsview_crypt |
String |
snmpv3_authentication_protocol | Protocol was SNMPv3 authentication. Values can be: md5 sha |
String |
snmpv3_privacy_password |
Password for SNMPv3 privacy. Values can be: des aes aes128 |
String |
snmpv3_username | The SNMPv3 user to connect as | String |
variables | Sets the host variables to use. Example syntax:
For encrypted fields, you can change 'argX' to 'encrypted_argX' and supply the value with an encrypted string that can be generated using opsview_crypt |
Array of hashes |
opsview_host{'example-host':
ip => 'localhost',
other_addresses => '127.0.0.1',
hostgroup => 'Opsview',
icon => 'LOGO - Linux Penguin',
hosttemplates => ['Network - Base', 'OS - Unix Base'],
servicechecks => ['Opsview Application Status'],
check_command => 'ping',
check_attempts => 2,
check_period => '24x7',
notification_period => '24x7',
check_interval => '5m',
renotification_interval => '60m',
retry_check_interval => '10m',
parents => ['opsview'],
variables => [
{"name" => "DISK", "value" => "/" },
{"name" => "DISK", "value" => "/tmp", "arg1" => "-w 3% -c 1%"}
]
}
Property | Description | Type |
---|---|---|
description | Describes what the host template is for | String |
hosts | List of hosts to include as part of the template | Array of strings |
management_urls | List of management URL's. Format for the hash is:
i.e.
|
Array of hashes |
servicechecks | The service checks to set for the host. This includes options for setting event handlers, exceptions, and timed exceptions. If you aren't interested in setting event handlers, exceptions, or timed exceptions, you can simply supply a string with the name of the service check.
To set the advanced fields, you will need to make use of a hash as seen below:
These two different types can be combined:
|
Array of hashes |
Property | Description | Type |
---|---|---|
active | Whether the notification method is enabled or not | Boolean |
command | The name of the script to run and any additional arguments | String |
run_on_master | Whether the notification method should run on the master or not | Boolean |
user_variables | List of user variables to use for the notification method | Array of strings |
opsview_notificationmethod{'example-notificationmethod':
active => true,
command => 'notify_by_email',
run_on_master => true,
user_variables => ['EMAIL']
}
Note: The format for the name of a notification profile is 'CONTACTNAME|PROFILENAME'
Property | Description | Type |
---|---|---|
all_business_components |
Whether to notify for all BSM components | Boolean |
all_business_services | Whether to notify for all BSM services | Boolean |
all_hostgroups | Whether to notify for all host groups | Boolean |
all_hashtags | Whether to notify for all hashtags | Boolean |
all_servicegroups | Whether to notify for all service groups | Boolean |
business_component_availability_below | Threshold value for component availability | String |
business_component_notification_options | Defines which states are allowed to notify for BSM component notifications. Format is a comma-separated list of the letters f, i, a, or r f - FAILED i - IMPACTED a - AVAILABILITY BELOW r - RECOVERY |
String |
business_component_renotification_interval | How often to resend BSM component alerts. Format is [NUMBER1][UNIT1] [NUMBER2][UNIT2] .. [NUMBERn][UNITn] where UNIT can be s (seconds), m (minutes), h (hours), or d (days) |
String |
business_services | List of business services | Array of strings |
business_service_availability_below | Threshold value for component availability | String |
business_service_notification_options | Defines which states are allowed to notify for BSM component notifications. Format is a comma-separated list of the letters o, i, a, or r o - OFFLINE i - IMPACTED a - AVAILABILITY BELOW r - RECOVERY |
String |
business_service_renotification_interval | How often to resend BSM service alerts. Format is [NUMBER1][UNIT1] [NUMBER2][UNIT2] .. [NUMBERn][UNITn] where UNIT can be s (seconds), m (minutes), h (hours), or d (days) |
String |
hashtags | List of hashtags to notify for | Array of strings |
hostgroups | List of host groups to notify for | Array of strings |
host_notification_options | Defines which states are allowed to notify for host notifications. Format is a comma-separated list of the letters d, u, r, or f d - DOWN u - UNREACHABLE r - RECOVERY f - FLAPPING |
String |
include_component_notes | Whether to include component notes in the notification | Boolean |
include_service_notes | Whether to include service notes in the notification | Boolean |
notification_methods | List of notification methods to use | Array of strings |
notification_period | Name of the time period to use for notifications | String |
send_from_alert | When to start sending alerts. A value of "1" means right from the first alert. | String |
servicegroups | List of service groups to notify for | Array of strings |
service_notification_options | Defines which states are allowed to notify for host notifications. Format is a comma-separated list of the letters w, r, u, c, or f w - WARNING r - RECOVERY u - UNKNOWN c - CRITICAL f - FLAPPING |
String |
stop_after_alert | When to stop receiving alerts. A value of "0" means never. | String |
opsview_notificationprofile{'admin|Working Hours':
notification_period => 'workhours',
host_notification_options => 'd,u,r,f',
service_notification_options => 'w,c,f,r,u',
all_hostgroups => true,
all_servicegroups => true,
notification_methods => ['Email', 'RSS']
}
Property | Description | Type |
---|---|---|
access | List of accesses for the role | Array of strings |
all_bsm_components | Whether the role can access BSM components | Boolean |
all_bsm_edit | Whether the role can edit BSM | Boolean |
all_bsm_view | Whether the role can view all BSM services | Boolean |
all_hostgroups | Whether the role can view all host groups | Boolean |
all_hashtags | Whether the role can view all hashtags | Boolean |
all_monitoringservers | Whether the role can configure hosts to use all monitoring servers | Boolean |
all_servicegroups | Whether the role can view all service groups | Boolean |
business_services | List of business services that the role can access. You can also specify if the role can edit them. Example of a business_service hash:
|
Array of hashes |
configure_hostgroups | List of host groups that the role can configure. | Array of strings |
hostgroups | List of host groups that the role can view | Array of strings |
monitoring_servers | List of monitoring servers that the role can configure | Array of strings |
servicegroups | List of service groups that the role can view | Array of strings |
tenancy | Name of the tenancy associated with the role | String |
opsview_role{'example-role':
all_hostgroups => false,
all_servicegroups => true,
all_hashtags => false,
all_monitoringservers => true,
access => ['VIEWALL','TESTALL','BSM','CONFIGUREBSM'],
hostgroups => ['Monitoring Servers','Opsview'],
configure_hostgroups => ['opsview'],
servicegroups => ['Application - Alfresco','Application - Apache HTTP Server','Service Provider - Amazon'],
hashtags => ['example-hashtag','example-public-hashtag'],
business_services => [
{'name' => 'Company Website', 'edit' => "true"},
{'name' => 'Sales', 'edit' => "false"}
]
}
Property | Description | Type | Check type |
---|---|---|---|
alert_from_failure | Selects the behavior for dealing with service check alerts.
Values can be:
or
0 is "disabled", 1 is "enabled", and 2 is "enable with re-notification interval" |
String | All |
arguments | Specifies the plugin arguments | String | Active |
cascaded_from | Specifies the name of an active service check that populates the passive check value. This is used when "re-checking" a passive check. |
String | Passive |
checktype | The type of service check. Values can be:
|
String | N/A |
check_freshness | Whether to check the freshness of the service check | Boolean | Passive, SNMP trap |
check_interval | How often to run the service check | String | Active, SNMP Polling |
check_period | The time period to use when running the service check | String | Active, SNMP Polling |
dependencies | List of service checks that this service check depends on | Array of strings | All |
description | Description of the service check | String | All |
event_handler | The name of the event handler to run when the service check changes state | String | All |
event_handler_always_execute | Whether to enable 'always execute' for event handlers | Boolean | All |
flap_detection | Whether to enable flap detection | Boolean | All |
freshness_action | Action to take when freshness_timeout has been reached. Values can be:
|
String | Passive, SNMP trap |
freshness_status | The state to set when freshness_action is set to 'Submit Result' Values can be:
|
String | Passive, SNMP trap |
freshness_text | The text to send when freshness_action is set to 'Submit Result' | String | Passive, SNMP trap |
freshness_timeout | String | Passive, SNMP trap | |
hashtags | List of hashtags to tag against the service check | Array of strings | All |
hosttemplates | List of host templates to assign this service check to | Array of strings | All |
invert_plugin_results | Whether to invert plugin results | Boolean | Active |
markdown_filter | Whether to use the markdown filter | Boolean | Active |
maximum_check_attempts | Maximum number of check attempts for the service check | String | Active, SNMP Polling |
notification_options | Defines which states are allowed to notify for service check notifications. Format is a comma-separated list of the letters w, c, r, u , f w - WARNING c - CRITICAL u - UNKNOWN r - RECOVERY f - FLAPPING |
String | All |
notification_period | The time period to use for sending out notifications | String | All |
record_output_changes | Whether to record output changes for service checks that do not change state | Boolean | All |
renotification_interval | How long to wait before sending an additional notification | String | All |
retry_check_interval | How long to wait before retrying a service check | String | Active, SNMP Polling |
sensitive_arguments | Whether to hide sensitive arguments when displaying and running test checks | Boolean | Active |
servicegroup | Which service group to put the service check in | String | All |
snmp_critical_comparison | The comparison function to use for the critical SNMP polling threshold. Values can be:
|
String | SNMP Polling |
snmp_critical_value | The value to use for the SNMP polling critical threshold | String | SNMP Polling |
snmp_warning_comparison | The comparison function to use for the warning SNMP polling threshold. Values can be:
|
String | SNMP Polling |
snmp_warning_value | The value to use for the SNMP polling warning threshold | String | SNMP Polling |
snmp_label | The label to use for SNMP polling checks | String | SNMP Polling |
snmp_oid | The OID to use for SNMP polling checks | String | SNMP Polling |
snmp_trap_rules | An array of hashes that represent trap rules | Array of hashes | SNMP trap |
variable | The variable to use in the service check | String | All |
opsview_servicecheck{'Example - ActiveCheck':
checktype => 'Active Plugin',
plugin => 'check_nrpe',
arguments => '-H %PUPPETVARIABLE%',
variable => 'PUPPETVARIABLE',
dependencies => ['Opsview Agent'],
check_interval => '5m',
retry_check_interval => '1m',
maximum_check_attempts => '3',
check_period => '',
notification_period => '',
renotification_interval => '',
invert_plugin_results => false,
sensitive_arguments => '1'
}
opsview_servicecheck{'Example - PassiveCheck':
checktype => 'Passive',
notification_options => 'w,c',
event_handler => '',
event_handler_always_execute => false,
}
opsview_servicecheck{'Example - SNMPCheck':
checktype => 'SNMP Polling',
hosttemplates => ['example-snmppolling'],
notification_options => 'w,c',
servicegroup => 'example-snmppolling',
snmp_oid => '1.3.6',
snmp_label => 'some_label',
snmp_warning_comparison => '>',
snmp_critical_comparison => equals,
snmp_warning_value => '78',
snmp_critical_value => '"88"'
}
opsview_servicecheck{'Example - SNMPTrap':
checktype => 'SNMP trap',
alert_every_failure => enable,
hosttemplates => ['example-snmptraps'],
freshness_action => "Submit Result",
freshness_status => OK,
freshness_text => 'No traps received in 10m. Reset to OK',
freshness_timeout => '10m',
record_output_changes => 'w,c,u',
servicegroup => 'example-snmptraps',
snmp_trap_rules => [
{ 'name' => 'rule 1', 'rule' => '1', 'action' => 'Send Alert', 'alert_level' => 'WARNING', 'message' => 'This is my trap'},
{ 'name' => 'rule 2', 'rule' => '1 && 1', 'action' => 'Stop Processing'}
]
}
This property only needs a name
opsview_servicegroup{'example-servicegroup':}
Property | Description | Type |
---|---|---|
description | Provides a description for the tenancy | String |
primary_role | Name of the primary role for the tenancy | String |
opsview_tenancy{'example-tenancy':
primary_role => 'View some, change none'
}
time periods specified in the following format:
HH:MM-HH:MM[,HH:MM-HH:MM][...] Where HH are hours specified in 24 hour format.
Fields may be left blank to mean no time during this day
The times are based on the timezone of the Opsview server
Examples:00:00-09:00,17:30-24:00 - Midnight to 9am, and 5:30pm to midnight
09:00-17:30 - 9am to 5:30pm
00:00-24:00 - a full day
Property | Description | Type |
---|---|---|
description | Provides a description for the time period | String |
sunday | Defines when the time period is active for this day | String |
monday | Defines when the time period is active for this day | String |
tuesday | Defines when the time period is active for this day | String |
wednesday | Defines when the time period is active for this day | String |
thursday | Defines when the time period is active for this day | String |
friday | Defines when the time period is active for this day | String |
saturday | Defines when the time period is active for this day | String |
opsview_timeperiod{'example-timeperiod':
description => 'Example Time Period',
sunday => '00:00-24:00',
monday => '09:00-17:00',
tuesday => '09:00-17:00',
wednesday => '09:00-17:00,19:00-22:15',
thursday => '09:00-17:00',
friday => '09:00-17:00',
saturday => '00:00-24:00'
}
Property | Description | Type |
---|---|---|
arg1 | Value for the first argument | String |
arg2 | Value for the second argument | String |
arg3 | Value for the third argument | String |
arg4 | Value for the fourth argument | String |
encrypted_arg1 | Encrypted value for the first argument. Use opsview_crypt to generate |
String |
encrypted_arg2 | Encrypted value for the second argument. Use opsview_crypt to generate |
String |
encrypted_arg3 | Encrypted value for the third argument. Use opsview_crypt to generate |
String |
encrypted_arg4 | Encrypted value for the fourth argument. Use opsview_crypt to generate |
String |
label1 | Description for the first argument | String |
label2 | Description for the second argument | String |
label3 | Description for the third argument | String |
label4 | Description for the fourth argument | String |
secured1 | Make the first argument an encrypted field | Boolean |
secured2 | Make the second argument an encrypted field | Boolean |
secured3 | Make the third argument an encrypted field | Boolean |
secured4 | Make the fourth argument an encrypted field | Boolean |
value | Value for the value field | Boolean |
opsview_variable{'EXAMPLE_VARIABLE':
value => "",
arg1 => "admin",
encrypted_arg2 => "bdd4dcdb1375a56dff0bbe2d9ce47272b7ecc64d90737bffa5dabf6f0a87080f",
label1 => "username",
label2 => "password"
}