Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
J
jfzabbix
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • jfmonitor
  • jfzabbix
  • Wiki
  • 创建用户组, 用户

创建用户组, 用户

Last edited by zhengtianbao Apr 12, 2018
Page history

创建用户组

payload:

{
    "jsonrpc": "2.0",
    "method": "usergroup.create",
    "params": {
        "name": "testusergroup"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "result": {
    "usrgrpids": [
      "14"
    ]
  },
  "id": 1
}

创建指定用户组的用户

获取报警媒介sendemail的mediatypeid

Payload:

{
    "jsonrpc": "2.0",
    "method": "mediatype.get",
    "params": {
        "output": "extend"
    },
    "auth": "54ec7f0d103f635ada0a76147d8a93a5",
    "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "result": [
    {
      "mediatypeid": "1",
      "type": "0",
      "description": "Email",
      "smtp_server": "mail.company.com",
      "smtp_helo": "company.com",
      "smtp_email": "zabbix@company.com",
      "exec_path": "",
      "gsm_modem": "",
      "username": "",
      "passwd": "",
      "status": "0",
      "smtp_port": "25",
      "smtp_security": "0",
      "smtp_verify_peer": "0",
      "smtp_verify_host": "0",
      "smtp_authentication": "0",
      "exec_params": "",
      "maxsessions": "1",
      "maxattempts": "3",
      "attempt_interval": "10s"
    },
    {
      "mediatypeid": "2",
      "type": "3",
      "description": "Jabber",
      "smtp_server": "",
      "smtp_helo": "",
      "smtp_email": "",
      "exec_path": "",
      "gsm_modem": "",
      "username": "jabber@company.com",
      "passwd": "zabbix",
      "status": "0",
      "smtp_port": "25",
      "smtp_security": "0",
      "smtp_verify_peer": "0",
      "smtp_verify_host": "0",
      "smtp_authentication": "0",
      "exec_params": "",
      "maxsessions": "1",
      "maxattempts": "3",
      "attempt_interval": "10s"
    },
    {
      "mediatypeid": "3",
      "type": "2",
      "description": "SMS",
      "smtp_server": "",
      "smtp_helo": "",
      "smtp_email": "",
      "exec_path": "",
      "gsm_modem": "/dev/ttyS0",
      "username": "",
      "passwd": "",
      "status": "0",
      "smtp_port": "25",
      "smtp_security": "0",
      "smtp_verify_peer": "0",
      "smtp_verify_host": "0",
      "smtp_authentication": "0",
      "exec_params": "",
      "maxsessions": "1",
      "maxattempts": "3",
      "attempt_interval": "10s"
    },
    {
      "mediatypeid": "4",
      "type": "1",
      "description": "sendemail",
      "smtp_server": "",
      "smtp_helo": "",
      "smtp_email": "",
      "exec_path": "sendemail.sh",
      "gsm_modem": "",
      "username": "",
      "passwd": "",
      "status": "0",
      "smtp_port": "25",
      "smtp_security": "0",
      "smtp_verify_peer": "0",
      "smtp_verify_host": "0",
      "smtp_authentication": "0",
      "exec_params": "{ALERT.SENDTO}\n{ALERT.SUBJECT}\n{ALERT.MESSAGE}\n",
      "maxsessions": "1",
      "maxattempts": "3",
      "attempt_interval": "10s"
    }
  ],
  "id": 1
}

这里只需要description为sendemail的mediatypeid, 记录下这里的mediatypeid结果为4

创建用户组为testusergroup的用户

Payload:

{
    "jsonrpc": "2.0",
    "method": "user.create",
    "params": {
        "alias": "John",
        "passwd": "Doe123",
        "type": "3",
        "usrgrps": [
            {
                "usrgrpid": "14"
            }
        ],
        "user_medias": [
            {
                "mediatypeid": "4",
                "sendto": "648306475@qq.com",
                "active": 0,
                "severity": 63,
                "period": "1-7,00:00-24:00"
            }
        ]
    },
    "auth": "54ec7f0d103f635ada0a76147d8a93a5",
    "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "result": {
    "userids": [
      "3"
    ]
  },
  "id": 1
}
Clone repository
  • Home
  • Zabbix api ref
  • Zabbix_agent安装配置
  • Zabbix_server安装配置
  • 产品原型图
  • 创建报警规则
  • 创建用户组, 用户
  • 删除报警规则
  • 删除用户, 用户组
  • 测试脚本
  • 登入登出
  • 获取cpu使用率
  • 获取主机信息
  • 获取内存使用率
  • 获取报警信息
More Pages
×

New Wiki Page

Tip: You can specify the full path for the new file. We will automatically create any missing directories.