Example #1
0
def add_hosts(task_id, group_id, id):
    sql = SQLITE()

    zab = get_zabbix()
    hosts = zab.get_host(sql.get_group_zabbix_id(group_id))
    tmp = []
    for object in hosts:
        tmp.append(object['host'])
    return render_template("hosts_create.html", data_table=tmp)
Example #2
0
def task_host_create(task_id, group_id, id):
    fields = {
        'host': request.form['host'],
        'comment': request.form['comment'],
    }
    sql = SQLITE()
    zab = get_zabbix()
    hosts = zab.get_host(sql.get_group_zabbix_id(group_id))
    zab_id = None
    for i in hosts:
        if i['host'] == fields['host']:
            zab_id = i['hostid']

    sql.add_new_item_host(fields['host'], fields['comment'], task_id, group_id,
                          zab_id)
    return hosts_table(task_id, group_id, id)