2014-02-05 15:53:22 +01:00
|
|
|
## <a id="groups"></a> Groups
|
2013-10-02 09:50:26 +02:00
|
|
|
|
2013-10-18 20:05:08 +02:00
|
|
|
Groups are used for combining hosts, services and users into
|
|
|
|
accessible configuration attributes and views in external (web)
|
|
|
|
interfaces.
|
|
|
|
|
|
|
|
Group membership is defined at the respective object itself. If
|
|
|
|
you have a hostgroup name `windows` for example, and want to assign
|
|
|
|
specific hosts to this group for later viewing the group on your
|
|
|
|
alert dashboard, first create the hostgroup:
|
|
|
|
|
|
|
|
object HostGroup "windows" {
|
|
|
|
display_name = "Windows Servers"
|
|
|
|
}
|
|
|
|
|
|
|
|
Then add your hosts to this hostgroup
|
|
|
|
|
|
|
|
object Host "mssql-srv1" {
|
2014-03-31 18:38:15 +02:00
|
|
|
groups = [ "windows" ]
|
2014-04-04 18:41:54 +02:00
|
|
|
vars.mssql_port = 1433
|
2013-10-18 20:05:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
object Host "mssql-srv2" {
|
2014-03-31 18:38:15 +02:00
|
|
|
groups = [ "windows" ]
|
2014-04-04 18:41:54 +02:00
|
|
|
vars.mssql_port = 1433
|
2013-10-18 20:05:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
> **Best Practice**
|
|
|
|
>
|
|
|
|
> Add the hostgroup membership into generic templates combined with
|
|
|
|
> other attributes and let all windows hosts inherit from that template.
|
|
|
|
> You can also define multiple group memberships.
|
|
|
|
|
|
|
|
template Host "windows-mssql-template" {
|
2014-03-31 18:38:15 +02:00
|
|
|
groups = [ "windows" ]
|
2014-04-04 18:41:54 +02:00
|
|
|
vars.mssql_port = 1433
|
2013-10-18 20:05:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
object Host "mssql-srv1" {
|
2014-03-29 01:13:28 +01:00
|
|
|
import "windows-mssql-template"
|
2013-10-18 20:05:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
object Host "mssql-srv2" {
|
2014-03-29 01:13:28 +01:00
|
|
|
import "windows-mssql-template"
|
2013-10-18 20:05:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
This can be done for service and user groups the same way. Additionally
|
|
|
|
the user groups are associated as attributes in `Notification` objects.
|
|
|
|
|
|
|
|
object UserGroup "windows-mssql-admins" {
|
|
|
|
display_name = "Windows MSSQL Admins"
|
|
|
|
}
|
|
|
|
|
|
|
|
template User "generic-windows-mssql-users" {
|
2014-04-05 22:32:52 +02:00
|
|
|
groups += [ "windows-mssql-admins" ]
|
2013-10-18 20:05:08 +02:00
|
|
|
}
|
|
|
|
|
2014-03-27 12:30:24 +01:00
|
|
|
object User "win-mssql-noc" {
|
2014-03-31 18:38:15 +02:00
|
|
|
import "generic-windows-mssql-users"
|
2014-03-27 12:30:24 +01:00
|
|
|
|
2014-04-04 18:41:54 +02:00
|
|
|
vars.email = "noc@example.com"
|
2013-10-18 20:05:08 +02:00
|
|
|
}
|
|
|
|
|
2014-03-27 12:30:24 +01:00
|
|
|
object User "win-mssql-ops" {
|
2014-03-31 18:38:15 +02:00
|
|
|
import "generic-windows-mssql-users"
|
2014-03-27 12:30:24 +01:00
|
|
|
|
2014-04-04 18:41:54 +02:00
|
|
|
vars.email = "ops@example.com"
|
2013-10-18 20:05:08 +02:00
|
|
|
}
|