Skip to content

User

add_user_to_usergroup

add_user_to_usergroup <USERNAMES> <USERGROUPS>

Add users to usergroups.

Ignores users not in user groups. Users and groups must exist.

Arguments

USERNAMES
Usernames to add. Comma-separated.
Type: text
Required:

USERGROUPS
User groups to add the users to. Comma-separated.
Type: text
Required:


add_usergroup_permissions

add_usergroup_permissions <USERGROUP> [OPTIONS]

Give a user group permissions to host/template groups.

Run show_hostgroups to get a list of host groups, and show_templategroups --no-templates to get a list of template groups.

Arguments

USERGROUP
User group to give permissions to.
Type: text
Required:

Options

--hostgroup <HOSTGROUPS>
Comma-separated list of host group names.
Type: text

--templategroup <TEMPLATEGROUPS>
Comma-separated list of template group names.
Type: text

--permission <PERMISSION>
Permission to give to the user group.
Type: choice
Choices: deny, ro, rw, 0, 2, 3


create_notification_user

create_notification_user <SENDTO> <MEDIATYPE> [OPTIONS]

Create a notification user.

Notification users can be used to send notifications when a Zabbix event happens.

Sometimes we need to send a notification to a place not owned by any user in particular, e.g. an email list or jabber channel but Zabbix does not provide a way to define a media for a user group.

This is the reason we use notification users. They are users nobody owns, but that can be used by other users to send notifications to the media defined in the notification user profile.

Run show_media_types to get a list of available media types.

Uses the default notification user group defined in the configuration file if no user groups are specified with --usergroups.

Examples

Create a notification user for email reporting

create_notification_user user@example.com Email

Arguments

SENDTO
Email address, SMS number, jabber address, etc.
Type: text
Required:

MEDIATYPE
A media type name or ID defined in Zabbix. Case-sensitive.
Type: text
Required:

Options

--remarks <REMARKS>
Remarks about the notification user to include in username (max 20 chars).
Type: text

--username <USERNAME>
Override generated username. Ignores --remarks.
Type: text

--usergroups <USERGROUPS>
Comma-separated list of usergroups to add the user to. Overrides user groups in config file.
Type: text


create_user

create_user <USERNAME> [OPTIONS]

Create a user.

Arguments

USERNAME
Username of the user to create.
Type: text
Required:

Options

--firstname <FIRST_NAME>
First name of the user to create.
Type: text

--lastname, --surname <LAST_NAME>
Last name of the user to create.
Type: text

--passwd <PASSWORD>
Password of the user to create. Set to '-' to prompt for password. Generates random password if omitted.
Type: text

--role <ROLE>
Role of the user.
Type: choice
Choices: user, admin, superadmin, guest, 1, 2, 3, 4
Default: user

--autologin/--no-autologin
Enable auto-login for the user.
Type: boolean (flag)
Default: False

--autologout <AUTOLOGOUT>
User session lifetime in seconds. Set to 0 to never expire. Can be a time unit with suffix (0s, 15m, 1h, 1d, etc.)
Type: text
Default: 86400

--groups <GROUPS>
Comma-separated list of group IDs to add the user to.
Type: text


create_usergroup

create_usergroup <USERGROUP> [OPTIONS]

Create a user group.

Arguments

USERGROUP
Name of the user group to create.
Type: text
Required:

Options

--gui <GUI_ACCESS>
GUI access for the group.
Type: choice
Choices: default, internal, ldap, disable, 0, 1, 2, 3
Default: default

--disabled
Create the user group in a disabled state.
Type: boolean (flag)
Default: False


remove_user

remove_user <USERNAME>

Remove a user.

Arguments

USERNAME
Username to remove.
Type: text
Required:


remove_user_from_usergroup

remove_user_from_usergroup <USERNAMES> <USERGROUPS>

Remove users from usergroups.

Ignores users not in user groups. Users and groups must exist.

Arguments

USERNAMES
Usernames to remove. Comma-separated.
Type: text
Required:

USERGROUPS
User groups to remove the users from. Comma-separated.
Type: text
Required:


show_media_types

show_media_types

Show all available media types.


show_user

show_user <USERNAME>

Show a user.

Arguments

USERNAME
Username of user
Type: text
Required:


show_usergroup

show_usergroup <USERGROUP> [OPTIONS]

Show one or more user groups by name or ID.

Examples

Show user group 'Admins'

show_usergroup Admins

Show user groups 'Admins' and 'Operators'

show_usergroup Admins,Operators

Show all user groups containing 'web' sorted by ID

show_usergroup '*web*' --sort id

Arguments

USERGROUP
Name or ID of the user group(s) to show. Comma-separated. Supports wildcards.
Type: text
Required:

Options

--sort <SORT>
Sort by field.
Type: choice
Choices: name, id, users
Default: name


show_usergroup_permissions

show_usergroup_permissions <USERGROUP> [OPTIONS]

Show permissions for one or more user groups.

Examples

Show permissions for user group 'Admins'

show_usergroup_permissions Admins

Show permissions for user groups 'Admins' and 'Operators'

show_usergroup_permissions Admins,Operators

Show permissions for all user groups sorted by ID

show_usergroup_permissions * --sort id

Arguments

USERGROUP
Name of user group. Comma-separated. Supports wildcards.
Type: text
Required:

Options

--sort <SORT>
Sort by field.
Type: choice
Choices: name, id, users
Default: name


show_usergroups

show_usergroups <USERGROUP> [OPTIONS]

Show user groups.

Can be filtered by name or ID.

Examples

Show all user groups

show_usergroups

Show user groups 'Admins' and 'Operators'

show_usergroup Admins,Operators

Show all user groups containing 'web' sorted by ID

show_usergroup '*web*' --sort id

Arguments

USERGROUP
Name or ID of the user group(s) to show. Comma-separated. Supports wildcards.
Type: text

Options

--sort <SORT>
Sort by field.
Type: choice
Choices: name, id, users
Default: name

--limit, -n <LIMIT>
Limit the number of results. 0 to show all.
Type: integer
Default: 0


show_users

show_users <USERNAME_OR_ID> [OPTIONS]

Show users.

Users can be filtered by name, ID, or role.

Arguments

USERNAME_OR_ID
Filter by username or ID. Supports wildcards.
Type: text

Options

--role <ROLE>
Filter by role.
Type: choice
Choices: user, admin, superadmin, guest, 1, 2, 3, 4

--limit <LIMIT>
Limit the number of users shown.
Type: integer

--sort <SORT>
Sort by field.
Type: choice
Choices: name, id, role
Default: name


update_user

update_user <USERNAME> [OPTIONS]

Update a user.

Use add_user_to_usergroup and remove_user_from_usergroup to manage user groups.

Examples

Assign new first and last name

update_user jdoe --firstname John --lastname Doe

Promote user to admin

update_user jdoe --role Admin

Update user's password, prompt for passwords

update_user jdoe --passwd - --old-passwd -

Update user's password, generate random new password

update_user jdoe --passwd ? --old-passwd -

Disable autologin for user

update_user jdoe --no-autologin

Arguments

USERNAME
Username of the user to update
Type: text
Required:

Options

--firstname <FIRST_NAME>
New first name.
Type: text

--lastname <LAST_NAME>
New last name.
Type: text

--passwd, --new-passwd <NEW_PASSWORD>
New password for user. Set to '-' to prompt for password, '?' to generate a random password.
Type: text

--old-passwd <OLD_PASSWORD>
Existing password, required if --passwd is used. Set to '-' to prompt for password.
Type: text

--role <ROLE>
User role.
Type: choice
Choices: user, admin, superadmin, guest, 1, 2, 3, 4

--autologin/--no-autologin
Enable/disable auto-login
Type: boolean (flag)

--autologout <AUTOLOGOUT>
User session lifetime in seconds. Set to 0 to never expire. Can be a time unit with suffix (0s, 15m, 1h, 1d, etc.)
Type: text


update_usergroup_permissions

update_usergroup_permissions <USERGROUP> [OPTIONS]

Give a user group permissions to host/template groups.

Run show_hostgroups to get a list of host groups, and show_templategroups --no-templates to get a list of template groups.

Arguments

USERGROUP
User group to give permissions to.
Type: text
Required:

Options

--hostgroup <HOSTGROUPS>
Comma-separated list of host group names.
Type: text

--templategroup <TEMPLATEGROUPS>
Comma-separated list of template group names.
Type: text

--permission <PERMISSION>
Permission to give to the user group.
Type: choice
Choices: deny, ro, rw, 0, 2, 3