Zevenet API v4.0 Reference
ZAPI (Zevenet Application Programming Interface) is the tool for system administrators to control the Zevenet load balancer behavior.
It is necessary active the root zapi user from the web interface before using it, System > Users.
Once the ZAPI user has been created, it is possible to send requests to the HTTP server. A URI request looks like:
HTTP verb
https://zevenet_server
:444/zapi/v4.0/zapi.cgi/URI_path
,
where zevenet_server
is the IP where HTTP service is listening, the HTTP manage interface,
and the URI_path
defines the object which will be requested. How to access and how to
modify each Zevenet object will be defined within each documentation section.
The HTTP verbs
accepted for the ZAPI are:
GET, is used to get a list of elements or to retrieve an object.
POST, is used to create new objects, modify system object (objects that the admin has not got created) and to apply actions.
PUT, is used to modify an existing object that was created by the admin.
DELETE, is used to remove an object that was created by the admin and in some case to reset a configuration (case of interfaces).
ZAPI parameters
ZAPI parameters
Request example:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-H 'Content-Type: application/json' -d ''
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms
A PUT and POST requests always need almost a parameter although the ZAPI call does not need any required (mandatory) parameter. If a PUT or POST request is sent without parameters, the ZAPI will return the list of expected parameters and their possible options.
Response example:
{
"description" : "No parameter has been sent. Please, try with:",
"params" : [
{
"name" : "profile",
"options" : [
"required"
],
"possible_values" : [
"http",
"gslb",
"l4xnat",
"datalink"
]
},
{
"format" : "ip_addr",
"name" : "vip",
"options" : [
"required"
]
},
{
"description" : "expects a port",
"name" : "vport",
"options" : [
"required"
]
},
{
"description" : "The farm name is required to have alphabet letters, numbers or hypens (-) only.",
"format" : "farm_name",
"name" : "farmname",
"options" : [
"required"
]
}
]
}
Response parameters
The response is a list of fields that describes the parameter and the possible options of configuration:
Parameter description:
Field | Type | Description |
---|---|---|
name | String | It is the key to the accepted value. The following parameters are used to define it. |
description | String | It is information about the expected value. |
interval | String | The parameter has to have a numeric value respecting the low, high or both limits. The values used as limits are taken as valid. |
format | String | It can be a clue with the expected format of the parameter, it can be a regular expression or a key that identifies the data. |
possible_values | String[] | It is the list of possible values that the parameter has to have. |
options | String[] | It shows more configuration to take in mind. |
List of options:
Field | Description |
---|---|
required | This option indicates that the parameter is mandatory, it has to be sent in the request. |
non_blank | This option allows sending an empty string as the parameter value. It could be useful to unset the parameter. |
Error codes
The ZAPI can response one of the following error codes:
Error Code | Brief | Description |
---|---|---|
400 | Bad Request | Some request parameter is incorrect. |
401 | Unauthorized | Your ZAPI key is wrong. |
402 | Certificate not valid | The load balancer needs a valid certificate to process the request. |
403 | Forbidden | The user owner of the ZAPI key has not permissions for the request or the object used in it. |
404 | Not Found | The URI used or one object used in the call does not exist. |
405 | Method Not Allowed | The HTTP verb does not exist or is not implemented for the current ZAPI call. |
406 | Not Acceptable | This feature is not temporality available. |
409 | Conflict | The request is valid, but it could not be processed, the new configuration created a conflict with the current one. Syslog could offer more information. |
410 | Gone | This feature has been removed. |
500 | Internal Server Error | An error occurred in the server. |
504 | Gateway Timeout | The server response timeout has been reached and the request has not been finished its processing. |
Changes log
This is the list of changes that have been included in each version. The list of changes list in a ZAPI version is always regarding the before then.
API 4.0.2
This ZAPI version is a extension of the version 4.0.1. Some parameters and URIs were added but any of them where removed.
- VPN
New VPN module:
Added GET|POST|PUT|DELETE /vpns/*
- HTTP/S Farms
New params:
errorWAF, rewritelocation(added new options only for zproxy), rewriteurl, pinnedconnection, routingpolicy, connection_limit:
Modified: GET|PUT /farms/<farmname>
.
Modified: GET|PUT /farms/<farmname>/services/<id>
.
New APIs to add rewriteurl:
Added ADD|DELETE /farms/<farmname>/service/<servicename>/rewriteurl/*
New APIs to add Rewrite Headers Rules:
Added ADD|DELETE /farms/MyHttpFarm/replacerequestheader/*
Added ADD|DELETE /farms/MyHttpFarm/replaceresponseheader/*
Added requests to manage static sessions (zproxy only):
Added GET|POST|DELETE /farms/<farmname>/services/<servicename>/sessions/*
- Farmguardian
Added parameter timeout:
Modified: GET /monitoring/fg/<name>
.
Modified: POST|PUT /monitoring/fg
.
- SSH
Configure multiple ips and ports:
Modified ADD|POST /system/ssh
, now accept arrays in the listen and port params.
- HTTP Server:
Configure multiple ips and ports for cherokee server:
Modified ADD|POST /system/http
, now accept arrays in the ip and port params.
Configure the server certificate:
Added GET|POST /system/https/certificate
.
- Statistics:
Added parameters total_sessions and ttl:
Modified: GET /stats/farms/<farmname>
- Global configuration:
Added parameter waf_assistant:
Modified GET|POST /system/global
- Rsyslog
New rsyslog APIs to configure logs to send them to remote server:
Added: GET|POST|DELETE /system/rsyslog
.
- Cluster:
Added parameter track_interface:
Modified: GET|PUT /system/cluster
.
API 4.0.1
This ZAPI version is a extension of the version 4.0. Some parameters and URIs were added but any of them where removed.
- IDs
Add a request to show a tree with all objects of the load balancer
Add: GET /ids
- Farms
Option to copy a farm
Modified: POST /farms
- HTTP Farms
Add parameters addresponseheader and removeresponseheader and extend the parameter httpverb:
Modified GET /farms/<farmname>
Modified PUT /farms/<farmname>
Add POST /farms/<farmname>/addresponseheader|removeresponseheader
Add DELETE /farms/<farmname>/addresponseheader|removeresponseheader/<n>
- L4xNAT Farms
Add requests to manage static sessions:
Add GET /farms/<farmname>/sessions
Add POST /farms/<farmname>/sessions
Add DELETE /farms/<farmname>/sessions/<session>
- Networking
New module of routing:
Added GET|POST|PUT|DELETE /routing/*
- Monitoring
Farmguardian can use the backend alias as host name for checks:
Added GET|PUT /monitoring/fg*/<farmguardian>
- IPDS
Manage files for WAF rules:
Added GET|PUT|DELETE /ipds/waf/files
- System
Get system information:
Added: GET /system/info
Modified global settings:
Added: GET|POST /system/global
- RBAC
Authentication using LDAP:
Added GET|POST /rbac/services
Added GET|POST /rbac/ldap*
Modified GET|POST /rbac/users
Modified GET|PUT /rbac/users/<user>
API 4.0
- HTTP Farms
List a summary of the farms and services grouped for module:
Added: /farms/modules/summary
Actions to link WAF rule set with HTTP farms:
Added: GET|POST|PUT|DELETE /farms/<farmname>/ipds/waf/*
Modified: GET /farms/<farm>
Move certificates in a HTTPS farms:
Added: POST /farms/<farm>/certificates/<cert>/actions
- L4xNAT Farms
Modify farms call related with l4xnat to support the new core:
Modified: GET|POST|PUT|DELETE /farms/<l4farm>
- Network
Added the DHCP and MAC features in the following ZAPI calls:
modified: PUT /interfaces/nic/<if>
modified: PUT /interfaces/bonding/<if>
modified: POST /interfaces/vlan
modified: PUT /interfaces/vlan/<if>
- Monitoring
Rename parameter to copy a farm guardian:
Modified: POST /monitoring/fg
- IPDS
Management of the IPDS package:
Added: GET /ipds/package
Added: POST /ipds/package/actions
New web application firewall, WAF, feature:
Added: GET|POST|PUT|DELETE /ipds/waf/*
Remove the call for copying RBL rules. Now it is a parameter of the creating call:
removed: POST /ipds/rbl/<name>
modified: POST /ipds/waf/<name>
- System
The features factory reset, proxy and check packages updates have been added:
Added: POST /system/factory
Added: GET /system/proxy
Added: POST /system/proxy
Added: GET /system/packages
- RBAC
Add parameter to manage the web GUI menus:
Added: GET /rbac/menus
Modified: PUT /rbac/roles/<ROLE>
Activation Certificates
The activation certificate is the license issued by Zevenet that enables the complete use of the load balancer in its Enterprise version.
Show activation Certificate details
Show activation Certificate details
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/activation
GET /certificates/activation
Show all the information included in the activation certificate, including signatures, this certificate is saved in the certificates store. If the activation certificate is deleted then the product will be deactivated.
Upload an activation Certificate
Upload an activation Certificate
Request example:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>" -H 'Content-Type: text/plain'
--tcp-nodelay --data-binary @/path/to/example.pem
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/activation
POST /certificates/activation
Upload an activation certificate with PEM format, this certificate is needed to enable all functionalities. This certificate is saved in the certificates store, if the activation certificate exists in the certificates store then the previous certificate is overwritten.
Response example:
{
"description" : "Upload activation certificate",
"message" : "Activation certificate uploaded",
"success" : "true"
}
Delete the activation Certificate
Delete the activation Certificate
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/activation
DELETE /certificates/activation
Delete the activation certificate installed in the certificates store. If this certificate is deleted then the Load Balancer is deactivated.
Response example:
{
"description" : "Delete activation certificate",
"message" : "The activation certificate has been deleted",
"success" : "true"
}
SSL Certificates
Zevenet supports certificates in PEM format to use them with HTTP farms set up with HTTPS listener. If you want to learn more about how to create pem certificates, please visit the following article: GENERATE CERTIFICATES IN PEM FORMAT
List all Certificates
List all Certificates
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates
zcli certificate list
GET /certificates
List all CSR and PEM certificates in the certificates store, those certificates can be used with HTTPS farms.
Response example:
The response will be a JSON object with a key set to params. The value of this will be an array of certificate objects, each of which contains the key attributes below.
{
"description" : "List all certificates",
"params" : [
{
"CN" : "Zen Load Balancer",
"creation" : "Jan 12 14:49:03 2011 GMT",
"expiration" : "Jan 9 14:49:03 2021 GMT",
"file" : "zencert.pem",
"issuer" : "Zen Load Balancer",
"type" : "Certificate"
}
]
}
Response parameters
Field | Type | Description |
---|---|---|
params | Object[ ] | Certificate objects list. |
Certificate Object
Field | Type | Description |
---|---|---|
CN | String | Domain common name. |
creation | String | Creation date. |
expiration | String | Expiration date. |
file | String | It is the file name of the certificate, unique ID. |
issuer | String | Certified Authority signing the certificate. |
type | String | CSR or Certificate. |
Download Certificate
Download Certificate
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/example.pem
zcli certificate download example.pem
GET /certificates/<file>
Download a certificate installed in the certificates store, use the file name in the request to identify it.
Response headers:
The response will include the headers indicated below with information about the file. The body of the response will be the content of the file.
HTTP/1.1 200 OK
Date: Thu, 22 Dec 2016 09:27:47 GMT
Content-Disposition: attachment; filename="example.pem"
Content-Type: application/x-download; charset=ISO-8859-1
Content-Length: 2359
Show Certificate details
Show Certificate details
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/example.pem/info
zcli certificate get example.pem
GET /certificates/<file>/info
Show all the information included in a given certificate in the certificates store, including signatures, it is required the file name to refer.
Response example:
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 14346016480403539444 (0xc71749fb005a45f4)
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=ES, ST=Spain, L=Spain, O=Sofintel, OU=Telecommunications, CN=Zen Load Balancer/emailAddress=zenloadbalancer-support@lists.sourceforge.net
Validity
Not Before: Jan 12 14:49:03 2011 GMT
Not After : Jan 9 14:49:03 2021 GMT
Subject: C=ES, ST=Spain, L=Spain, O=Sofintel, OU=Telecommunications, CN=Zen Load Balancer/emailAddress=zenloadbalancer-support@lists.sourceforge.net
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (1024 bit)
Modulus:
...
Delete a Certificate
Delete a Certificate
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/example.pem
zcli certificate delete example.pem
DELETE /certificates/<file>
Delete a certificate by file name in the certificates store.
Response example:
{
"description" : "Delete certificate",
"message" : "The Certificate example.pem has been deleted.",
"success" : "true"
}
Create a PEM certificate
Create a PEM certificate
Request example:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>" -H 'Content-Type: application/json'
-d '{"name":"host.domain.com","key":"-----BEGIN PRIVATE KEY-----\nRTQwew...",
"ca","-----BEGIN CERTIFICATE-----\nFQOEW...","intermediates":"-----BEGIN CERTIFICATE-----\nQWESw..."}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/pem
zcli certificate-pem create -name host.domain.com -key "-----BEGIN PRIVATE KEY..." -ca "-----BEGIN CERTIFICATE..." -intermediates "-----BEGIN CERTIFICATE..."
"
POST /certificates/pem
Create a PEM Certificate (PEM file).
Request parameters
Field | Type | Description | Required |
---|---|---|---|
name | String | Certificate ID name. | true |
key | String | No Encrypted Private Key | true |
ca | String | Server Certificate or fullchain Certificate | true |
intermediates | String | Intermediate Certificates if needed | false |
Response example:
{
"description" : "Create certificate",
"message" : "Certificate host.domain.com created",
"success" : "true"
}
Create a CSR certificate
Create a CSR certificate
Request example:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>" -H 'Content-Type: application/json'
-d '{"name":"NewCSR","fqdn":"host.domain.com","division":"IT","organization":"Example Corp.",
"locality":"Madrid","state":"Madrid","country":"ES","mail":"info@domain.com"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates
zcli certificate create -name NewCSR -fqdn host.domain.com -division IT -organization 'Example Corp.' -locality Madrid -state Madrid -country ES -mail info@domain.com
POST /certificates
Create a Certificate Signing Request (CSR file).
Request parameters
Field | Type | Description | Required |
---|---|---|---|
name | String | Certificate ID name. | true |
fqdn | String | The fully qualified domain name of your server. | true |
division | String | The division of your organization handling the certificate. | true |
organization | String | The legal name of your organization. | true |
locality | String | The city where your organization is located. | true |
state | String | The state/region where your organization is located. | true |
country | String | The two-letter ISO code for the country where your organization is localized. | true |
String | An email address used to contact your organization. | true |
Response example:
{
"description" : "Create CSR",
"message" : "Certificate NewCSR created",
"success" : "true"
}
Upload a Certificate
Upload a Certificate
Request example:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>" -H 'Content-Type: text/plain'
--tcp-nodelay --data-binary @/local_path/to/example.pem
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/example.pem
zcli certificate upload example.pem /local_path/to/example.pem
POST /certificates/<file>
Upload a PEM certificate for HTTP farms with HTTPS listener.
Request URI parameters
Requires the parameter --tcp-nodelay
, and --data-binary
to upload the file in binary mode.
Field | Type | Description | Required |
---|---|---|---|
file | String | Certificate file name to upload and save in the certificates store. | true |
Response example:
{
"description" : "Upload PEM certificate",
"message" : "Certificate uploaded",
"success" : "true"
}
List Ciphers
List Ciphers
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ciphers
GET /ciphers
List the available ciphers that an HTTPS farm can use.
The SSL offloading cipher will be available only if it is supported by the processor.
Response example:
The response will be a JSON object with a key set to params. The value of this will be an array of certificate objects, each of which contains the key attributes below.
{
"description" : "Get the ciphers available",
"params" : [
{
"ciphers" : "all",
"description" : "All"
},
{
"ciphers" : "highsecurity",
"description" : "High security"
},
{
"ciphers" : "customsecurity",
"description" : "Custom security"
},
{
"ciphers" : "ssloffloading",
"description" : "SSL offloading"
}
]
}
Response parameters
Field | Type | Description |
---|---|---|
params | Object[ ] | List of certificate objects. |
Certificate Object
Field | Type | Description |
---|---|---|
ciphers | String | It is used as a unique identifier. |
description | String | Friendly name. |
Letsencrypt SSL Certificates
Zevenet supports Letsencrypt certificates generation and renew. The finally certificate is a ZEVENET PEM certificate can be used with HTTPS Farms. . If you want to learn more about how to create pem certificates, please visit the following article: GENERATE CERTIFICATES IN PEM FORMAT
Show Letsencrypt Config
Show Letsencrypt Config
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/letsencryptz/config
zcli certificate-le-config list
GET /certificates/letsencryptz/config
Show Letsencrypt Configuration.
Response example:
The response will be a JSON object with the below parameters.
{
"description" : "Get LetsEncrypt Config",
"params" : {
"email" : "test_le@zevenet.com"
}
}
Response parameters
Field | Type | Description |
---|---|---|
String | Email for Letsencrypt |
Modify Letsencrypt Config
Modify Letsencrypt Config
Request example:
curl -k -X PUT -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"email":"test_le@zevenet.com"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/letsencryptz/config
zcli certificates-le-config set -email test_le@zevenet.com
PUT /certificates/letsencryptz/config
Modify Letsencrypt Configuration.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
String | Email for use as a contact in Letsencrypt | true |
Response example:
The response will be a JSON object with the below parameters.
{
"description" : "Modify LetsEncrypt Config",
"message" : "The Letsencrypt Config has been updated successfully.",
"params" : {
"email" : "test_le@zevenet.com"
},
"success" : "true"
}
Response parameters
Field | Type | Description |
---|---|---|
String | Email for Letsencrypt |
List all Letsencrypt Certificates
List all Letsencrypt Certificates
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/letsencryptz
zcli certificate-le list
GET /certificates/letsencryptz
List all Letsencrypt certificates created.
Response example:
The response will be a JSON object with a key set to params. The value of this will be an array of letsencrypt certificate objects, each of which contains the key attributes below.
{
"description" : "List LetsEncrypt certificates",
"params" : [
{
"CN" : "*.wildcard.test.zevenet.com",
"creation" : "May 31 05:51:49 2021 GMT",
"domains" : [
"*.wildcard.test.zevenet.com"
],
"expiration" : "Aug 29 05:51:49 2021 GMT",
"file" : "/usr/local/zevenet/config/letsencrypt/acme/*.wildcard.test.zevenet.com/fullchain.cer",
"issuer" : "US,(STAGING) Let's Encrypt,(STAGING) Artificial Apricot R3",
"status" : "valid",
"type" : "LE Certificate",
"wildcard" : "true"
},
{
"CN" : "*.test1.wildcard.test.zevenet.io",
"creation" : "",
"dnstxt" : [
{
"domain" : "*.test1.wildcard.test.zevenet.io",
"txt" : "QpbOLzMrJapoQmcbrA5_dr6ciwLzNF-y3z5XR5i-I2c"
}
],
"domains" : [
"*.test1.wildcard.test.zevenet.io"
],
"expiration" : "",
"file" : null,
"issuer" : "",
"status" : "not issued",
"type" : "LE Certificate",
"wildcard" : "true"
}
]
}
Response parameters
Field | Type | Description |
---|---|---|
params | Object[ ] | Certificate objects list. |
Certificate Object
Field | Type | Description |
---|---|---|
CN | String | Domain common name. |
creation | String | Creation date. |
domains | String[] | List of domains which the certificate is vaild for. |
expiration | String | Expiration date. |
dnstxt | Object[] | List of DNS TXT Records for each domains to validate if the certificate is not issued yet. |
file | String | It is the file name of the certificate, unique ID. |
issuer | String | Certified Authority signing the certificate. |
status | String | Status of the certificate.valid,the certificate is valid.about to expire, the certifiacte is about to expire.expired, the certificate is expired.not issued, the certificate is pendind to be issued.unknown, the certificate is not valid. |
type | String | LE Certificate. |
wildcard | String | true, the certificate is for wildcards domains. false, the certificate is for non wildcards domains. |
dnstxt Object
Field | Type | Description |
---|---|---|
domain | String | Domain name |
txt | String | DNS txt record LetsEncrypt must to validate. The DNS TXT record will be accesible by _acme-challenge.domain. |
Let’s Encrypt SSL Wildcard Certificates
Let’s Encrypt wildcard certificates are certificates valid only for wildcard domains.
Create a new Let’s Encrypt Wildcard Certificate
Create a new Let’s Encrypt Wildcard Certificate
Request example:
url -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"domains":["*.wildcard.test.zevenet.com"],"test":"true"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/letsencryptz-wildcard
zcli certificate-le-wildcard create -wildcard true
POST /certificates/letsencryptz-wildcard
Create a new Let’s Encrypt wildcard certificate.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
domains | String[] | List of domains which the certificate is vaild for. | true |
test | String | true, the certificate is issued by LetsEncrypt Staging Server. false, the certificate is issued by LetsEncrypt Server and it will valid for Production environment. | true |
Response example:
{
"description" : "Create Let's Encrypt Wildcard certificate",
"params" : [
{
"CN" : "*.wildcard.test.zevenet.com",
"creation" : "",
"dnstxt" : [
{
"domain" : "*.wildcard.test.zevenet.com",
"txt" : "jtt2WBHXl0cRw33mgoHUo1hbFGLipNbeb2EtTWpRORM"
}
],
"domains" : [
"*.wildcard.test.zevenet.com"
],
"expiration" : "",
"file" : null,
"issuer" : "",
"status" : "not issued",
"type" : "LE Certificate",
"wildcard" : "true"
}
]
}
Response parameters
Field | Type | Description |
---|---|---|
params | Object[] | Certificate objects list. |
Certificate Object
Field | Type | Description |
---|---|---|
CN | String | Domain common name. |
creation | String | Creation date. |
dnstxt | Object[] | List of DNS TXT Records for each domains to validate if the certificate is not issued yet. |
domains | String[] | List of domains which the certificate is vaild for. |
expiration | String | Expiration date. |
file | String | It is the file name of the certificate, unique ID. |
issuer | String | Certified Authority signing the certificate. |
status | String | Status of the certificate.valid,the certificate is valid.about to expire, the certifiacte is about to expire.expired, the certificate is expired.not issued, the certificate is pendind to be issued.unknown, the certificate is not valid. |
type | String | LE Certificate. |
wildcard | String | true, the certificate is for wildcards domains. false, the certificate is for non wildcards domains. |
dnstxt Object
Field | Type | Description |
---|---|---|
domain | String | Domain name |
txt | String | DNS txt record LetsEncrypt must to validate. The DNS TXT record will be accesible by _acme-challenge.domain. |
Set an action in a Let’s Encrypt Wildcard Certificate
Set an action in a Let’s Encrypt Wildcard Certificate
Request example:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"action":"renew","force_renewal":"true","restart":"true"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/letsencryptz-wildcard/*.example.domain.com/actions
zcli certificate-le-wildcard renew *.example.domain.com
POST /certificates/letsencryptz-wildcard/<domain>/actions
Apply an action to a Let’s Encrypt certificate, see the Request parameters table for actions.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
actions | String | The action to execute, the possibilities are: renew, the certificate will be renew; test the dns txt records will be checked via dns query. | |
force_renewal | String | (Only for “renew” action ) true, force the certificate to be renewed even it is not expired, false, the certificate will be renewed if it is due to be renewed ( less than 30 days to expire ). | |
restart | String | (Only for “renew” action ) true, all the farms using the certificate will be restarted. false, no farms using the certificate will be restarted. | |
dns | String | (Only for “test” action ) Dns server to be used to test the DNS TXT record _acme-challenge.domain. |
Response example:
{
"description" : "Let's Encrypt wildcard certificate actions",
"message" : "The action renew has been performed in Let's Encrypt certificate *.test1.wildcard.test.zevenet.io.",
"params" : {
"action" : "renew",
"status" : "valid"
}
}
Response parameters
Field | Type | Description |
---|---|---|
params | Object[ ] | Certificate objects list. |
Certificate Object
Field | Type | Description |
---|---|---|
action | String | Creation date. |
status | String | Status of the certificate.valid,the certificate is valid.about to expire, the certifiacte is about to expire.expired, the certificate is expired.not issued, the certificate is pendind to be issued.unknown, the certificate is not valid. |
dnstxt | Object[] | (Only for “test” action ) List of DNS TXT Records for each domains and their dns query results via a DNS server. |
dnstxt Object
Field | Type | Description |
---|---|---|
dns | String | DNS Server to be used. “blank” means use the configured in the system. |
domain | String | Domain name |
resource | Object | DNS resource to be checked. |
status | String | Result from checking DNS TXT Record via DNS server. down if DNS TXT re |
cord is not found DNS server. up if DNS TXT record is found.
resource Object
Field | Type | Description |
---|---|---|
rname | String | DNS resource name. Let’s Encrypt requires _acme-challenge |
type | String | DNS record type. Let’s Encrypt requires TXT |
rdata | String | DNS record value. |
Delete a wildcard Let’s Encrypt Certificate
Delete a wildcard Let’s Encrypt Certificate
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/letsencryptz-wildcard/*.example.domain.com
zcli certificate-le-wildcard delete *.example.domain.com
DELETE /certificates/letsencryptz-wildcard/<domain>
Delete a Let’s Encrypt wildcard certificate by domain.
Response example:
{
"description" : "Delete Let's Encrypt wildcard certificate",
"message" : "Let's Encrypt wildcard Certificate example.domain.com has been deleted.",
"success" : "true"
}
Let'sEncrypt SSL No Wildcard Certificates
Let'sEncrypt no wildcard certificates are certificates valid only for no wildcard domains.
Create a new Let'sEncrypt No Wildcard Certificate
Create a new Let’s Encrypt No Wildcard Certificate
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"farmname":"lefarm","domains":["test.zevenet.com"],"test":"true","wildcard":"false"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/letsencryptz
zcli certificate-le create -wildcard false
POST /certificates/letsencryptz
Create a new Let’s Encrypt wildcard certificate.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
farmname | String | Farm name which a temporal Service “Let’s Encryptz” is configured in. | true if param vip is not sent. |
vip | String | IP of the system, where a temporal Farm “Let’s Encryptz” is configured. | true if param farmname is not sent. |
domains | String[] | List of domains which the certificate is vaild for. | true |
wildcard | String | true, the certificate is for wildcards domains. false, the certificate is for non wildcards domains. | true |
test | String | true, the certificate is issued by LetsEncrypt Staging Server. false, the certificate is issued by LetsEncrypt Server and it will valid for Production environment. | true |
Response example:
{
"description" : "Create Let's Encrypt certificate",
"params" : {
"CN" : "test.zevenet.com",
"creation" : "May 31 11:05:30 2021 GMT",
"domains" : [
"test.zevenet.io"
],
"expiration" : "Aug 29 11:05:30 2021 GMT",
"file" : "/usr/local/zevenet/config/letsencrypt/live/test.zevenet.com/fullchain.pem",
"issuer" : "US,(STAGING) Let's Encrypt,(STAGING) Artificial Apricot R3",
"status" : "valid",
"type" : "LE Certificate",
"wildcard" : "false"
}
}
Response parameters
Field | Type | Description |
---|---|---|
params | Object[ ] | Certificate objects list. |
Certificate Object
Field | Type | Description |
---|---|---|
CN | String | Domain common name. |
creation | String | Creation date. |
domains | String[] | List of domains which the certificate is vaild for. |
expiration | String | Expiration date. |
file | String | It is the file name of the certificate, unique ID. |
issuer | String | Certified Authority signing the certificate. |
status | String | Status of the certificate.valid,the certificate is valid.about to expire, the certifiacte is about to expire.expired, the certificate is expired.not issued, the certificate is pendind to be issued.unknown, the certificate is not valid. |
type | String | LE Certificate. |
wildcard | String | true, the certificate is for wildcards domains. false, the certificate is for non wildcards domains. |
Set an action in a Let’s Encrypt no Wildcard Certificate
Set an action in a Let’s Encrypt No Wildcard Certificate
Request example:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"action":"renew","vip":"192.168.101.44","force_renewal":"true","restart":"true"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/letsencryptz/example.domain.com/actions
zcli certificate-le renew example.domain.com ( not implemented )
POST /certificates/letsencryptz/<domain>/actions
Set an action in a Let’s Encrypt no wildcard certificate, see the Request parameters table for actions.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
action | String | The action to execute: the possibilities are: renew, the certificatewill be renewed. | |
farmname | String | Farm name which a temporal Service “Let’s Encryptz” is configured in to renew the certificate. | true if param vip is not sent. |
vip | String | IP of the system, where a temporal Farm “Let’s Encryptz” is configuredi to renew the certificate. | true if param farmname is not sent. |
force_renewal | String | true, force the certificate to be renewed even it is not expired, false, the certificate will be renewed if it is due to be renewed ( less than 30 days to expire ). | |
restart | String | true, all the farms using the certificate will be restarted. false, no farms using the certificate will be restarted. |
Response example:
{
"description" : "Let's Encrypt certificate actions",
"params" : {
"CN" : "test.zevenet.com",
"creation" : "May 31 11:35:08 2021 GMT",
"domains" : [
"test.zevenet.com"
],
"expiration" : "Aug 29 11:35:08 2021 GMT",
"file" : "/usr/local/zevenet/config/letsencrypt/live/test.zevenet.com/fullchain.pem",
"issuer" : "US,(STAGING) Let's Encrypt,(STAGING) Artificial Apricot R3",
"status" : "valid",
"type" : "LE Certificate",
"wildcard" : "false"
},
"warning" : "The following farms were been restarted: testl7farm"
}
Response parameters
If the are farms were been restarted, the warning field will describe it.
Field | Type | Description |
---|---|---|
params | Object[ ] | Certificate objects list. |
Certificate Object
Field | Type | Description |
---|---|---|
CN | String | Domain common name. |
creation | String | Creation date. |
domains | String[] | List of domains which the certificate is vaild for. |
expiration | String | Expiration date. |
file | String | It is the file name of the certificate, unique ID. |
issuer | String | Certified Authority signing the certificate. |
status | String | Status of the certificate.valid,the certificate is valid.about to expire, the certifiacte is about to expire.expired, the certificate is expired.not issued, the certificate is pendind to be issued.unknown, the certificate is not valid. |
type | String | LE Certificate. |
wildcard | String | true, the certificate is for wildcards domains. false, the certificate is for non wildcards domains. |
Delete a no wildcard Let’s Encrypt Certificate
Delete a no wildcard Let’s Encrypt Certificate
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/certificates/letsencryptz/example.domain.com
zcli certificate-le delete example.domain.com
DELETE /certificates/letsencryptz/<domain>
Delete a Let’s Encrypt certificate by domain.
Response example:
{
"description" : "Delete Let's Encrypt certificate",
"message" : "Let's Encrypt Certificate example.domain.com has been deleted.",
"success" : "true"
}
Farms
Zevenet can manage traffic in three different ways, each way is managed by a different module, Local service load balancer or LSLB module, Global Service Load Balancer or GSLB module and Datalink Service Load Balancer or DSLB module.
All modules work with the Farm profile concept, a Farm profile is a group of parameters ready to do a specific action with the network traffic, it is important to understand what can do each farm profile to obtain the best results of Zevenet ADC.
- LSLB: This module can work with http and l4xnat profile farms. It works as a web reverse proxy or router
- GSLB: This module can work with gslb profile farm. It works as Domain Name Server
- DSLB: This module can work with datalink profile farm. It works as a gateway.
List a summary of farms
List a summary farms
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/modules/summary
GET /farms/modules/summary
List a summary with the farms in the system, grouped by module.
Response example:
{
"description" : "Farm Modules summary",
"params" : {
"dslb" : [],
"gslb" : [
{
"name" : "dnsServ",
"profile" : "gslb",
"services" : []
}
],
"lslb" : [
{
"name" : "CatalogueWeb",
"profile" : "http",
"services" : [
"technology",
"food"
]
},
{
"name" : "shopApp",
"profile" : "http",
"services" : [
"provider",
"clients"
]
},
{
"name" : "VirtualApps",
"profile" : "l4xnat"
}
]
}
}
Response parameters
The response will be a JSON object with a key set to params. The value of this will be an array of farms with their services.
Farm Object:
Field | Type | Description |
---|---|---|
farmname | String | Farm descriptive name. It is used as a unique identifier for farms. |
profile | String | Profile type, the profile available values are: http, https or l4xnat for LSLB module, gslb for GLSB module and datalink for DSLB module |
service | String[] | It is the list of services name that the farm contains. This field will be available in farms of type http, https, and gslb. |
List all farms
List all farms
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms
zcli farm list
GET /farms
List all available farms
Response example:
{
"description" : "List farms",
"params" : [
{
"farmname" : "httpFarm",
"profile" : "http",
"status" : "up",
"vip" : "192.168.101.146",
"vport" : "81"
}
]
}
Response parameters
The response will be a JSON object with a key set to params. The value of this will be an array of farm resume objects, each of which contains the key attributes below.
Farm Object:
Field | Type | Description |
---|---|---|
farmname | String | Farm descriptive name. It is used as a unique identifier for farms. |
profile | String | Profile type, the profile available values are: http, https or l4xnat for LSLB module, gslb for GLSB module and datalink for DSLB module. |
status | String | Farm status. The available status values are: down, the farm is not running; needed restart, the farm is up but it is pending of a restart action; critical, the farm is up and all backends are unreachable or maintenance; problem, the farm is up and there are some backend unreachable, but almost a backend is in up status; maintenance, the farm is up and there are backends in up status, but almost a backend is in maintenance mode; up, the farm is up and all the backends are working success. |
vip | String | Virtual IP where the farm is receiving traffic. |
vport | String | Virtual Port where farm is receiving traffic, port available values are: a port number for http[s], l4xnat and gslb profiles, a group of ports separated by “,” or a port range separated by “:” for l4xnat profiles, in l4xnat both separator values (“,” and “:”) can be used at the same field. |
Delete a Farm
Delete a Farm
Request example:
curl --tlsv1 -k -X DELETE -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/FarmHTTP
zcli farm delete FarmHTTP
DELETE /farms/<farmname>
Delete a farm through its farm name identifier.
Response example:
{
"description" : "Delete farm FarmHTTP",
"message" : "The Farm FarmHTTP has been deleted.",
"success" : "true"
}
Set an action in a Farm
Set an action in a Farm
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"action":"stop"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/FarmTCP/actions
zcli farm stop FarmTCP
PUT /farms/<farmname>/actions
Apply an action to a farm, see the Request parameters table for actions.
Request parameters
Field | Type | Description |
---|---|---|
action | String | The action to execute, the possibilities are: stop, the farm will be stopped, cutting the current connections and does not accepting more connections; start, the farm will be started, running the listener and balancing the new connections between its backends; restart, the farm will be stopped and started automatically. |
Response example:
{
"description" : "Set a new action in FarmHTTP",
"params" : [
{
"action" : "stop"
}
]
}
Response parameters
If there are no issues in the configuration then ZAPI will return the requested action.
HTTP Farms
The HTTP profile is an advanced layer 7 load balancing (or Application Delivery Controller) with proxy special properties. This profile offers some features like HTTPS load balancing combined with SSL offload acceleration. This profile is adequate for web services (web application servers included) and all application protocols based on HTTP and HTTPS protocols like WebDav, RDP over HTTP, ICA over HTTP, etc. To configure this farm profile, a virtual IP address and a virtual TCP port will be required.
Retrieve farm by name
Retrieve farm by name
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/httpFarm
zcli farm get httpFarm
GET /farms/<farmname>
Show all configuration about a given farm.
Response example:
{
"description" : "List farm httpFarm",
"ipds" : {
"blacklists" : [
{
"name" : "outside",
"status" : "down"
}
],
"dos" : [],
"rbl" : [
{
"name" : "protection_ssh",
"status" : "up"
}
],
"waf" : [
{
"name" : "XSSi",
"status" : "down"
},
{
"name" : "SQLi",
"status" : "up"
}
]
},
"params" : {
"addheader" : [
{
"header" : "load-balancer: true",
"id" : 0
}
],
"addresponseheader" : [
{
"header" : "Session: true",
"id" : 0
}
],
"certlist" : [
{
"file" : "zencert.pem",
"id" : 1
}
],
"cipherc" : "ALL",
"ciphers" : "all",
"contimeout" : 20,
"disable_sslv2" : "true",
"disable_sslv3" : "false",
"disable_tlsv1" : "false",
"disable_tlsv1_1" : "true",
"disable_tlsv1_2" : "false",
"errorWAF" : "The request was rejected by the server.",
"error414" : "Request URI is too long.",
"error500" : "An internal server error occurred. Please try again later.",
"error501" : "This method may not be used.",
"error503" : "The service is not available. Please try again later.",
"headremove" : [
{
"id" : 0,
"pattern" : "^client"
}
],
"httpverb" : "MSRPCext",
"ignore_100_continue" : "true",
"listener" : "https",
"logs" : "false",
"removeresponseheader" : [
{
"id" : 0,
"pattern" : "Host"
}
],
"reqtimeout" : 30,
"restimeout" : 45,
"resurrectime" : 10,
"rewritelocation" : "enabled",
"status" : "up",
"vip" : "192.168.100.211",
"vport" : 200
},
"services" : [
{
"backends" : [],
"cookiedomain" : "",
"cookieinsert" : "false",
"cookiename" : "",
"cookiepath" : "",
"cookiettl" : 0,
"farmguardian" : "check_tcp",
"httpsb" : "false",
"id" : "service3",
"leastresp" : "false",
"redirect" : "http://192.168.101.254/index.html",
"redirect_code" : 302,
"redirecttype" : "default",
"sessionid" : "",
"sts_status" : "false",
"sts_timeout" : 0,
"ttl" : 0,
"urlp" : "",
"vhost" : "",
"pinnedconnection" : 0,
"routingpolicy" : "ROUND_ROBIN"
},
{
"backends" : [
{
"alias" : "http-server",
"id" : 0,
"ip" : "192.168.0.168",
"port" : 80,
"status" : "up",
"timeout" : null,
"weight" : null,
"priority" : null
}
],
"cookiedomain" : "",
"cookieinsert" : "false",
"cookiename" : "",
"cookiepath" : "",
"cookiettl" : 0,
"farmguardian" : null,
"httpsb" : "false",
"id" : "srv",
"leastresp" : "false",
"persistence" : "",
"redirect" : "",
"redirecttype" : "",
"sessionid" : "",
"sts_status" : "false",
"sts_timeout" : 0,
"ttl" : 0,
"urlp" : "",
"vhost" : "",
"pinnedconnection" : 0,
"routingpolicy" : "ROUND_ROBIN"
},
]
}
Response parameters
The response will be a JSON object with the format below.
Farm Object:
Field | Type | Description |
---|---|---|
ipds | Object | List of IPDS rules applied to this farm. |
params | Object | Parameters of farm configuration. |
services | Object[] | Array with all services created in this farm and its configuration. |
IPDS Object:
Field | Type | Description |
---|---|---|
blacklists | Object[] | Blacklist rules applied to the farm. |
dos | Object[] | DoS rules applied to the farm. |
rbl | Object[] | RBL rules applied to the farm. |
waf | Object[] | It is an object with one key, name. |
Blacklist, DoS and RBL Object:
Field | Type | Description |
---|---|---|
name | String | The rule name. |
status | String | Rule status. |
Parameters object for HTTP farms:
Field | Type | Description |
---|---|---|
addheader | Object[] | It is a list of objects with the headers to add to the client request. |
addresponseheader (from 4.0.1) | Object[] | It is a list of objects with the headers to add to the backend response. |
certlist | Object[] | Only if the listener is HTTPS. Certificates list is been used by the farm, they have in PEM format, it is allowed to add more than one PEM certificate to the same farm for SNI support. Any certificate in the certificates store can be used here. |
cipherc | String | Only in https listener. This is the allowed customized list of ciphers that will be accepted by the SSL connection, which it’s a string in the same format as in OpenSSL ciphers. This attribute is used only when ciphers field has the value “customsecurity”. |
ciphers | String | Only if the listener is HTTPS. Used to build a list of ciphers accepted by SSL connections to harden the SSL connection. The options are: all, all the ciphers will be accepted; highsecurity, only ciphers for high security will be accepted; customsecurity, only ciphers loaded in cipherc field will be accepted; or ssloffloading, it devolves the encrypting job to the process, this cipher depends on the processor. |
contimeout | Number | How long the farm is going to wait for a TCP connection to the backend in seconds. |
disable_sslv2 | String | Only in https listener. If this field has the value true the connections using an SSL security protocol with version 2 is not allowed; or false if the protocol SSLv2 is allowed. |
disable_sslv3 | String | Only in https listener. If this field has the value true the connections using an SSL security protocol with version 3 is not allowed; or false if the protocol SSLv3 is allowed. |
disable_tlsv1 | String | Only in https listener. If this field has the value true the connections using TLS security protocol with version 1 is not allowed; or false if the protocol TLSv1 is allowed. |
disable_tlsv1_1 | String | Only in https listener. If this field has the value true the connections using TLS security protocol with version 1.1 is not allowed; or false if the protocol TLSv1.1 is allowed. |
disable_tlsv1_2 | String | Only in https listener. If this field has the value true the connections using TLS security protocol with version 1.2 is not allowed; or false if the protocol TLSv1.2 is allowed. |
errorWAF | String | Personalized message for responding when WAF rejects a request (from 4.0.2). |
error414 | String | Personalized message for responding with the 414 HTTP error code. |
error500 | String | Personalized message for responding with the 500 HTTP error code. |
error501 | String | Personalized message for responding with the 501 HTTP error code. |
error503 | String | Personalized message for responding with the 503 HTTP error code. |
headremove | Object[] | It is a list of regular expressions to remove headers from the client requests. The removed headers will not reach the backend. |
httpverb | String | This field indicates the operations that will be permitted to the HTTP client requests. available values are: standardHTTP, accepted HTTP requests GET, POST, HEAD. extendedHTTP, accepted previous HTTP requests plus PUT,DELETE. optionsHTTP (from 4.0.1), add the OPTIONS verb to the previous ones. standardWebDAV, accepted previous HTTP requests plus LOCK, UNLOCK, PROPFIND, PROPPATCH, SEARCH, MKCOL, MOVE, COPY, OPTIONS, TRACE, MKACTIVITY, CHECKOUT, MERGE, REPORT, MSextWebDAV accepted previous HTTP requests plus SUBSCRIBE, UNSUBSCRIBE, NOTIFY, BPROPFIND, BPROPPATCH, POLL, BMOVE, BCOPY, BDELETE, CONNECT, or MSRPCext, accepted previous HTTP requests plus RPC_IN_DATA, RPC_OUT_DATA. Note that those values are case-sensitive. |
ignore_100_continue | String | If this field has the value true the 100 continue HTTP header will be ignored; if the value is false, the 100 continue header will be processed. |
listener | String | A listener defines how the farm is going to play with the requests from the clients. The options are: http for not secured protocol or https for secured protocol. |
logs | String | The farm Logs the trace of the HTTP connections. If this parameter has the value true, the logs are enabled; if it has the value false, logs are disabled. |
removeresponseheader (from 4.0.1) | Object[] | It is a list of regular expressions to remove headers from the backend response. The removed headers will not reach the client. |
reqtimeout | Number | How long the farm is going to wait for a client request in seconds. |
restimeout | Number | How long the farm is going to wait for a response from the backends in seconds. |
resurrectime | Number | The period to get out a fallen real server, after this period the load balancer checks if the real server is alive, in seconds. |
rewritelocation | Object[] | If it is enabled, the farm is forced to modify the Location: and Content-location: headers in responses to clients with the virtual host. The options are: enabled, activated disabled, inactivated or enabled-backends only the backend address is compared. From 4.0.2 new options availables: enabled-path and enabled-backends-path. the path applies if the RewriteUrl directive modified the request URL. This flag forces to revert the URL transformation that RewriteUrl did. |
status | String | Farm status. The available status values are: down, the farm is not running; needed restart, the farm is up but it is pending of a restart action; critical, the farm is up and all backends are unreachable or maintenance; problem, the farm is up and there are some backend unreachable, but almost a backend is in up status; maintenance, the farm is up and there are backends in up status, but almost a backend is in maintenance mode; up, the farm is up and all the backends are working success. |
vip | String | IP of the farm, where the virtual service is listening. |
vport | Number | Port of the farm, where the virtual service is listening. |
Certlist Object:
Field | Type | Description |
---|---|---|
file | String | The certificate name, references to the certificate in the certificates store. |
id | Number | Certificate ID, The order in the list, first one will be the used by default if virtual host header doesn’t match with CN field in the certificate. Used for SNI. |
Services object for HTTP farms:
Field | Type | Description |
---|---|---|
backends | Object[] | Backends defined in the service. |
cookiedomain | String | Cookie insertion will be executed if the domain matches in the cookie content. Enable cookieinsert field is required. |
cookieinsert | String | It enables the cookie insertion for backends sticky sessions. The options are true, the profile will search the given cookie in field cookiename, if it doesn’t exist then this cookie will be added, false, no action is taken. |
cookiename | String | The cookie name (session ID) will be used for identifying the sticky process to backends. Enable cookieinsert field is required. |
cookiepath | String | It manages the cookie path value for the given cookie. Enable cookieinsert field is required. |
cookiettl | Number | It is the max time of life for a cookie, in seconds. Enable cookieinsert field is required. |
farmguardian | String | It is the FarmGuardian name that is checking the backend status. FarmGuardian will be running while the farm is in up status. |
httpsb | String | This parameter indicates to the farm that the backends are set to use the HTTPS language and then the data will be encrypted before to be sent. true, the profile sends the traffic in HTTPS protocol to the backends, false, the profile sends the traffic in HTTP protocol to the backends. |
id | String | Service’s name, it can’t be modified once the service is created. |
leastresp | String | It enables the least response balancing method. true frequently the profile checks which backend is taking less time to respond to send more connections to this one, the false profile doesn’t check which backend is taking less time to respond. |
persistence | String | This parameter defines how the HTTP service is going to manage the client session. The options are: “” empty string, no action is taken, IP the persistence session is done in base of client IP, BASIC the persistence session is done in base of BASIC headers, URL the persistence session is done in base of a field in the URI, PARM the persistence session is done in base of a value at the end of the URI, COOKIE the persistence session is done in base of a cookie name, this cookie has to be created by the backends, and HEADER, the persistence session is done in base of a Header name. |
redirect | String | It behaves like a special backend, as the client request is answered by a redirect to a new URL automatically. If the redirect is configured then the request will not be forwarded to the backend, a Redirect will be responded to the client instead. |
redirect_code | Number | It is the HTTP code returned when a redirect is configurated. The possible values are 301, 302, 307, |
redirecttype | String | How the redirection will be done, two options: default, the URL is taken as an absolute host and path to redirect to, append, the original request path or URI will be appended to the host and path you specified with default option. If redirect field is not configurated, this field will be an empty string. |
sessionid | String | It is available if persistence field is URL, COOKIE or HEADER, the parameter value will be searched by the farm in the HTTP header and will manage the client session. |
sts_status | String | Status of the Strict Transport Security header. To enable this feature, it is necessary to set the farm listener as HTTPS. The possible values are: true to enable STS directive in the service; or false to disable STS directive in the service. |
sts_timeout | Number | Time (in seconds) that the client remember that the service only is available with HTTS. |
ttl | Number | Only with persistence. This value indicates the max time of life for an inactive client session (max session age) in seconds. |
urlp | String | Allows determining a web service regarding the URL the client is requesting through a specific URL pattern which will be syntactically checked. PCRE regular expression is supported. |
vhost | String | It specifies the condition determined by the domain name through the same virtual IP and port defined by an HTTP farm. PCRE regular expression is supported. |
pinnedconnection (from version 4.0.2) | Number | Specify if we want to pin all the connections, (default: 0, no pinned). If Pinnedconnection is set to 1, zproxy directly forwards all data without parsing or editing. |
routingpolicy (from version 4.0.2) | String | Specify the routing policy. All the algorithms are weighted with all the weights set in each backend. There is four options: ROUND_ROBIN use the round robin algorithm as a routing policy (default). LEAST_CONNECTIONS select the backend with least connections established using as a proportion the weights set. RESPONSE_TIME select the backend with the lowest response time using as a proportion the weights set. PENDING_CONNECTIONS select the backend with least pending connections using as a proportion the weights set. |
rewriteurl (from version 4.0.2) | Object[] | It checks a pattern in order to get strings from URL and replace them. Several RewriteUrl directives can be added. All of them will be sequentially applied to the incoming URL unless the last flag is set that will finish the rewrite url phase. |
Backend object for HTTP farms:
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the backend. Alias |
id | Number | Backend identifier inside the given service. |
ip | String | Backend’s IP where the real service is running. |
port | Number | Backend’s port where the real service is running. |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; maintenance, backend is marked as not ready for receiving connections by the administrator, this option is useful for backend’s maintenance tasks; undefined, the backend status has been not checked. |
timeout | Number | It’s the maximum time waiting for the backend response before than marking it as unavailable. This time is in seconds. |
weight | Number | It’s the weight value for the current real server, backend with higher weight value will receive more connections. Default value null, not special weight used for this backend. The possible values are from 1 to 9. |
priority (from 4.0.1) | Number | (Only when proxy new generation is working) It’s the priority value for the current real server, backend with lower priority value will be ready to receive connections before than others with higher priority. Default value null, a priority value 1 is used. The possible values are from 1 to 9 |
connection_limit (from 4.0.2) | Number | (Only when proxy new generation is working) The maximum number of established connection per backend. With a value of 0, there will not be a limit in the backend. The client will receive a 503 error if there aren’t available backends. |
Create a new Farm
Create a new Farm
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"farmname":"newHTTPfarm", "profile":"http", "vip":"192.168.100.23",
"vport":80}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms
zcli farm create -farmname newHTTPfarm -profile http -vip 192.168.100.23 -vport 80
POST /farms
Create a new HTTP farm.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
farmname | String | Farm descriptive name. It is used as a unique identifier. | true |
profile | String | The profile of the created Farm. For HTTP farms is http. | true |
vip | String | IP of the farm, where the virtual service is going to run. The indicated IP must be configured in the system and UP | true |
vport | Number | Port of the farm, where the virtual service is going to listen. The same virtual port and virtual IP must not be in use by another farm. | true |
copy_from (from 4.0.1) | String | This parameter expects the name of a farm that exists. If this parameter is sent, the farm is copied from the farm specified in it. The farmname, vip and vport values will be overwritten. |
Response example:
{
"description" : "Creating farm 'newHTTPfarm'",
"params" : {
"interface" : "eth0.2",
"farmname" : "newHTTPfarm",
"profile" : "http",
"vip" : "192.168.100.23",
"vport" : 80
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Modify a Farm
Modify a Farm
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"contimeout":22,"newfarmname":"FarmHTTP2","vip":"178.62.126.152","vport":88,"ignore_100_continue":"true",
"restimeout":47,"resurrectime":12,"reqtimeout":32,"rewritelocation":"enabled","httpverb":"standardHTTP", "errorWAF":"Message error WAF",
"error414":"Message error 414","error500":"Message error 500","error501":"Message error 501",
"error503":"Message error 503","listener":"https","ciphers":"customsecurity","disable_sslv2":"true",
"disable_sslv3":"false","disable_tlsv1":"false","disable_tlsv1_1":"true","disable_tlsv1_2":"false", "logs":"true",
"cipherc":"TLSv1+SSLv3+HIGH:-MEDIUM:-LOW*:-ADH*"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/FarmHTTP
zcli farm set FarmHTTP -contimeout 22 -newfarmname FarmHTTP2 -vip 178.62.126.152 -vport 88 -ignore_100_continue true -restimeout 47 -resurrectime 12 -reqtimeout 32 -rewritelocation enabled -httpverb standardHTTP -errorcode414 'Message error 414' -logs true
PUT /farms/<farmname>
Modify global parameters for a given HTTP farm.
Request parameters
Field | Type | Description |
---|---|---|
contimeout | Number | How long the farm is going to wait for a connection to the backend in seconds. |
restimeout | Number | How long the farm is going to wait for a response from the backends in seconds. |
resurrectime | Number | This value in seconds is the period to get out a blacklisted backend and checks if it is alive. |
reqtimeout | Number | How long the farm is going to wait for a client request in seconds. |
disable_sslv2 | String | Only in https listener. If this field has the value true the connections using an SSL security protocol with version 2 is not allowed; or false if the protocol SSLv2 is allowed. |
disable_sslv3 | String | Only in https listener. If this field has the value true the connections using an SSL security protocol with version 3 is not allowed; or false if the protocol SSLv3 is allowed. |
disable_tlsv1 | String | Only in https listener. If this field has the value true the connections using TLS security protocol with version 1 is not allowed; or false if the protocol TLSv1 is allowed. |
disable_tlsv1_1 | String | Only in https listener. If this field has the value true the connections using TLS security protocol with version 1.1 is not allowed; or false if the protocol TLSv1.1 is allowed. |
disable_tlsv1_2 | String | Only in https listener. If this field has the value true the connections using TLS security protocol with version 1.2 is not allowed; or false if the |
rewritelocation | String | If it is enabled, the farm is forced to modify the Location: and Content-location: headers in responses to clients with the virtual host. The options are: enabled activated; disabled inactivated; or enabled-backends only the backend address is compared. |
httpverb | String | This field indicates the operations that will be permitted to the HTTP client requests. available values are: standardHTTP, accepted HTTP requests GET, POST, HEAD. extendedHTTP, accepted previous HTTP requests plus PUT,DELETE. optionsHTTP (from 4.0.1), add the OPTIONS verb to the previous ones. standardWebDAV, accepted previous HTTP requests plus LOCK, UNLOCK, PROPFIND, PROPPATCH, SEARCH, MKCOL, MOVE, COPY, OPTIONS, TRACE, MKACTIVITY, CHECKOUT, MERGE, REPORT, MSextWebDAV accepted previous HTTP requests plus SUBSCRIBE, UNSUBSCRIBE, NOTIFY, BPROPFIND, BPROPPATCH, POLL, BMOVE, BCOPY, BDELETE, CONNECT, or MSRPCext, accepted previous HTTP requests plus RPC_IN_DATA, RPC_OUT_DATA. Note that those values are case-sensitive. |
ignore_100_continue | String | If this field has the value true the 100 continue HTTP header will be ignored; if the value is false, the 100 continue header will be processed. |
errorWAF | String | Personalized message error WAF (from version 4.0.2). |
error414 | String | Personalized message error 414. |
error500 | String | Personalized message error 500. |
error501 | String | Personalized message error 501. |
error503 | String | Personalized message error 503. |
listener | String | A listener defines how the farm is going to play with the requests from the clients. The options are: http for not secured protocol or https for secured protocol. |
logs | String | The farm Logs the trace of the HTTP connections. If this parameter has the value true, the logs are enabled; if it has the value false, logs are disabled. |
ciphers | String | Only in listener with https value. Used to build a list of ciphers accepted by SSL connections in order to harden the SSL connection. The options are: all, all the ciphers will be accepted; highsecurity, only ciphers for high security will be accepted; customsecurity, only ciphers loaded in cipherc field will be accepted; or ssloffloading, it devolves the encrypting job to the process, this cipher depends on the processor. |
cipherc | String | Only in https listener. This is the allowed customized list of ciphers that will be accepted by the SSL connection, which it’s a string in the same format as in OpenSSL ciphers. This attribute is used only when ciphers field has the value “customsecurity”. |
newfarmname | String | The new Farm’s name. The farm must be stopped. |
vport | Number | Port of the farm, where the virtual service is listening. |
vip | String | IP of the farm, where the virtual service is listening, this IP must be configured and up in the system. |
certname | String | Https certificate configured |
Response example:
{
"description" : "Modify farm FarmHTTP",
"params" : {
"cipherc" : "TLSv1+SSLv3+HIGH:-MEDIUM:-LOW*:-ADH*",
"ciphers" : "customsecurity",
"contimeout" : 22,
"disable_sslv2" : "true",
"disable_sslv3" : "false",
"disable_tlsv1" : "false",
"disable_tlsv1_1" : "true",
"disable_tlsv1_2" : "false",
"errorWAF" : "Message error WAF",
"error414" : "Message error 414",
"error500" : "Message error 500",
"error501" : "Message error 501",
"error503" : "Message error 503",
"httpverb" : "standardHTTP",
"ignore_100_continue" : "true",
"listener" : "https",
"logs" : "true",
"newfarmname" : "FarmHTTP",
"reqtimeout" : 32,
"restimeout" : 47,
"resurrectime" : 12,
"rewritelocation" : "enabled",
"vip" : "178.62.126.152",
"vport" : 88
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Add a Custom Header to the Request
Add a Custom Header to the Request
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"loadbalancer: true"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/addheader
zcli farm-add-request-header MyHttpFarm -header "loadbalancer: true"
POST /farms/<farmname>/addheader
The farm will add the header to the backend.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | It is a string with the header that will be sent to the backend. | true |
Response example:
{
"description" : "Add addheader directive.",
"message" : "Added a new item to the addheader list",
"status" : "needed restart",
"success" : "true"
}
Modify an add a Custom Header to the Request rule
Modify an add a Custom Header to the Request rule
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"loadbalancer: true"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/addheader/id
zcli farm-add-request-header MyHttpFarm -header "loadbalancer: true"
PUT /farms/<farmname>/addheader/<id>
The farm will add the header to the backend.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | It is a string with the header that will be sent to the backend. | true |
Response example:
{
"description" : "Modify an addheader directive.",
"message" : "Modified an item from the addheader list",
"success" : "true"
}
Delete a Custom Header from the Request
Delete a Custom Header from the Request
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/addheader/0
zcli farm-add-request-header remove MyHttpFarm 0
DELETE /farms/<farmname>/addheader/<index>
index is the index of the addheader array to delete.
Response example:
{
"description" : "Delete addheader directive.",
"message" : "The addheader 0 was deleted successfully",
"status" : "needed restart",
"success" : "true"
}
Add Rule to Remove Headers from the Request
Add Rule to Remove Headers from the Request
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"pattern":"^client:"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/headremove
zcli farm-remove-request-header add MyHttpFarm -pattern "^client:"
POST /farms/<farmname>/headremove
Remove certain headers from the incoming requests. All occurrences of the matching specified header will be removed.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
pattern | String | It is a string with a regexp to look for in the client requests. If some header matches in the pattern, the header will be removed | true |
Response example:
{
"description" : "Add headremove directive.",
"message" : "Added a new item to the headremove list",
"status" : "needed restart",
"success" : "true"
}
Modify a Remove Headers from the Request rule
Modify a Remove Headers from the Request rule
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"pattern":"^client:"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/headremove/id
zcli farm-remove-request-header add MyHttpFarm -pattern "^client:"
PUT /farms/<farmname>/headremove/<id>
Remove certain headers from the incoming requests. All occurrences of the matching specified header will be removed.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
pattern | String | It is a string with a regexp to look for in the client requests. If some header matches in the pattern, the header will be removed | true |
Response example:
{
"description" : "Modify an headremove directive.",
"message" : "Modified an item from the headremove list",
"success" : "true"
}
Delete a Rule to Remove Headers from the Request
Delete a Rule to Remove Headers from the Request
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/headremove/0
zcli farm-remove-request-header remove MyHttpFarm 0
DELETE /farms/<farmname>/headremove/<index>
index is the index of the headremove array to delete.
Response example:
{
"description" : "Delete headremove directive.",
"message" : "The headremove 0 was deleted successfully",
"status" : "needed restart",
"success" : "true"
}
Add a Custom Header to the Response
Add a Custom Header to the Response
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"loadbalancer: true"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/addresponseheader
zcli farm-add-response-header add MyHttpFarm -header loadbalancer:true
This call is available from version 4.0.2
POST /farms/<farmname>/addresponseheader
The farm will add the header to the backend response.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | It is a string with the header that will be sent to the backend. | true |
Response example:
{
"description" : "Add a header to the backend repsonse.",
"message" : "Added a new header to the backend response",
"status" : "needed restart",
"success" : "true"
}
Modify an add a Custom Header to the Response rule
Modify an add a Custom Header to the Response rule
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"loadbalancer: true"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/addresponseheader/id
zcli farm-add-response-header add MyHttpFarm -header loadbalancer:true
This call is available from version 4.0.2
PUT /farms/<farmname>/addresponseheader/<id>
The farm will add the header to the backend response.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | It is a string with the header that will be sent to the backend. | true |
Response example:
{
"description" : "Modify an addresponseheader directive.",
"message" : "Modified an item from the addresponseheader list",
"success" : "true"
}
Delete a Custom Header from the Response
Delete a Custom Header from the Response
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/addresponseheader/0
zcli farm-add-response-header remove torta 0
This call is available from version 4.0.2
DELETE /farms/<farmname>/addresponseheader/<index>
index is the index of the addresponseheader array to delete.
Response example:
{
"description" : "Delete a header previously added to the backend response.",
"message" : "The header 0 was deleted successfully",
"status" : "needed restart",
"success" : "true"
}
Add a Rule to Remove Headers from Response
Add a Rule to Remove Headers from Response
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"pattern":"^client:"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/removeresponseheader
zcli farm-remove-response-header add MyHttpFarm -pattern "^client:"
This call is available from version 4.0.2
POST /farms/<farmname>/removeresponseheader
Remove certain headers from the incoming requests. All occurrences of the matching specified header will be removed.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
pattern | String | It is a string with a regexp to look for in the client requests. If some header matches in the pattern, the header will be removed | true |
Response example:
{
"description" : "Remove a header from the backend response.",
"message" : "Added a patter to remove reponse headers",
"status" : "needed restart",
"success" : "true"
}
Modify a Remove Headers from Response rule
Modify a Remove Headers from Response rule
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"pattern":"^client:"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/removeresponseheader/id
zcli farm-remove-response-header add MyHttpFarm -pattern "^client:"
This call is available from version 4.0.2
PUT /farms/<farmname>/removeresponseheader/<id>
Remove certain headers from the incoming requests. All occurrences of the matching specified header will be removed.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
pattern | String | It is a string with a regexp to look for in the client requests. If some header matches in the pattern, the header will be removed | true |
Response example:
{
"description" : "Modify a remove response header directive.",
"message" : "Modified an item from the removeresponseheader list",
"success" : "true"
}
Delete a Rule to Remove Header from Response
Delete a Rule to Remove Header from Response
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/removeresponseheader/0
zcli farm-remove-response-header remove torta 0
This call is available from version 4.0.2
DELETE /farms/<farmname>/removeresponseheader/<index>
index is the index of the removeresponseheader array to delete.
Response example:
{
"description" : "Delete a pattern to remove response headers.",
"message" : "The pattern 0 was deleted successfully",
"status" : "needed restart",
"success" : "true"
}
Add a Rule to Rewrite Headers from Request
Add a Rule to Rewrite Headers from Request
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"^Cookie:","match":"^COOKIESESSION=(.*)","replace":"COOKIEUSER=$1"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/replacerequestheader
farm-replace-request-header add farm1 -header ^Cookie: -match ^COOKIESESSION=(.*) -replace COOKIEUSER=$1`
This call is available from version 4.0.2
POST /farms/<farmname>/replacerequestheader
Add rules to rewrite headers from the request.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
match | String | Regex value to match what we want to replace | true |
replace | String | Value to replace matches | true |
Response example:
{
"description" : "Add a Replace Header.",
"message" : "Added a new replace header",
"status" : "needed restart",
"success" : "true"
}
Modify a Rewrite Headers from Request rule
Modify a Rewrite Headers from Request rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"^Cookie:","match":"^COOKIESESSION=(.*)","replace":"COOKIEUSER=$1"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/replacerequestheader/id
farm-replace-request-header add farm1 -header ^Cookie: -match ^COOKIESESSION=(.*) -replace COOKIEUSER=$1`
This call is available from version 4.0.2
PUT /farms/<farmname>/replacerequestheader/<id>
Add rules to rewrite headers from the request.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
match | String | Regex value to match what we want to replace | true |
replace | String | Value to replace matches | true |
Response example:
{
"description" : "Modify a replaceHeader directive.",
"message" : "Modified an item from the replaceHeader list",
"success" : "true"
}
Delete a Rule to Rewrite Headers from Request
Delete a Rule to Rewrite Headers from Request
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/replacerequestheader/0
zcli farm-replace-request-header remove MyHttpFarm 0
This call is available from version 4.0.2
DELETE /farms/<farmname>/replacerequestheader/<index>
index is the index of the replacerequestheader array to delete.
Response example:
{
"description" : "Delete a replace header directive.",
"message" : "The replace header 0 was deleted successfully",
"status" : "needed restart",
"success" : "true"
}
Move a Rewrite Headers from Request rule
Move a Rewrite Headers from Request rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"position":1}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/replacerequestheader/id/actions
farm-replace-request-header add farm1 -header ^Cookie: -match ^COOKIESESSION=(.*) -replace COOKIEUSER=$1`
This call is available from version 4.0.2
POST /farms/<farmname>/replacerequestheader/<id>/actions
Move a ReplaceRequest Header.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
position | Number | New rule position | true |
Response example:
{
"description" : "Move a replace header directive",
"message" : "Header was moved successfully.",
"params" : {
"position" : "1"
}
}
Add a Rule to Rewrite Headers from Response
Add a Rule to Rewrite Headers from Response
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"^Cookie:","match":"^COOKIESESSION=(.*)","replace":"COOKIEUSER=$1"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/replaceresponseheader
farm-replace-response-header add farm1 -header ^Cookie: -match ^COOKIESESSION=(.*) -replace COOKIEUSER=$1` -t$
This call is available from version 4.0.2
POST /farms/<farmname>/replaceresponseheader
Add rules to rewrite headers from the response.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
match | String | Regex value to match what we want to replace | true |
replace | String | Value to replace matches | true |
Response example:
{
"description" : "Add a Replace Header.",
"message" : "Added a new replace header",
"status" : "needed restart",
"success" : "true"
}
Modify a Rewrite Headers from Response rule
Modify a Rewrite Headers from Response rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"^Cookie:","match":"^COOKIESESSION=(.*)","replace":"COOKIEUSER=$1"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/replaceresponseheader/id
farm-replace-response-header add farm1 -header ^Cookie: -match ^COOKIESESSION=(.*) -replace COOKIEUSER=$1` -t$
This call is available from version 4.0.2
PUT /farms/<farmname>/replaceresponseheader/<id>
Add rules to rewrite headers from the response.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
match | String | Regex value to match what we want to replace | true |
replace | String | Value to replace matches | true |
Response example:
{
"description" : "Modify a replaceHeader directive.",
"message" : "Modified an item from the replaceHeader list",
"success" : "true"
}
Delete a Rule to Rewrite Headers from Response
Delete a Rule to Rewrite Headers from Response
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/replaceresponseheader/0
zcli farm-replace-response-header remove MyHttpFarm 0
This call is available from version 4.0.2
DELETE /farms/<farmname>/replaceresponseheader/<index>
index is the index of the replaceresponseheader array to delete.
Response example:
{
"description" : "Delete a replace header directive.",
"message" : "The replace header 0 was deleted successfully",
"status" : "needed restart",
"success" : "true"
}
Move a Rewrite Headers from Request rule
Move a Rewrite Headers from Response rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"position":1}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/replaceresponseheader/id/actions
farm-replace-response-header add farm1 -header ^Cookie: -match ^COOKIESESSION=(.*) -replace COOKIEUSER=$1`
This call is available from version 4.0.2
POST /farms/<farmname>/replaceresponseheader/<id>/actions
Move a ReplaceRequest Header.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
position | Number | New rule position | true |
Response example:
{
"description" : "Move a replace header directive",
"message" : "Header was moved successfully.",
"params" : {
"position" : "1"
}
}
Add a Certificate
Add a Certificate
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"file":"example.pem"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/httpFarm/certificates
zcli farm-certificate add httpFarm -file example.pem
POST /farms/<farmname>/certificates
Include an available PEM Certificate to the SNI list or certlist
array of an HTTP farm with an HTTPS listener. The used certificate has to be already uploaded in the system, see Certificates > List all Certificates for the available certificates list.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
file | String | certificate file name, previously the certificate has to be uploaded in the system. | true |
Response example:
{
"description" : "Add certificate",
"message" : "The certificate example.pem has been added to the SNI list of farm httpFarm, you need restart the farm to apply",
"success" : "true",
"status": "needed restart"
}
Move a Certificate
Move a Certificate
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"position":0}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/newfarm/certificates/certif.pem/actions
zcli farm-certificate move newfarm zertif.pem -position 0
POST /farms/<farmname>/certificates/<file>/actions
The URI file
parameter is the certificate file name that is going to be moved.
This feature allows moving the certificates to alter the order that they will be checked.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
position | Integer | It is the position that the certificate will have in the farm configuration when the ZAPI call will be processed | true |
Response example:
{
"description" : "Move service",
"params" : {
"position" : 0
},
"status" : "needed restart",
"info" : "There\'re changes that need to be applied, stop and start farm to apply them!",
"message" : "certif.pem was moved successfully."
}
Delete a Certificate
Delete a Certificate
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/certificates/example.pem
zcli farm-certificate remove MyHttpFarm example.pem
DELETE /farms/<farmname>/certificates/<file>
Delete the certificate with the selected file name from the certlist in the HTTP farm with an HTTPS listener. The certificate will not be deleted from the certificates store.
Response example:
{
"description" : "Delete farm certificate",
"message" : "The Certificate example.pem has been deleted.",
"success" : "true",
"status": "needed restart"
}
Add an IPDS rule
Add an IPDS rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"name":"china"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/httpFarm/ipds/blacklists
zcli farm-blacklist add httpFarm -name china
POST /farms/<farmname>/ipds/<dos|blacklists|rbl|waf>
Apply a blacklist, DoS, RBL or WAF rule to the farm.
Request parameters
Field | Type | Description |
---|---|---|
name | String | IPDS rule name used as a unique identifier. |
Response example:
{
"description" : "Apply a rule to a farm",
"message" : "Blacklist rule china was applied successful to the farm httpFarm.",
"success" : "true"
}
Move an IPDS rule
Move an IPDS rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"position":2}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/waf/test_waf_ori/rules/0/actions
zcli farm-waf move httpFarm REQUEST-901-INITIALIZATION -position 2
POST /farms/<farmname>/ipds/<waf|blacklists>/<name>/actions
The move IPDS rules are only available for WAF and Blacklist rules. In this kind of rules is important the order that is going to be checked.
The name
URI parameter is the ruleset name of the set is going to be moved.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
position | Integer | It is the position that the IPDS rule will have in the farm configuration when the ZAPI call will be processed | true |
Response example:
{
"message" : "The rule was moved properly to the position 2.",
"description" : "Move a rule in the set test_waf_ori"
}
Remove an IPDS rule
Remove an IPDS rule
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/httpFarm/ipds/blacklists/china
zcli farm-blacklist remove httpFarm china
DELETE /farms/<farmname>/ipds/<dos|blacklists|rbl|waf>/<name>
Remove a blacklist, DoS, RBL or WAF rule from a given farm using its indicator name.
Response example:
{
"description" : "Delete a rule form a farm",
"message" : "Blacklist rule china was removed successful from the farm httpFarm.",
"success" : "true"
}
HTTP - Services
The services within an HTTP profile farm provides a content switching method to deliver several web services with different properties, backends or even persistence methods, through some deterministic conditions used by the farm core to match the correct service for every client request. This service definition will be used by the farm to determine the backends servers that could deliver the response to the client.
Retrieve service by ID
Retrieve service by ID
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/cookiefarm/services/serv
zcli farm get cookiefarm -filter services
GET /farms/<farmname>/services/<id>
Show all configuration about a given service.
Response example:
{
"description" : "Get services of a farm",
"services" : {
"backends" : [
{
"alias" : "http-server",
"id" : 0,
"ip" : "192.168.100.254",
"port" : 80,
"status" : "up",
"timeout" : 20,
"weight" : null,
"priority" : null,
"connection_limit" : null
},
{
"alias" : "http-server",
"id" : 0,
"ip" : "192.168.100.254",
"port" : 80,
"status" : "up",
"timeout" : null,
"weight" : null,
"priority" : null,
"connection_limit" : null
}
],
"cookiedomain" : "zevenet.cpm",
"cookieinsert" : "true",
"cookiename" : "peasocookie",
"cookiepath" : "/patfh",
"cookiettl" : 20,
"farmguardian" : "check_tcp-cut_conns",
"httpsb" : "false",
"id" : "serv",
"leastresp" : "false",
"persistence" : "COOKIE",
"redirect" : "",
"redirect_code" : "",
"redirecttype" : "",
"sessionid" : "JSESSIONID",
"sts_status" : "false",
"sts_timeout" : 0,
"ttl" : 18,
"urlp" : "(?i)^/music$",
"vhost" : "",
"pinnedconnection" : 0,
"routingpolicy" : "ROUND_ROBIN",
"replacerequestheader" : [],
"replaceresponseheader" : [],
"addrequestheader" : [],
"addresponseheader" : [],
"removerequestheader" : [],
"removeresponseheader" : [],
"rewriteurl" : [],
"sessions" : []
}
}
Response parameters
The response will be a JSON object with the format below.
Services object for HTTP farms:
Field | Type | Description |
---|---|---|
backends | Object[] | Backends defined in the service. |
cookiedomain | String | Cookie insertion will be executed if the domain matches in the cookie content. Enable cookieinsert field is required. |
cookieinsert | String | It enables the cookie insertion for backends sticky sessions. The options are true, the profile will search the given cookie in field cookiename, if it doesn’t exist then this cookie will be added, false, not action is taken. |
cookiename | String | The cookie name (session ID) will be used for identifying the sticky process to backends. Enable cookieinsert field is required. |
cookiepath | String | It manages the cookie path value for the given cookie. Enable cookieinsert field is required. |
cookiettl | Number | It is the max time of life for a cookie, in seconds. Enable cookieinsert field is required. |
farmguardian | String | It is the FarmGuardian name that is checking the backend status. FarmGuardian will be running while the farm is in up status. |
httpsb | String | This parameter indicates to the farm that the backends are configured to use HTTPS, then the data will be encrypted before to be sent. true, the profile sends the traffic in HTTPS protocol to the backends, false, the profile sends the traffic in HTTP protocol to the backends. |
id | String | Service’s name, it can’t be modified once the service is created. |
leastresp | String | It enables the least response balancing method. true frequently the profile checks which backend is taking less time to respond to send more connections to this one, false profile doesn’t check which backend is taking less time to respond. |
persistence | String | This parameter defines how the HTTP service is going to manage the client session. The options are: “” empty string, no action is taken, IP the persistence session is done in base of client IP, BASIC the persistence session is done in base of BASIC headers, URL the persistence session is done in base of a field in the URI, PARM the persistence session is done in base of a value at the end of the URI, COOKIE the persistence session is done in base of a cookie name, this cookie has to be created by the backends, and HEADER, the persistence session is done in base of a Header name. |
redirect | String | It behaves like a special backend, as the client request is answered by a redirect to a new URL automatically. If the redirect is configured then the request will not be forwarded to the backend, a Redirect will be responded to the client instead. |
redirect_code | Number | It is the HTTP code returned when a redirect is configurated. The possible values are 301, 302, 307. |
redirecttype | String | How the redirection will be done, two options: default, the URL is taken as an absolute host and path to redirect to, append, the original request path or URI will be appended to the host and path you specified with the default option. If the redirect field is not configurated, this field will be an empty string. |
sessionid | String | It is available if persistence field is URL, COOKIE or HEADER, the parameter value will be searched by the farm in the HTTP header and will manage the client session. |
sts_status | String | Status of the Strict Transport Security header. To enable this feature, it is necessary to set the farm listener as HTTPS. The possible values are: true to enable STS directive in the service; or false to disable STS directive in the service. |
sts_timeout | Number | Time (in seconds) that the client remembers that the service only is available with HTTS. |
ttl | Number | Only with persistence. This value indicates the max time of life for an inactive client session (max session age) in seconds. |
urlp | String | Allows determining a web service regarding the URL the client is requesting through a specific URL pattern which will be syntactically checked. PCRE regular expression is supported. |
vhost | String | It specifies the condition determined by the domain name through the same virtual IP and port defined by an HTTP farm. PCRE regular expression is supported. |
pinnedconnection (from version 4.0.2) | Number | Specify if we want to pin all the connections, (default: 0, no pinned). If Pinnedconnection is set to 1, zproxy directly forwards all data without parsing or editing. |
routingpolicy (from version 4.0.2) | String | Specify the routing policy. All the algorithms are weighted with all the weights set in each backend. There is four options: ROUND_ROBIN use the round robin algorithm as a routing policy (default). LEAST_CONNECTIONS select the backend with least connections established using as a proportion the weights set. RESPONSE_TIME select the backend with the lowest response time using as a proportion the weights set. PENDING_CONNECTIONS select the backend with least pending connections using as a proportion the weights set. |
replacerequestheader (from version 4.0.2) | Object[] | Array of rules to replace a header in request. If several regex matches in the header, only the first one will apply. The replaceHeader directive in the services has priority over the listener one. |
replaceresponseheader (from version 4.0.2) | Object[] | Array of rules to replace a header in response. If several regex matches in the header, only the first one will apply. The replaceHeader directive in the services has priority over the listener one. |
addrequestheader (from version 4.0.2) | Object[] | Array of rules to Add the defined header to the request passed to the clients. The header is added verbatim. |
addresponseheader (from version 4.0.2) | Object[] | Array of rules to Add the defined header to the response passed to the clients. The header is added verbatim. |
removerequestheader (from version 4.0.2) | Object[] | Array of rules to Remove certain headers from the outcomming request, the header sent by the backend is not sent to the client. |
removeresponseheader (from version 4.0.2) | Object[] | Array of rules to Remove certain headers from the outcomming response, the header sent by the backend is not sent to the client. |
rewriteurl (from version 4.0.2) | Object[] | Array of rules to Changes the Location and Content-Location headers in the responses to show the virtual host that was sent in the request. |
sessions (from version 4.0.2) | Object[] | List of static and dynamic sessions created for this farm service. |
Backend object for HTTP farms:
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the backend. Alias |
id | Number | Backend identifier inside the given service. |
ip | String | Backend’s IP where the real service is running. |
port | Number | Backend’s port where the real service is running. |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; maintenance, backend is marked as not ready for receiving connections by the administrator, this option is useful for backend’s maintenance tasks; undefined, the backend status has been not checked. |
timeout | Number | It’s the maximum time waiting for the backend response before putting it as down. This time is in seconds. |
weight | Number | It’s the weight value for the current real server, backend with higher weight value will receive more connections. Default value null, not special weight used for this backend. The possible values are from 1 to 9. |
priority (from 4.0.1) | Number | (Only when proxy new generation is working) It’s the priority value for the current real server, backend with lower priority value will be ready to receive connections before than others with higher priority. Default value null, a priority value 1 is used. The possible values are from 1 to 9. |
connection_limit (from 4.0.2) | Number | (Only when proxy new generation is working) The maximum number of established connection per backend. With a value of 0, there will not be a limit in the backend. The client will receive a 503 error if there aren’t available backends. |
replaceRequestHeader and replaceResponseHeader objects for HTTP farm services:
Field | Type | Description |
---|---|---|
header | String | Regex with the header name to be rewrited. |
match | String | Regex value to match what we want to replace. |
replace | String | Value to replace matches. |
addRequestHeader and addResponseHeader object for HTTP farm services:
Field | Type | Description |
---|---|---|
header | String | Regex with the header name to be rewrited. |
removeRequestHeader and removeResponseHeader object for HTTP farm services:
Field | Type | Description |
---|---|---|
pattern | String | It is a string with a regexp to look for in the client requests. If some header matches in the pattern, the header will be removed. |
rewriteUrl object for HTTP farm services:
Field | Type | Description |
---|---|---|
pattern | String | It is a string with a regexp to look for in the url. If url matches in the pattern, the matched text will be replaced. |
replace | String | It is a string to replace the matched text. |
last | String | True or False. If true is set, that will finish the rewrite url phase. |
session object for HTTP farm services:
Field | Type | Description |
---|---|---|
id | Number | Backend ID which will receive the connection. |
session | String | It is the session identifier or a connection, its value depend on the persistence parameter of the farm. If persistence is ‘IP’ session should be a IPv4 or IPv6, e.g. 192.168.42.65; |
type | String | There are two type of sessions: dynamic is a connection that load balancer pins with a backend using the farm load balancing algorithm; static is a connection that the load balancer administrator pins with a backend. The static sessions will not be redirect to another backend if its backed in unreachable. |
ttl | String | It is a string with the session time to expire. The ttl value will be null if the session is not of type static. |
Create a new Service
Create a new Service
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"id":"newserv"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/FarmHTTP/services
zcli farm-service add FarmHTTP -id newserv
POST /farms/<farmname>/services
Create a service in a given HTTP profile Farm. The farm needs a restart action to apply this change.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
id | String | Service name which is used as a unique identifier. Only alphanumeric values are allowed. | true |
Response example:
{
"description" : "New service newserv",
"params" : {
"id" : "newserv"
},
"status" : "needed restart"
}
Modify a Service
Modify a Service
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"vhost":"www.mywebserver.com","urlp":"^/myapp1$","persistence":"URL", "redirect_code":302,
"redirect":"http://zenloadbalancer.com","ttl":125,"sessionid":"sid","sts_status":"true","sts_timeout":21600000,
"leastresp":"true","httpsb":"true","pinnedconnection":0,"routingpolicy":"ROUND_ROBIN"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/FarmHTTP/services/sev2
zcli farm-service set farmHTTP sev2 -vhost www.mywebserver.com -urlp ^/myapp1$ -persistence URL -redirect_code 302 -redirect http://zenloadbalancer.com -ttl 125 -sessionid sid -sts_status true -sts_timeout 21600000 -pinnedconnection 0 -routingpolicy ROUND_ROBIN
PUT /farms/<farmname>/services/<id>
Modify the parameters of a service in an HTTP profile. id is the service unique identifier that will be modified.
Request parameters
Field | Type | Description |
---|---|---|
vhost | String | Specifies the condition determined by the domain name through the same virtual IP and port defined by an HTTP profile farm. PCRE regular expression is supported. |
urlp | String | Allows determining a web service regarding the URL the client is requesting through a specific URL pattern which will be syntactically checked. PCRE regular expression is supported. |
redirect | String | It works as a special backend, the client request is answered by a redirect to a new URL automatically. |
redirect_code | Number | It is the HTTP code returned when a redirect is configurated. The possible values are 301, 302, 307, |
redirecttype | String | How the redirect will be done, two options: default, the URL is taken as an absolute host and path to redirect to, append, the original request path or URI will be appended to the host and path you specified in redirect field. This behavior will apply only if redirect is not empty value. |
cookieinsert | String | It enables the cookie insertion for backends sticky sessions. The options are true, the profile will search the given cookie in field cookiename, if it doesn’t exist then this cookie will be added, false, insertion cookie is disabled. |
cookiename | String | The cookie name (session ID) will be used for identifying the sticky process to backends. Enable cookieinsert field is required. |
cookiedomain | String | Cookie insertion will be executed if the domain matches in the cookie content. Enable cookieinsert field is required. |
cookiepath | String | It manages the cookie path value for the given cookie, if the URI in the client request or backend response doesn’t match with cookiepath then cookie insertion persistence method is not applied. Enable cookieinsert field is required. |
cookiettl | Number | It is the max time of life for a cookie, in seconds. Enable cookieinsert field is required. |
persistence | String | This parameter defines how the HTTP service is going to manage the client session. The options are: “” empty string, no action is taken, IP the persistence session is done in base of client IP, BASIC the persistence session is done in base of BASIC headers, URL the persistence session is done in base of a field in the URI, PARM the persistence session is done in base of a value separated by “;” at the end of the URI, COOKIE the persistence session is done in base of a cookie name, this cookie has to be created by the backends, and HEADER, the persistence session is done in base of a Header name. |
ttl | Number | Only with persistence. The max time of life for an inactive client session (max session age) in seconds. |
sessionid | String | It is available if persistence field is URL, COOKIE or HEADER, the parameter value will be searched by the profile in the HTTP header and will manage the client session. |
sts_status | String | Status of the Strict Transport Security header. To enable this feature, it is necessary to set the farm listener as HTTPS. The possible values are: true to enable STS directive in the service; or false to disable STS directive in the service. |
sts_timeout | Number | Time (in seconds) that the client remembers that the service only is available with HTTS. |
leastresp | String | It enables the least response balancing method. true, frequently the profile checks which backend is taking less time to respond to send more connections to this one, false, the profile doesn’t check which backend is taking less time to respond. |
httpsb | String | It indicates to the farm that the backends servers are set to use HTTPS, then the data will be encrypted before to be sent. true, the profile sends the traffic in HTTPS protocol to the backends, false, the profile sends the traffic in HTTP protocol to the backends. |
pinnedconnection (from version 4.0.2) | Number | Specify if we want to pin all the connections, (default: 0, no pinned). If Pinnedconnection is set to 1, zproxy directly forwards all data without parsing or editing. |
routingpolicy (from version 4.0.2) | String | Specify the routing policy. All the algorithms are weighted with all the weights set in each backend. There is four options: ROUND_ROBIN use the round robin algorithm as a routing policy (default). LEAST_CONNECTIONS select the backend with least connections established using as a proportion the weights set. RESPONSE_TIME select the backend with the lowest response time using as a proportion the weights set. PENDING_CONNECTIONS select the backend with least pending connections using as a proportion the weights set. |
rewritelocation (from version 4.0.2) | String | If it is enabled, the farm is forced to modify the Location: and Content-location: headers in responses to clients with the virtual host. The options are: enabled, activated disabled, inactivated or enabled-backends only the backend address is compared. Other options availables: enabled-path and enabled-backends-path. the path applies if the RewriteUrl directive modified the request URL. This flag forces to revert the URL transformation that RewriteUrl did. |
Response example:
{
"description" : "Modify service newsrv in farm newHTTPfarm",
"info" : "There're changes that need to be applied, stop and start farm to apply them!",
"params" : {
"backends" : [],
"cookiedomain" : "",
"cookieinsert" : "false",
"cookiename" : "",
"cookiepath" : "",
"cookiettl" : 0,
"httpsb" : "true",
"id" : "newsrv",
"leastresp" : "true",
"persistence" : "",
"redirect" : "http://zenloadbalancer.com",
"redirect_code" : 302,
"redirecttype" : "default",
"sessionid" : "sid",
"sts_status" : "true",
"sts_timeout" : 21600000,
"ttl" : 125,
"urlp" : "^/myapp1$",
"vhost" : "www.mywebserver.com",
"pinnedconnection" : 0,
"routingpolicy" : "ROUND_ROBIN"
},
"status" : "needed restart"
}
Response Parameters
The response will be a JSON with requested parameters updated and the status field with the current status of the farm. If Restart action needs to be taken to apply the changes of the farm, the value will be needed restart.
Add FarmGuardian
Add FarmGuardian
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"name":"check_tcp-cut_conns"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/FarmHTTP/services/service1/fg
zcli farm-service-farmguardian add FarmHTTP service1 -name check_tcp-cut_conns
POST /farms/<farmname>/services/<id>/fg
Apply a FarmGuardian to a service.
The URI parameter is the service unique identifier.
Request parameters
Field | Type | Description |
---|---|---|
name | String | FarmGuardian unique identifier. The FarmGuardians are created and modified in the monitoring section. |
Response example:
{
"description" : "Add the farm guardian check_tcp-cut_conns to the service service1 in the farm FarmHTTP",
"message" : "Success, The farm guardian check_tcp-cut_conns was added to the service service1 in the farm FarmHTTP"
}
Remove FarmGuardian
Remove FarmGuardian
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/FarmHTTP/service/service1/fg/check_tcp-cut_conns
zcli farm-service-farmguardian remove FarmHTTP service1 check_tcp-cut_conns
DELETE /farms/<farmname>/services/<id>/fg/<name>
Remove the FarmGuardian from a service in a farm.
Response example:
{
"description" : "Remove the farm guardian check_tcp-cut_conns from the service service1 in the farm FarmHTTP",
"message" : "Sucess, check_tcp-cut_conns was removed from the service service1 in the farm FarmHTTP"
}
Move services
Move services
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"position":0}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/FarmHTTP/services/service1/actions
zcli farm-service move FarmHTTP service1 -position 0
POST /farms/<farmname>/services/<id>/actions
This action move the given a service Up or Down in the Service List, this option is useful if it is required to change the priority order, note that services are evaluated in the same order that is shown. this action restarts the farm automatically.
id is the service unique identifier that will be modified.
Request Parameters
Field | Type | Description | Required |
---|---|---|---|
position | Number | Position where will be the service. The first position has the index 0. | true |
Response example:
{
"description" : "Move service",
"message" : "service1 was moved successful.",
"params" : {
"position" : 0
}
}
Delete a Service
Delete a Service
Request example:
curl -k -X DELETE -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/FarmHTTP/services/service1
zcli farm-service remove FarmHTTP service1
DELETE /farms/<farmname>/services/<id>
Delete a given service of an HTTP profile. id is the service unique identifier that will be deleted.
Response example:
{
"description" : "Delete service service1 in farm FarmHTTP",
"message" : "The service service1 in farm FarmHTTP has been deleted.",
"success" : "true",
"status": "needed restart"
}
Add a Rule to Rewrite Headers from Request
Add a Rule to Rewrite Headers from Request
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"^Cookie:", "match":"^COOKIESESSION=(.*)", "replace":"COOKIEUSER=$1`"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/replacerequestheader
zcli farm-service-replacerequestheader add farm1 -header "^Cookie:" -match "^COOKIESESSION=(.*)" -replace "COOKIEUSER=$1`"
This call is available from version 4.0.2
POST /farms/<farmname>/service/<servicename>/replacerequestheader
Add rules to rewrite headers from the request.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
match | String | Regex value to match what we want to replace | true |
replace | String | Value to replace matches | true |
Response example:
{
"description" : "Add a Replace Header.",
"message" : "Added a new replace header"
}
Modify a Rewrite Headers from Request rule
Modify a Rewrite Headers from Request rule
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"^Cookie:", "match":"^COOKIESESSION=(.*)", "replace":"COOKIEUSER=$1`"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/replacerequestheader/id
zcli farm-service-replacerequestheader add farm1 -header "^Cookie:" -match "^COOKIESESSION=(.*)" -replace "COOKIEUSER=$1`"
This call is available from version 4.0.2
PUT /farms/<farmname>/service/<servicename>/replacerequestheader/<id>
Modify a rule of rewrite headers from the request.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
match | String | Regex value to match what we want to replace | true |
replace | String | Value to replace matches | true |
Response example:
{
"description" : "Modify replaceHeader directive.",
"message" : "Modified an item from the ReplaceHeader list",
"success" : "true"
}
Modify a Rewrite Headers from Request rule
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"^Cookie:", "match":"^COOKIESESSION=(.*)", "replace":"COOKIEUSER=$1`"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/replacerequestheader/id
zcli farm-service-replacerequestheader add farm1 -header "^Cookie:" -match "^COOKIESESSION=(.*)" -replace "COOKIEUSER=$1`"
This call is available from version 4.0.2
PUT /farms/<farmname>/service/<servicename>/replacerequestheader/<id>
Modify a rule of rewrite headers from the request.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
match | String | Regex value to match what we want to replace | true |
replace | String | Value to replace matches | true |
Response example:
{
"description" : "Modify replaceHeader directive.",
"message" : "Modified an item from the ReplaceHeader list",
"success" : "true"
}
Delete a Rule to Rewrite Headers from Request
Delete a Rule to Rewrite Headers from Request
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/replacerequestheader/Index
zcli farm-service-replacerequestheader remove MyHttpFarm MyService Index
This call is available from version 4.0.2
DELETE /farms/<farmname>/service/<servicename>/replacerequestheader/<index>
index is the index of the replacerequestheader array to delete.
Response example:
{
"description" : "Add a Replace Header.",
"message" : "Added a new replace header",
"success" : "true"
}
Add a Rule to Rewrite Headers from Response
Add a Rule to Rewrite Headers from Response
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"^Cookie:", "match":"^COOKIESESSION=(.*)", "replace":"COOKIEUSER=$1`"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/replaceresponseheader
zcli farm-service-replaceresponseheader add farm1 -header "^Cookie:" -match "^COOKIESESSION=(.*)" -replace "COOKIEUSER=$1`"
This call is available from version 4.0.2
POST /farms/<farmname>/service/<servicename>/replaceresponseheader
Add rules to rewrite headers from the response.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
match | String | Regex value to match what we want to replace | true |
replace | String | Value to replace matches | true |
Response example:
{
"description" : "Add a Replace Header.",
"message" : "Added a new replace header",
"success" : "true"
}
Move a Rewrite Headers from Request rule
Move a Rewrite Headers from Request rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"position":1}'
https://<zevenet_server>:444/zapi/v4.0/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/replacerequestheader/id/actions
farm-replace-response-header add farm1 -header ^Cookie: -match ^COOKIESESSION=(.*) -replace COOKIEUSER=$1`
This call is available from version 4.0.2
POST /farms/<farmname>/services/<service>/replacerequestheader/<id>/actions
Move a ReplaceRequest Header.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
position | Number | New rule position | true |
Response example:
{
"description" : "Move a replace header directive",
"message" : "Header was moved successfully.",
"params" : {
"position" : "1"
}
}
Modify a Rewrite Headers from Response rule
Modify a Rewrite Headers from Response rule
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"^Cookie:", "match":"^COOKIESESSION=(.*)", "replace":"COOKIEUSER=$1`"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/replaceresponseheader/id
zcli farm-service-replaceresponseheader add farm1 -header "^Cookie:" -match "^COOKIESESSION=(.*)" -replace "COOKIEUSER=$1`"
This call is available from version 4.0.2
PUT /farms/<farmname>/service/<servicename>/replaceresponseheader/<id>
Add rules to rewrite headers from the response.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
match | String | Regex value to match what we want to replace | true |
replace | String | Value to replace matches | true |
Response example:
{
"description" : "Modify a replaceHeader directive.",
"message" : "Modified an item from the replaceHeader list",
"success" : "true"
}
Delete a Rule to Rewrite Headers from Response
Delete a Rule to Rewrite Headers from Response
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/replaceresponseheader/Index
zcli farm-service-replaceresponseheader remove MyHttpFarm MyService Index
This call is available from version 4.0.2
DELETE /farms/<farmname>/service/<servicename>/replaceresponseheader/<index>
index is the index of the replaceresponseheader array to delete.
Response example:
{
"description" : "Delete a replace header directive.",
"message" : "The replace header <index> was deleted successfully"
}
Move a Rewrite Headers from Response rule
Move a Rewrite Headers from Response rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"position":1}'
https://<zevenet_server>:444/zapi/v4.0/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/replaceresponseheader/id/actions
farm-replace-response-header add farm1 -header ^Cookie: -match ^COOKIESESSION=(.*) -replace COOKIEUSER=$1`
This call is available from version 4.0.2
POST /farms/<farmname>/services/<service>/replaceresponseheader/<id>/actions
Move a ReplaceRequest Header.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
position | Number | New rule position | true |
Response example:
{
"description" : "Move a replace header directive",
"message" : "Header was moved successfully.",
"params" : {
"position" : "1"
}
}
Add a Rule to Add a Header to the Request
Add a Rule to Add a Header to Request
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"header: value"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/addrequestheader
farm-service-addrequestheader add farm1 -header "header: value"
This call is available from version 4.0.2
POST /farms/<farmname>/addrequestheader
Add rules to rewrite headers from the request.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
Response example:
{
"description" : "Add a AddHeader.",
"message" : "Added a new add request header",
"success" : "true"
}
Modify an Add a Header to the Request rule
Modify an Add a Header to the Request rule
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"header: value"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/addrequestheader/id
farm-service-addrequestheader add farm1 -header "header: value"
This call is available from version 4.0.2
PUT /farms/<farmname>/addrequestheader/<id>
Add rules to rewrite headers from the request.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
Response example:
{
"description" : "Add a AddHeader.",
"message" : "Added a new add request header",
"success" : "true"
}
Delete a Rule to Add a Header to the Request
Delete a Rule to Add a Header to the Request
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/addrequestheader/Index
zcli farm-service-addrequestheader remove MyHttpFarm MyService Index
This call is available from version 4.0.2
DELETE /farms/<farmname>/addrequestheader/<index>
index is the index of the replacerequestheader array to delete.
Response example:
{
"message": "The add request header <index> has been deleted successfully"
}
Add a Rule to Add a Header to the Response
Add a Rule to Add a Header to Response
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"header: value"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/addresponseheader
zcli farm-service-addresponseheader add farm1 -header "header: value"
This call is available from version 4.0.2
POST /farms/<farmname>/addresponseheader
Add rules to rewrite headers from the response.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
Response example:
{
"description" : "Add a AddHeader.",
"message" : "Added a new add request header",
"success" : "true"
}
Modify an Add a Header to the Response rule
Modify an Add a Header to the Response rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"header":"header: value"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/addresponseheader/id
zcli farm-service-addresponseheader add farm1 -header "header: value"
This call is available from version 4.0.2
PUT /farms/<farmname>/addresponseheader/<id>
Add rules to rewrite headers from the response.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
header | String | Regex with the header name to be rewrited | true |
Response example:
{
"description" : "Modify an addheader directive.",
"message" : "Modified an item from the addheader list",
"success" : "true"
}
Delete a Rule to Add a Header to the Response
Delete a Rule to Add a Header to the Response
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/addresponseheader/Index
zcli farm-service-addresponseheader remove MyHttpFarm MyService Index
This call is available from version 4.0.2
DELETE /farms/<farmname>/addrequestheader/<index>
index is the index of the replaceresponseheader array to delete.
Response example:
{
"message": "The add response header 0 has been deleted successfully"
}
Add Rule to Remove Headers from the Request
Add Rule to Remove Headers from the Request
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"pattern":"^client:"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/removerequestheader
zcli farm-service-removerequestheader add MyHttpFarm -pattern "^client:""
POST /farms/<farmname>/service/<servicename>/removerequestheader
Remove certain headers from the incoming requests. All occurrences of the matching specified header will be removed.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
pattern | String | It is a string with a regexp to look for in the client requests. If some header matches in the pattern, the header will be removed | true |
Response example:
{
"message": "Added a new remove request header"
}
Modify Rule to Remove Headers from the Request
Modify Rule to Remove Headers from the Request
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"pattern":"^client:"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/removerequestheader/id
zcli farm-service-removerequestheader add MyHttpFarm -pattern "^client:""
PUT /farms/<farmname>/service/<servicename>/removerequestheader/<id>
Remove certain headers from the incoming requests. All occurrences of the matching specified header will be removed.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
pattern | String | It is a string with a regexp to look for in the client requests. If some header matches in the pattern, the header will be removed | true |
Response example:
{
"description" : "Modify RemoveResponseHeader directive.",
"message" : "Modify an item from the removeresponseheader list",
"success" : "true"
}
Delete a Rule to Remove Headers from the Request
Delete a Rule to Remove Headers from the Request
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/removerequestheader/Index
zcli farm-remove-request-header remove MyHttpFarm Service Index
DELETE /farms/<farmname>/service/<service0>/removerequestheader/<index>
index is the index of the removerequestheader array to delete.
Response example:
{
"message": "The remove request header <index> has been deleted successfully"
}
Add Rule to Remove Headers from the Response
Add Rule to Remove Headers from the Response
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"pattern":"^client:"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/removeresponseheader
zcli farm-service-removeresponseheader add MyHttpFarm -pattern "^client:""
POST /farms/<farmname>/service/<servicename>/removeresponseheader
Remove certain headers from the incoming requests. All occurrences of the matching specified header will be removed.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
pattern | String | It is a string with a regexp to look for in the client requests. If some header matches in the pattern, the header will be removed | true |
Response example:
{
"message": "Added a new remove response header"
}
Modify a Remove Headers from the Response rule
Modify a Remove Headers from the Response rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"pattern":"^client:"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/removeresponseheader/id
zcli farm-service-removeresponseheader add MyHttpFarm -pattern "^client:""
PUT /farms/<farmname>/service/<servicename>/removeresponseheader/<id>
Remove certain headers from the incoming requests. All occurrences of the matching specified header will be removed.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
pattern | String | It is a string with a regexp to look for in the client requests. If some header matches in the pattern, the header will be removed | true |
Response example:
{
"description" : "Modify RemoveResponseHeader directive.",
"message" : "Modify an item from the removeresponseheader list",
"success" : "true"
}
Delete a Rule to Remove Headers from the Response
Delete a Rule to Remove Headers from the Response
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/removeresponseheader/Index
zcli farm-remove-request-header remove MyHttpFarm Service Index
DELETE /farms/<farmname>/service/<service0>/removeresponseheader/<index>
index is the index of the removeresponseheader array to delete.
Response example:
{
"message": "The remove request header <index> has been deleted successfully"
}
Add Rule to checks and rewrite patterns from URL
Add Rule to checks and rewrite patterns from URL
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"pattern":"/media/(.+)$","replace":"/svc1/$1","last":"true"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/rewriteurl
zcli farm-service-rewriteurl add MyHttpFarm MyService -pattern "/media/(.+)$" -replace "/svc1/$1" -last "true"
POST /farms/<farmname>/service/<servicename>/rewriteurl
From version 4.0.2. It checks a pattern in order to get strings from URL and replace them.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
pattern | String | It is a string with a regexp to look for in the url. If url matches in the pattern, the matched text will be replaced | true |
replace | String | It is a string to replace the matched text | true |
last | String | True or False. If true is set, that will finish the rewrite url phase | true |
Response example:
{
"message": "Added a new rewriteurl"
}
Modify Rule of checks and rewrite patterns from URL
Modify Rule of checks and rewrite patterns from URL
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"pattern":"/media/(.+)$","replace":"/svc1/$1","last":"true"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/rewriteurl/id
zcli farm-service-rewriteurl add MyHttpFarm MyService -pattern "/media/(.+)$" -replace "/svc1/$1" -last "true"
PUT /farms/<farmname>/service/<servicename>/rewriteurl/<id>
From version 4.0.2. It checks a pattern in order to get strings from URL and replace them.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
pattern | String | It is a string with a regexp to look for in the url. If url matches in the pattern, the matched text will be replaced | true |
replace | String | It is a string to replace the matched text | true |
last | String | True or False. If true is set, that will finish the rewrite url phase | true |
Response example:
{
"description" : "Modify a RewriteUrl.",
"message" : "Modify a new rewrite url",
"success" : "true"
}
Delete a Rule to checks and rewrite patterns from URL
Delete a Rule to checks and rewrite patterns from URL
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/rewriteurl/Index
zcli arm-service-rewriteurl remove MyHttpFarm Service Index
DELETE /farms/<farmname>/service/<service0>/rewriteurl/<index>
From version 4.0.2. index is the index of the rewriteurl array to delete.
Response example:
{
"message": "The rewriteurl <index> has been deleted successfully"
}
Move a checks and rewrite patterns from URL rule
Move a checks and rewrite patterns from URL rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"position":1}'
https://<zevenet_server>:444/zapi/v4.0/zapi/v4.0/zapi.cgi/farms/MyHttpFarm/services/MyService/rewriteurl/id/actions
farm-replace-response-header add farm1 -header ^Cookie: -match ^COOKIESESSION=(.*) -replace COOKIEUSER=$1`
This call is available from version 4.0.2
POST /farms/<farmname>/services/<service>/rewriteurl/<id>/actions
Move a ReplaceRequest Header.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
position | Number | New rule position | true |
Response example:
{
"description" : "Move a rewriteurl directive",
"message" : "Header was moved successfully.",
"params" : {
"position" : "1"
}
}
List the sessions
List the sessions
Request example:
curl -k -X GET -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/farm1/services/service0/sessions
zcli farm-service-session list farm1 service0
GET /farms/<farmname>/services/<servicename>/sessions
From version 4.0.2. Get the list of sessions in the farm:service. Property only avaliable for proxy of new generation zproxy.
Response example:
{
"description" : "Get farm sessions",
"params": [
{
"id": "0",
"session": "10.0.0.2",
"ttl": null,
"type": "static"
},
{
"id": "0",
"session": "10.0.0.2",
"ttl": "58m28s148ms",
"type": "dynamic"
},
{
"id": "0",
"session": "10.0.0.2",
"ttl": "59m56s496ms",
"type": "dynamic"
}
]
}
Response Parameters
This request returns a list of sessions object, each session object contains the following keys:
Field | Type | Description |
---|---|---|
id | Number | Backend ID which will receive the connection. |
session | String | It is the session identifier or a connection, its value depend on the persistence parameter of the farm. If persistence is 'IP’ session should be a IPv4 or IPv6, e.g. 192.168.42.65; |
type | String | There are two type of sessions: dynamic is a connection that load balancer pins with a backend using the farm load balancing algorithm; static is a connection that the load balancer administrator pins with a backend. The static sessions will not be redirect to another backend if its backed in unreachable. |
ttl | String | It is a string with the session time to expire. The ttl value will be null if the session is not of type static. |
Add a session
Add a session
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"session":"10.0.0.2","id":0}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/farm1/services/service0/sessions
zcli farm-service-session add farm1 service0 -backend 0 -session 10.0.0.2
POST /farms/<farmname>/services/<servicename>/sessions
From version 4.0.2. It creates a static session with a backend in a session. The input connection that matches with the session will be forwarded always to that backend. Property only avaliable for proxy of new generation zproxy.
Request parameters
Field | Type | Description |
---|---|---|
id | Number | Backend ID which will receive the connection. |
session | String | It is the session identifier or a connection, its value depend on the persistence parameter of the farm. If persistence is 'IP’, session should be a IPv4 or IPv6, e.g. 192.168.42.65; |
Response example:
{
"description" : "Adding a static session to the farm1",
"message" : "Added a session for the farm 'farm1'",
"params" : {
"id" : "0",
"session" : "10.0.0.1",
"ttl" : null,
"type" : "static"
}
}
Response Parameters
This request returns session object that contains the following keys:
Field | Type | Description |
---|---|---|
id | Number | Backend ID which will receive the connection. |
session | String | It is the session identifier or a connection, its value depend on the persistence parameter of the farm. If persistence is ’IP’, session should be a IPv4 or IPv6, e.g. 192.168.42.65. |
ttl | String | It is a string with the session time to expire. The ttl value will be null if the session is of type static. |
type | String | There are two type of sessions: dynamic is a connection that load balancer pins with a backend using the farm load balancing algorithm; static is a connection that the load balancer administrator pins with a backend. The static sessions will not be redirect to another backend if its backed in unreachable. |
Remove a session
Remove a session
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/farm1/services/service0/sessions/10.0.0.1
zcli farm-service-session remove farm1 service0 10.0.0.1
DELETE /farms/<farmname>/services/<servicename>/sessions/<session>
It deletes a static session.
Response example:
{
"description" : "Delete a 'static' session",
"message" : "The session '10.0.0.1' was deleted properly from the farm 'farm1'.",
"success" : "true"
}
HTTP - Services - Backends
List the backends
List the backends
Request example:
curl -k -X GET -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/httpfarm/services/service1/backends
zcli farm get httpfarm
GET /farms/<farmname>/services/<id>/backends
Get the list of backends in a service. id is the service unique identifier.
Response example:
{
"description" : "List service backends",
"params" : [
{
"alias" : null,
"id" : 0,
"ip" : "192.168.0.10",
"port" : 88,
"status" : "up",
"timeout" : 12,
"weight" : 1,
"priority" : null,
"connection_limit" : null
},
{
"alias" : null,
"id" : 1,
"ip" : "192.168.102.245",
"port" : 80,
"status" : "up",
"timeout" : 22,
"weight" : 2,
"priority" : null,
"connection_limit": null
}
]
}
Response Parameters
This call returns a backend object array with the bellow parameters.
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the backend. Alias |
id | Number | unique identifier for the backend in the service. This identifier is generated by the system. |
ip | String | Backend’s IP where the real service is listening. |
port | Number | Backend’s port where the real service is listening. |
timeout | Number | It’s the backend timeout to respond a certain request, in seconds. |
weight | Number | It’s the weight value for the current backend. The possible values are from 1 to 9. |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; maintenance, backend is marked as not ready for receiving connections by the administrator, this option is useful for backend’s maintenance tasks; undefined, the backend status has been not checked. |
priority (from 4.0.1) | Number | (Only when proxy new generation is working) It’s the priority value for the current real server. Backend with lower priority value will be ready to receive connections before than others with higher priority. Default value null, a priority value 1 is used. The possible values are from 1 to 9 |
connection_limit (from 4.0.2) | Number | (Only when proxy new generation is working) The maximum number of established connection per backend. With a value of 0, there will not be a limit in the backend. The client will receive a 503 error if there aren’t available backends. |
Create a new Backend
Create a new Backend
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.102.244","port":80, "weight":2,"timeout":2,"priority":1,"connection_limit":10}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/httpfarm/services/newsrv/backends
zcli farm-service-backend add httpfarm newsrv -ip 192.168.102.244 -port 80 -timeout 2 -priority 1 -weight 2 -connection_limit 10
POST /farms/<farmname>/services/<id>/backends
Create a new Backend in a given HTTP profile. id is the service unique identifier.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
ip | String | Backend’s IP where the real service is listening. | true |
port | Number | Backend’s port where the real service is listening. | true |
timeout | Number | It’s the backend timeout to respond to a certain request. | |
weight | Number | It’s the weight value for the current backend. The possible values are from 1 to 9. | |
priority (from 4.0.1) | Number | (Only when proxy new generation is working) It’s the priority value for the current real server. Backend with lower priority value will be ready to receive connections before than others with higher priority. Default value null, a priority value 1 is used. The possible values are from 1 to 9 | |
connection_limit (from 4.0.2) | Number | (Only when proxy new generation is working) The maximum number of established connection per backend. With a value of 0, there will not be a limit in the backend. The client will receive a 503 error if there aren’t available backends. |
Response example:
{
"description" : "New service backend",
"message" : "Added backend to service succesfully",
"params" : {
"id" : 0,
"ip" : "192.168.102.244",
"port" : 80,
"timeout" : 2,
"weight" : 2,
"priority" : 1,
"connection_limit" : 10
},
"status" : "needed restart"
}
Response Parameters
The response will be a JSON with requested parameters updated and the status field with the current status of the farm. If Restart action needs to be taken to apply the changes of the farm, the value will be needed restart.If there is
Modify a Backend
Modify a Backend
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.0.10","port":88,"timeout":12,"weight":1,"priority":1,"connection_limit":10}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/FarmHTTP/service/service1/backends/1
zcli farm-service-backend set FarmHTTP service1 1 -ip 192.168.0.10 -port 88 -timeout 12 -weight 1 -priority 1 -connection_limit 10
PUT /farms/<farmname>/services/<id>/backends/<id>
Modify the parameters of a backend HTTP service.
First id is the service unique identifier, next id is the backend unique identifier.
Request parameters
Field | Type | Description |
---|---|---|
ip | String | Backend’s IP where the real service is listening. |
port | Number | Backend’s port where the real service is listening. |
timeout | Number | It’s the backend timeout to respond a certain request, in seconds. |
weight | Number | It’s the weight value for the current backend. The possible values are from 1 to 9. |
priority (from 4.0.1) | Number | (Only when proxy new generation is working) It’s the priority value for the current real server. Backend with lower priority value will be ready to receive connections before than others with higher priority. Default value null, a priority value 1 is used. The possible values are from 1 to 9 |
connection_limit (from 4.0.2) | Number | (Only when proxy new generation is working) The maximum number of established connection per backend. With a value of 0, there will not be a limit in the backend. The client will receive a 503 error if there aren’t available backends. |
Response example:
{
"description" : "Modify service backend",
"info" : "There're changes that need to be applied, stop and start farm to apply them!",
"message" : "Backend modified",
"params" : {
"ip" : "192.168.0.10",
"port" : 88,
"timeout" : 12,
"weight" : 1,
"priority" : 4,
"connection_limit" : 10
},
"status" : "needed restart",
"warning" : "Backends with high priority value (4) will not be used."
}
Response Parameters
The response will be a JSON with requested parameters updated and the status field with the current status of the farm. If Restart action needs to be taken to apply the changes of the farm, the value will be needed restart. If Priority parameter is updated whith a inconsistent value, the warning field will describe it.
Backend in maintenance
Backend in maintenance
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"action":"maintenance","mode":"cut"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/httpfarm/services/newsrv/backends/0/maintenance
zcli farm-service-backend maintenance httpfarm newsrv 0 -mode cut
PUT /farms/<farmname>/services/<id>/backends/<id>/maintenance
Set a given action in a backend of an HTTP farm, available actions are described below.
First id is the service unique identifier, next id is the backend unique identifier.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
action | String | Set the action desired. The actions are: up the backend is ready to receive client requests, maintenance backend is not ready to receive client requests, this action is useful for stopping the backend server without effect to the clients. | |
mode | String | Choose a maintenance mode. The available options are: drain, the backend doesn’t accept new connections, but it will continue to handle the current connections; or cut, the current connections will be closed. | If this field is not specified, the default mode will be drain. |
Response example:
{
"description" : "Set service backend status",
"params" : {
"action" : "maintenance",
"mode" : "cut"
}
}
Delete a backend
Delete a backend
Request example:
curl -k -X DELETE -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/newfarmHTTP/services/service1/backends/4
zcli farm-service-backend remove newfarmHTTP service1 4
DELETE /farms/<farmname>/services/<id>/backends/<id>
Delete a given backend from an HTTP service.
First id is the service unique identifier, next id is the backend unique identifier.
Response example:
{
"description" : "Delete service backend",
"message" : "Backend removed",
"success" : "true"
}
L4xNAT Farms
The L4xNAT profile farm allows creating load balancing farms that work in the layer 4 of the OSI model, with very high performance and much more concurrent connections than load balancer cores in layer 7 like HTTP farm profiles. That layer 4 performance improvement counteracts the advanced content handling that the layer 7 profiles could manage.
Additionally, L4xNAT farms could bind a range of ports, not only one virtual port as is used with the other layer 7 profiles. In order to be able to select a range of virtual ports or a specific virtual port in L4xNAT farms, it’s mandatory to select a protocol type. In another case, the farm will be listening on all ports from the virtual IP ( indicated with a character ‘*’ ). Once a TCP or UDP protocol is selected, it will be available to specify a port, several ports between ‘,’ , ports range between ‘:’ or all ports with ‘*’. A combination of all of them will be valid as well.
Retrieve farm by name
Retrieve farm by name
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/l4farm
zcli farm get l4farm
GET /farms/<farmname>
Show all configuration about a given farm.
Response BODY:
{
"backends" : [
{
"alias" : null,
"max_conns" : 0,
"id" : 0,
"ip" : "192.168.55.40",
"port" : "88",
"priority" : 2,
"status" : "undefined",
"weight" : 1
},
{
"alias" : "server-1",
"id" : 1,
"max_conns" : 500,
"ip" : "192.168.55.41",
"port" : "88",
"priority" : 3,
"status" : "undefined",
"weight" : 2
}
],
"description" : "List farm l4farm",
"ipds" : {
"blacklists" : [
{
"status" : "down",
"name" : "blacklist"
}
],
"dos" : [
{
"name" : "newlimitconns",
"status" : "down"
}
],
"rbl" : [
{
"name" : "protection_ssh",
"status" : "up"
}
]
},
"params" : {
"algorithm" : "weight",
"farmguardian" : "check_tcp-cut_conns",
"listener" : "l4xnat",
"logs" : "false",
"nattype" : "nat",
"persistence" : "ip",
"protocol" : "tcp",
"status" : "down",
"ttl" : 120,
"vip" : "192.168.100.241",
"vport" : "88",
"sessions": []
}
}
Response parameters
The response will be a JSON object with the format below.
Farm Object:
Field | Type | Description |
---|---|---|
ipds | Object | List of IPDS rules applied to this farm. |
params | Object | Parameters of farm configuration. |
backends | Object[] | All real servers created in this farm and its configuration. |
IPDS Object:
Field | Type | Description |
---|---|---|
blacklists | Object[] | Blacklist rules applied to the farm. |
dos | Object[] | DoS rules applied to the farm. |
rbl | Object[] | RBL rules applied to the farm. |
Blacklist, DoS and RBL Object:
Field | Type | Description |
---|---|---|
name | String | The rule name. |
status | String | Rule status. |
Parameters object for L4xNAT farms:
Field | Type | Description |
---|---|---|
algorithm | String | Type of load balancing scheduling used to dispatch the traffic between the backends. The options are: leastconn forwards connection always to the least connection server; weight connection linear dispatching depending on the backend weight; roundrobin does a sequential select between the backend pool, each backend will receive the same number of requests; hash_srcip balances packets that match the same source IP to the same backend; hash_srcip_srcport balances packets that match the same source IP and port to the same backend; symhash balance packets that match the same source IP and port and destination IP and port, so it could hash a connection in both ways (during inbound and outbound). |
listener | String | A listener defines how the farm is going to play with the requests from the clients. informational field, it can’t be modified. |
logs | String | The farm Logs packet information of the transport layer, it is not available application layer information. If this parameter has the value true, the logs are enabled; if it has the value false, logs are disabled. |
nattype | String | How the load balancer layer 4 core is going to operate. The options are: nat also called sNAT mode, the backend responds to the load balancer in order to send the response to the client; dnat the backend will respond directly to the client, load balancer has to be configured as gateway in the backend server; In dsr (Direct Server Return) mode the client connects to the VIP, then the load balancer changes its destination MAC address for the backend MAC address (the server must be on the same link media as the load balancer); Stateless DNAT. In stateless_dnat the load balancer switch destination address for the backend address and forward it to the backend as DNAT does, but it doesn’t manage any kind of connection information. |
persistence | String | This parameter forwards the incoming request to the same backend in base on the persistence mode chosen. The options are: “” empty value disables the persistence, each incoming packet will be balanced between the backends; ip or srcip, Source IP, will assign the same backend for every incoming connection depending on the source IP address only; Port, Source Port, will assign the same backend for every incoming connection depending on the source port only. srcmac, Source MAC, With this option, the farm will assign the same backend for every incoming connection depending on link-layer MAC address of the packet; srcip_srcport, Source IP and Source Port, will assign the same backend for every incoming connection depending on both, source IP and source port; srcip_dstport, Source IP and Destination Port, will assign the same backend for every incoming connection depending on both, source IP and destination port. |
protocol | String | Protocol to be balanced at layer 4. The options are: all the profile will load balance any L4 protocol; tcp the load balancer only will balance TCP L4 protocol, also for TCP, it is possible to set once of the following protocols in order to parse its headers and use it to distribute properly: ftp, irc, pptp, or sane; udp the load balancer only will balance UDP L4 protocol, also for UDP, it is possible to set once of the following protocols in order to parse its headers and use it to distribute properly: sip, tftp, amanda, netbios-ns, or snmp; sctp, the load balancer only will balance SCTP L4 protocol. If h323 is selected, the farm will listen the TCP and UDP requests and parse its headers to balance between the backends. |
status | String | Farm status. The available status values are: down, the farm is not running; needed restart, the farm is up but it is pending of a restart action; critical, the farm is up and all backends are unreachable or maintenance; problem, the farm is up and there are some backend unreachable, but almost a backend is in up status; maintenance, the farm is up and there are backends in up status, but almost a backend is in maintenance mode; up, the farm is up and all the backends are working success. |
ttl | Number | This field value indicates the number of seconds that the persistence between the client source and the backend is being assigned, in seconds. Persistence must be configured. |
vip | String | IP of the farm, where the virtual service is listening. |
vport | String | Port of the farm, where the virtual service is listening. A unique port can be specified, a range port can be specified with separator : and several ports can be specified with separator ,. |
farmguardian | String | It is the FarmGuardian name that is checking the backend status. FarmGuardian will be running while the farm is in up status. |
sessions (from version 4.0.2) | Object[] | List of static and dynamic sessions created for this farm. |
Backend object for L4xNAT farms:
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the backend. Alias |
id | Number | ID to identify the backend in the farm backends pool. |
ip | String | Backend’s IP where the real service is listening. |
port | Number | Backend’s port where the real service is listening. Empty value is accepted and it will use the same configuration than the virtual port(s). |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; maintenance, backend is marked as not ready for receiving connections by the administrator, this option is useful for backend’s maintenance tasks; undefined, the backend status has been not checked. |
priority | Number | It’s the priority value for the current real server. Backend with lower priority value will be ready to receive connections before than others with higher priority. Default value null, a priority value 1 is used. The possible values are are from 1 to 9. |
weight | Number | It’s the weight value for the current real server. Backends with more weight will receive more connections. The possible values are from 1 to 9. |
max_conns | Number | It is the maximum number of connection that the backend is going to receive simultaneously. If it is set with a 0 value the backend has not defined any limit. |
Session object for L4xNAT farms:
Field | Type | Description |
---|---|---|
client | Number | It is a client identifier. |
id | Number | Backend ID which will receive the connection. |
session | String | It is the session identifier or a connection, its value depend on the persistence parameter of the farm. If persistence is ‘mac’, session should be a MAC, e.g. 02:8e:69:38:12:8e; if persistence is 'ip’ or 'srcip’, session should be a IPv4 or IPv6, e.g. 192.168.42.65; if persistence is 'port’, session should be a valid port, e.g. 5445; if persistence is 'srcip_srcport’ or 'srcip_dstport’ ; session should be a string with an IP and a port joined by underscope ’’, e.g. 122.36.54.280. |
ttl | String | It is a string with the session time to expire. The ttl value will be null if the session is of type static. |
type | String | There are two type of sessions: dynamic is a connection that load balancer pins with a backend using the farm load balancing algorithm; static is a connection that the load balancer administrator pins with a backend. The static sessions will not be redirect to another backend if its backed in unreachable. |
Create a new Farm
Create a new Farm
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"profile":"l4xnat", "vip":"192.168.100.241", "vport":"88","farmname":"newl4farm"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms
zcli farm create -farmname newl4farm -vip 192.168.100.241 -vport 88 -profile l4xnat
POST /farms
Create a new L4xNAT farm.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
farmname | String | Farm name, unique identifier. | true |
profile | String | The profile of the created Farm. For L4xNAT farms is l4xnat, information message, this value can’t be changed | true |
vip | String | IP of the farm, where the virtual service is listening. | true |
vport | String | Port of the farm, where the virtual service is listening. L4xNAT farms allow multiport separated by , or range port separated by :. | true |
copy_from (from 4.0.1) | String | This parameter expects the name of a farm that exists. If this parameter is sent, the farm is copied from the farm specified in it. The farmname, vip and vport values will be overwritten. |
Response example:
{
"description" : "Creating farm 'newl4farm'",
"params" : {
"farmname" : "newl4farm",
"interface" : "eth0",
"profile" : "l4xnat",
"vip" : "192.168.100.241",
"vport" : "88"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Modify a Farm
Modify a Farm
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"algorithm":"weight","persistence":"","newfarmname":"l4farm", "protocol":"tcp",
"nattype":"nat","ttl":125,"vip":"178.62.126.152","vport":"81","logs":"true"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/newfarml4
zcli farm set newfarml4 -algorithm weight -newfarmname l4farm -protocol tcp -nattype nat -ttl 125 -vip 178.62.126.152 -vport 81 -logs true
PUT /farms/<farmname>
Modify the configuration of an L4xNAT farm.
Request parameters
Field | Type | Description |
---|---|---|
newfarmname | String | The new Farm’s name. The farm must be stopped. |
logs | String | The farm Logs packet information of the transport layer, it is not available application layer information. If this parameter has the value true, the logs are enabled; if it has the value false, logs are disabled. |
ttl | Number | This field value indicates the number of seconds that the persistence between the client source and the backend is being assigned, in seconds. Persistence must be configured. |
vip | String | IP of the farm, where the virtual service is listening. |
vport | String | Port of the farm, where the virtual service is listening. A unique port can be specified, a range port can be specified with separator : and several ports can be specified with separator ,. |
persistence | String | This parameter forwards the incoming request to the same backend in base on the persistence mode chosen. The options are: “” empty value disables the persistence, each incoming packet will be balanced between the backends; ip or srcip, Source IP, will assign the same backend for every incoming connection depending on the source IP address only; Port, Source Port, will assign the same backend for every incoming connection depending on the source port only. srcmac, Source MAC, With this option, the farm will assign the same backend for every incoming connection depending on link-layer MAC address of the packet; srcip_srcport, Source IP and Source Port, will assign the same backend for every incoming connection depending on both, source IP and source port; srcip_dstport, Source IP and Destination Port, will assign the same backend for every incoming connection depending on both, source IP and destination port. |
nattype | String | How the load balancer layer 4 core is going to operate. The options are: nat also called sNAT mode, the backend responds to the load balancer in order to send the response to the client; dnat the backend will respond directly to the client, load balancer has to be configured as gateway in the backend server; In dsr (Direct Server Return) mode the client connects to the VIP, then the load balancer changes its destination MAC address for the backend MAC address (the server must be on the same link media as the load balancer); Stateless DNAT. In stateless_dnat the load balancer switch destination address for the backend address and forward it to the backend as DNAT does, but it doesn’t manage any kind of connection information. |
algorithm | String | Type of load balancing scheduling used to dispatch the traffic between the backends. The options are: leastconn forwards connection always to the least connection server; weight connection linear dispatching depending on the backend weight; roundrobin does a sequential select between the backend pool, each backend will receive the same number of requests; hash_srcip balances packets that match the same source IP to the same backend; hash_srcip_srcport balances packets that match the same source IP and port to the same backend; symhash balance packets that match the same source IP and port and destination IP and port, so it could hash a connection in both ways (during inbound and outbound). |
protocol | String | Protocol to be balanced at layer 4. The options are: all the profile will load balance any L4 protocol; tcp the load balancer only will balance TCP L4 protocol, also for TCP, it is possible to set once of the following protocols in order to parse its headers and use it to distribute properly: ftp, irc, pptp, or sane; udp the load balancer only will balance UDP L4 protocol, also for UDP, it is possible to set once of the following protocols in order to parse its headers and use it to distribute properly: sip, tftp, amanda, netbios-ns, or snmp; sctp, the load balancer only will balance SCTP L4 protocol. If h323 is selected, the farm will listen the TCP and UDP requests and parse its headers to balance between the backends. |
Response example:
{
"description" : "Modify farm l4farm",
"params" : {
"algorithm" : "weight",
"logs" : "true",
"nattype" : "nat",
"newfarmname" : "l4farm",
"persistence" : "",
"protocol" : "tcp",
"ttl" : 125,
"vip" : "178.62.126.152",
"vport" : "81"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Add FarmGuardian
Add FarmGuardian
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"name":"check_tcp-cut_conns"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/l4Farm/fg
zcli farm-service-farmguardian add l4Farm default_service -name check_tcp-cut_conns
POST /farms/<farmname>/fg
Apply a FarmGuardian to the farm.
Request parameters
Field | Type | Description |
---|---|---|
name | String | FarmGuardian unique identifier. The FarmGuardians are created and modified in the monitoring section. |
Response example:
{
"description" : "Add the farm guardian check_tcp-cut_conns to the farm fgl4",
"message" : "Success, The farm guardian check_tcp-cut_conns was added to the farm fgl4"
}
Remove FarmGuardian
Remove FarmGuardian
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/l4Farm/fg/check_tcp-cut_conns
zcli farm-service-farmguardian remove l4Farm default_service check_tcp-cut_conns
DELETE /farms/<farmname>/fg/<name>
Remove the FarmGuardian from the farm.
Response example:
{
"description" : "Remove the farm guardian check_tcp-cut_conns from the farm fgl4",
"message" : "Sucess, check_tcp-cut_conns was removed from the farm fgl4"
}
Add POST /farms/<farmname>/sessions
Add DELETE /farms/<farmname>/sessions/<session>
List the sessions
List the sessions
Request example:
curl -k -X GET -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/farm1/sessions
zcli farm-session list farm1
GET /farms/<farmname>/sessions
Get the list of sessions in the farm.
Response example:
{
"description" : "Get farm sessions",
"params": [
{
"client": 0,
"id": "0",
"session": "10.0.0.2_56",
"ttl": null,
"type": "static"
},
{
"client": 1,
"id": "0",
"session": "10.0.0.2_54936",
"ttl": "58m28s148ms",
"type": "dynamic"
},
{
"client": 2,
"id": "0",
"session": "10.0.0.2_54968",
"ttl": "59m56s496ms",
"type": "dynamic"
}
]
}
Response Parameters
This request returns a list of sessions objects, each session object contains the following keys:
Field | Type | Description |
---|---|---|
client | Number | It is a client identifier. |
id | Number | Backend ID which will receive the connection. |
session | String | It is the session identifier or a connection, its value depend on the persistence parameter of the farm. If persistence is 'mac’, session should be a MAC, e.g. 02:8e:69:38:12:8e; if persistence is 'ip’ or 'srcip’, session should be a IPv4 or IPv6, e.g. 192.168.42.65; if persistence is 'port’, session should be a valid port, e.g. 5445; if persistence is 'srcip_srcport’ or 'srcip_dstport’ ; session should be a string with an IP and a port joined by underscope ’’, e.g. 122.36.54.280. |
ttl | String | It is a string with the session time to expire. The ttl value will be null if the session is of type static. |
type | String | There are two type of sessions: dynamic is a connection that load balancer pins with a backend using the farm load balancing algorithm; static is a connection that the load balancer administrator pins with a backend. The static sessions will not be redirect to another backend if its backed in unreachable. |
Add a session
Add a session
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"session":"10.0.0.2_56","id":0}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/farm1/sessions
zcli farm-session add farm1 -id 0 -session 10.0.0.2_56
POST /farms/<farmname>/sessions
It creates a static session with a backend. The input connection that matches with the session will be forwarded always to that backend.
Request parameters
Field | Type | Description |
---|---|---|
id | Number | Backend ID which will receive the connection. |
session | String | It is the session identifier or a connection, its value depend on the persistence parameter of the farm. If persistence is 'mac’, session should be a MAC, e.g. 02:8e:69:38:12:8e; if persistence is 'ip’ or 'srcip’, session should be a IPv4 or IPv6, e.g. 192.168.42.65; if persistence is 'port’, session should be a valid port, e.g. 5445; if persistence is 'srcip_srcport’ or 'srcip_dstport’ ; session should be a string with an IP and a port joined by underscope ’’, e.g. 122.36.54.280. |
Response example:
{
"description" : "Adding a static session to the farm1",
"message" : "Added a session for the farm 'farm1'",
"params" : {
"client" : 1,
"id" : "0",
"session" : "10.0.0.1_56",
"ttl" : null,
"type" : "static"
}
}
Response Parameters
This request returns session object that contains the following keys:
Field | Type | Description |
---|---|---|
client | Number | It is a client identifier. |
id | Number | Backend ID which will receive the connection. |
session | String | It is the session identifier or a connection, its value depend on the persistence parameter of the farm. If persistence is 'mac’, session should be a MAC, e.g. 02:8e:69:38:12:8e; if persistence is 'ip’ or 'srcip’, session should be a IPv4 or IPv6, e.g. 192.168.42.65; if persistence is 'port’, session should be a valid port, e.g. 5445; if persistence is 'srcip_srcport’ or 'srcip_dstport’ ; session should be a string with an IP and a port joined by underscope ’’, e.g. 122.36.54.280. |
ttl | String | It is a string with the session time to expire. The ttl value will be null if the session is of type static. |
type | String | There are two type of sessions: dynamic is a connection that load balancer pins with a backend using the farm load balancing algorithm; static is a connection that the load balancer administrator pins with a backend. The static sessions will not be redirect to another backend if its backed in unreachable. |
Remove a session
Remove a session
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/farm1/sessions/10.0.0.1_56
zcli farm-session remove farm1 10.0.0.1_56
DELETE /farms/<farmname>/sessions/<session>
It deletes a static session.
Response example:
{
"description" : "Delete a 'static' session",
"message" : "The session '10.0.0.1_56' was deleted properly from the farm 'farm1'.",
"success" : "true"
}
Add an IPDS rule
Add an IPDS rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"name":"china"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/l4Farm/ipds/blacklists
zcli farm-blacklist add l4Farm -name china
POST /farms/<farmname>/ipds/<dos|blacklists|rbl>
Apply blacklists, DoS or RBL rules to a farm.
Request parameters
Field | Type | Description |
---|---|---|
name | String | IPDS rule name used as a unique identifier. |
Response example:
{
"description" : "Apply a rule to a farm",
"message" : "Blacklist rule china was applied successful to the farm l4Farm.",
"success" : "true"
}
Remove an IPDS rule
Remove an IPDS rule
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/l4Farm/ipds/blacklists/china
zcli farm-blacklist remove l4Farm china
DELETE /farms/<farmname>/ipds/<dos|blacklists|rbl>/<name>
Remove a blacklist, DoS or RBL rule of IPDS module from a given farm using its indicator name.
Response example:
{
"description" : "Delete a rule from a farm",
"message" : "Blacklist rule china was removed successful from the farm l4Farm.",
"success" : "true"
}
L4xNAT - Backends
List the backends
List the backends
Request example:
curl -k -X GET -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/l4farm/backends
zcli farm get l4farm
GET /farms/<farmname>/backends
Get the list of backends in a service.
Response example:
{
"description" : "List backends",
"params" : [
{
"alias" : null,
"id" : 0,
"ip" : "192.5.1.1",
"max_conns" : 400,
"port" : 787,
"priority" : 1,
"status" : "up",
"weight" : 1
},
{
"alias" : "server-2",
"id" : 1,
"ip" : "192.5.1.3",
"max_conns" : 200,
"port" : 787,
"priority" : 2,
"status" : "up",
"weight" : 1
},
]
}
Response Parameters
This call returns a backend object array with the bellow parameters.
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the backend. Alias |
id | Number | ID to identify the backend in the farm backends pool. |
ip | String | Backend’s IP where the real service is listening. |
port | Number | Backend’s port where the real service is listening. Empty value is accepted and it will use the same configuration than the virtual port(s). |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; maintenance, backend is marked as not ready for receiving connections by the administrator, this option is useful for backend’s maintenance tasks; undefined, the backend status has been not checked. |
max_conns | Number | It’s the maximum number of concurrent connections for the backend. If this field has the value 0, the backend doesn’t have configurated any connection limit. |
priority | Number | It’s the priority value for the current real server. Connections always to the most priority available where 1 is the most priority and 9 is the least priority. |
weight | Number | It’s the weight value for the current real server. Backends with more weight will receive more connections. The possible values are from 1 to 9. |
Create a new Backend
Create a new Backend
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.5.100","port":8080,"max_conns":400}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/l4farm/backends
zcli farm-service-backend add l4farm default_service -ip 192.168.5.100 -port 8080 -max_conns 400
POST /farms/<farmname>/backends
Create a new Backend in a given L4xNAT Farm.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
ip | String | Backend’s IP where the real service is listening. | true |
port | Number | Backend’s port where the real service is listening. Empty value is accepted and it will use the same configuration than the virtual port(s). | |
max_conns | Number | It’s the maximum number of concurrent connections for the backend. If this field has the value 0, the backend doesn’t have configurated any connection limit. | |
priority | Number | It’s the priority value for the current real server. Backend with lower priority value will be ready to receive connections before than others with higher priority. Default value null, a priority value 1 is used. The possible values are are from 1 to 9. | |
weight | Number | It’s the weight value for the current real server. Backends with more weight will receive more connections. The possible values are from 1 to 9. |
Response example:
{
"description" : "New farm backend",
"message" : "Backend added",
"params" : {
"id" : 5,
"ip" : "192.168.5.100",
"port" : 8080,
"max_conns" : 400,
"priority" : null,
"weight" : null
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Modify a Backend
Modify a Backend
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.5.40","port":8080,"max_conns":220,"priority":4,"weight":7}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/l4farm/backends/2
zcli farm-service-backend set l4farm default_service 2 -ip 192.168.5.40 -port 8080 -max_conns 220 -priority 4 -weight 7
PUT /farms/<farmname>/backends/<id>
Modify the parameters of a backend in for a L4xNAT Farm. id is the backend unique identifier.
Request parameters
Field | Type | Description |
---|---|---|
ip | String | Backend’s IP where the real service is listening. |
port | Number | Backend’s port where the real service is listening. Empty value is accepted and it will use the same configuration than the virtual port(s). |
max_conns | Number | It’s the maximum number of concurrent connections for the backend. If this field has the value 0, the backend doesn’t have configurated any connection limit. |
priority | Number | It’s the priority value for the current real server. Backend with lower priority value will be ready to receive connections before than others with higher priority. Default value null, a priority value 1 is used. The possible values are are from 1 to 9. |
weight | Number | It’s the weight value for the current real server. Backends with more weight will receive more connections. The possible values are from 1 to 9. |
Response example:
{
"description" : "Modify backend",
"message" : "Backend modified",
"params" : {
"ip" : "192.168.5.40",
"port" : 8080,
"max_conns" : 220,
"priority" : 4,
"weight" : 7
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Backend in maintenance
Backend in maintenance
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"action":"maintenance","mode":"cut"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/l4farm/backends/1/maintenance
zcli farm-service-backend maintenance l4farm default_service 1 -mode cut
PUT /farms/<farmname>/backends/<id>/maintenance
Set a given action in a backend of an L4xNAT farm. id is the backend unique identifier.
Request parameters
Field | Type | Description |
---|---|---|
action | String | Set the action desired. The actions are: up the backend is ready to receive client requests, maintenance backend is not ready to receive client requests, this action is useful for stopping the backend server without effect to the clients. |
mode | String | Choose a maintenance mode. The available options are: drain, the backend doesn’t accept new connections, but it will continue to handle the current connections; or cut, the current connections will be closed. |
Response example:
{
"description" : "Set backend status",
"params" : {
"action" : "maintenance",
"mode" : "cut"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Delete a backend
Delete a backend
Request example:
curl -k -X DELETE -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/l4farm/backends/4
zcli farm-service-backend remove l4farm default_service 4
DELETE /farms/<farmname>/backends/<id>
Delete a given backend for an L4xNAT Farm.
id is the backend unique identifier.
Response example:
{
"description" : "Delete backend",
"message" : "Backend removed",
"success" : "true"
}
GSLB Farms
The Global Service Load Balancing, commonly called GSLB, allows creating a load balancing service based on the DNS service hierarchical architecture. This kind of farm provides an authoritative-only DNS with load balancing algorithms and service state detection at the DNS application layer.
Retrieve farm by name
Retrieve farm by name
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm
zcli farm get gslbfarm
GET /farms/<farmname>
Show all configuration about a given farm.
Response example:
{
"description" : "List farm gslbfarm",
"ipds" : {
"blacklists" : [],
"dos" : [],
"rbl" : [
{
"name" : "protection_ssh",
"status" : "up"
}
]
},
"params" : {
"status" : "needed restart",
"vip" : "192.168.100.155",
"vport" : 60
},
"services" : [
{
"algorithm" : "roundrobin",
"backends" : [
{
"alias" : "localhost",
"id" : 1,
"ip" : "127.0.0.1",
"port" : 53,
"status" : "up"
},
{
"alias" : "dns-server",
"id" : 2,
"ip" : "192.168.55.40",
"port" : 53,
"status" : "up"
},
{
"alias" : null,
"id" : 4,
"ip" : "192.135.10.2",
"port" : 53,
"status" : "up"
}
],
"deftcpport" : 53,
"farmguardian" : "dns-request",
"id" : "service1"
},
{
"algorithm" : "prio",
"backends" : [
{
"alias" : "localhost",
"id" : 1,
"ip" : "127.0.0.1",
"port" : 80,
"status" : "up"
},
{
"alias" : "localhost",
"id" : 2,
"ip" : "127.0.0.1",
"port" : 80,
"status" : "up"
}
],
"deftcpport" : 80,
"farmguardian" : null,
"id" : "prioServ"
}
],
"zones" : [
{
"defnamesv" : "ns3",
"id" : "global.com",
"resources" : [
{
"id" : 0,
"rdata" : "ns3",
"rname" : "@",
"ttl" : null,
"type" : "NS"
},
{
"id" : 1,
"rdata" : "192.168.100.155",
"rname" : "ns3",
"ttl" : null,
"type" : "A"
},
{
"id" : 3,
"rdata" : "resource2",
"rname" : "ns2",
"ttl" : null,
"type" : "NS"
},
{
"id" : 4,
"rdata" : "192.168.200.30",
"rname" : "resource2",
"ttl" : null,
"type" : "A"
}
]
},
{
"defnamesv" : "ns1",
"id" : "DOM.com",
"resources" : [
{
"id" : 0,
"rdata" : "ns1",
"rname" : "@",
"ttl" : null,
"type" : "NS"
},
{
"id" : 1,
"rdata" : "192.168.100.155",
"rname" : "ns1",
"ttl" : null,
"type" : "A"
}
]
}
]
}
Response parameters
The response will be a JSON object with the format below.
Farm Object:
Field | Type | Description |
---|---|---|
ipds | Object | List of IPDS rules applied to this farm. |
params | Object | Parameters of farm configuration. |
services | Object[] | Array with all services created in this farm and its configuration. |
zones | Object[] | Array with all zones created in this farm and its configuration. |
IPDS Object:
Field | Type | Description |
---|---|---|
blacklists | Object[] | Blacklists applied to the farm. |
dos | Object[] | DoS rules applied to the farm. |
rbl | Object[] | RBL rules applied to the farm. |
Blacklist, DoS and RBL Object:
Field | Type | Description |
---|---|---|
name | String | The rule name. |
status | String | Rule status. |
Parameter object for GSLB farms:
Field | Type | Description |
---|---|---|
vip | String | IP of the farm, where the virtual service is listening. |
vport | Number | Port of the farm, where the virtual service is listening. |
status | String | Farm status. The available status values are: down, the farm is not running; needed restart, the farm is up but it is pending of a restart action; critical, the farm is up and all backends are unreachable; problem, the farm is up and there are some backend unreachable, but almost a backend is in up status; up, the farm is up and all the backends are working success. |
Service object for GSLB farms:
Field | Type | Description |
---|---|---|
backends | Object[] | Backends defined in the service. |
farmguardian | String | It is the FarmGuardian name that is checking the backend status. FarmGuardian will be running while the farm is in up status. Farmguardian logs are not available for GSLB farms |
id | String | Service name which is used as a unique identifier. |
algorithm | String | Type of load balancing algorithm used in the service. The options are: roundrobin, which will balance connections among all up backends, or prio which will send all connections to the first available backend. |
deftcpport | Number | Default TCP port health check. This is the health check TCP port that the service is going to check to determine that the backend service is alive. An empty value is disabled. |
Backend object for GSLB farms:
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the backend. Alias |
id | Number | Unique identifier for the backend in the service. This identifier is generated by the system. |
ip | String | Backend’s IP where the real service is listening. |
port | Number | Backend’s port where the real service is listening. |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; undefined, the backend status has been not checked. |
Zone object:
Field | Type | Description |
---|---|---|
id | Number | Zone’s name is used as a unique indetifier. |
defnamesv | String | This will be the entry point root name server that will be available as the Start of Authority (SOA) DNS record. |
resources | Object[] | Resources defined in the zone. |
Resource object:
Field | Type | Description |
---|---|---|
id | Number | Unique identifier for the resource in the zone. |
rname | String | The resource name is the nick that DNS service will translate for the real required data in the field rdata. |
ttl | Number | The Time to Live (optional) value for the current record which it’s needed to determine the length of time that the current name will be cached. |
type | String | DNS record type. The options are: NS, A, AAAA, CNAME, DYNA, MX, SRV, TXT, PTR or NAPTR). For more information, look at in GSLB - Zones - Resources section. |
rdata | String | It’s the real data needed by the record type, input value depends on the kind of Resource Name, rname and the resource type, type. |
Create a new Farm
Create a new Farm
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"farmname":"gslbfarm","profile":"gslb","vip":"192.168.100.241","vport":53}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms
zcli farm create -farmname gslbfarm -vip 192.168.100.241 -vport 53 -profile gslb
POST /farms
Create a new GSLB farm.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
farmname | String | Farm name is used as the unique identifier for farms. | true |
profile | String | The profile of the created Farm. For GSLB farms is gslb. | true |
vip | String | IP of the farm, where the virtual service is listening. | true |
vport | Number | Port of the farm, where the virtual service is listening. | true |
copy_from (from 4.0.1) | String | This parameter expects the name of a farm that exists. If this parameter is sent, the farm is copied from the farm specified in it. The farmname, vip and vport values will be overwritten. |
Response example:
{
"description" : "Creating farm 'gslbfarm'",
"params" : {
"farmname" : "gslbfarm",
"interface" : "eth0",
"profile" : "gslb",
"vip" : "192.168.100.241",
"vport" : 53
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Modify a Farm
Modify a Farm
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"newfarmname":"gslbnewname","vip":"192.168.100.155","vport":60}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm
zcli farm set gslbfarm -newfarmname gslbnewname -vip 192.168.100.155 -vport 60
PUT /farms/<farmname>
Modify the configuration of a GSLB farm.
Request parameters
Field | Type | Description |
---|---|---|
newfarmname | String | The new Farm’s name. The farm must be stopped to do this change. |
vport | Number | Port of the farm, where the virtual service is listening. |
vip | String | IP of the farm, where the virtual service is listening. |
Response example:
{
"description" : "Modify farm gslbnewname",
"params" : {
"newfarmname" : "gslbnewname",
"vip" : "192.168.100.155",
"vport" : 60
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Add an IPDS rule
Add an IPDS rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"name":"china"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbFarm/ipds/blacklists
zcli farm farm-blacklist add gslbFarm -name china
POST /farms/<farmname>/ipds/<dos|blacklists|rbl>
Apply a blacklist, DoS or RBL rule to the farm.
Request parameters
Field | Type | Description |
---|---|---|
name | String | IPDS rule name used as a unique identifier. |
Response example:
{
"description" : "Apply a rule to a farm",
"message" : "Blacklist rule china was applied successful to the farm gslbFarm.",
"success" : "true"
}
Remove an IPDS rule
Remove an IPDS rule
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbFarm/ipds/blacklists/china
zcli farm-blacklist remove gslbFarm china
DELETE /farms/<farmname>/ipds/<dos|blacklists|rbl>/<name>
Remove a blacklist, DoS or RBL rule from a given farm using its identifier name.
Response example:
{
"description" : "Delete a rule form a farm",
"message" : "Blacklist rule china was removed successful from the farm gslbFarm.",
"success" : "true"
}
GSLB - Services
A GSLB service represents a group of real servers and an associated algorithm to be used for them. To create a new service, you’ve to set a valid identification name and the desired algorithm to use.
The available services are:
Round Robin: equal sharing. An equal balance of traffic to all active real servers. For every incoming connection, the balancer assigns the next round robin real server to deliver the request.
Priority: connections always to the most priority available. Balance all connections to the same highest priority server. If this server is down, the connections switch to the next highest server. With this algorithm, you can build an Active-Passive cluster service with several real servers.
Services object for GSLB farms
Field | Type | Description |
---|---|---|
backends | Object[] | Backends defined in the service. |
farmguardian | String | It is the FarmGuardian name that is checking the backend status. FarmGuardian will be running while the farm is in up status. |
id | String | Service name which is used as the unique identifier. |
algorithm | String | Type of load balancing algorithm used in the service. The options are: roundrobin, which will balance connections among all up backends, or prio which will send all connections to the first available backend. |
deftcpport | String | Default TCP port health check. This is the health check TCP port that the service is going to check to determine that the backend service is alive. An empty value is disabled. |
Create a new Service
Create a new Service
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"id":"service1","algorithm":"roundrobin"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/services
zcli farm-service add gslbfarm -id service1 -algorithm roundrobin
POST /farms/<farmname>/services
Create a service in a given GSLB Farm. The farm must be restarted to apply this change.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
id | String | Service name which is used as the unique identifier. | true |
algorithm | String | Type of load balancing algorithm used in the service. The options are: roundrobin, which will balance connections amoung all up backends, or prio which will send all connections to the first available backend. | true |
Response example:
{
"description" : "New service service1",
"params" : {
"algorithm" : "roundrobin",
"id" : "service1"
},
"status" : "needed restart"
}
Response parameters
The response will be a json with all requested values updated. See the response example for more information.
Modify a Service
Modify a Service
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"deftcpport":53}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/services/service1
zcli farm-service set gslbfarm service1 -deftcpport 53
PUT /farms/<farmname>/services/<id>
Modify the parameters of a GSLB service. id is the service unique identifier that will be modified.
Request parameters
Field | Type | Description |
---|---|---|
deftcpport | Number | This is the health check TCP port that the service is going to check to determine that the backend service is alive. |
Response example:
{
"description" : "Modify service service1 in farm gslbfarm",
"info" : "There're changes that need to be applied, stop and start farm to apply them!",
"params" : {
"deftcpport" : 53
},
"status" : "needed restart"
}
Response parameters
The response will be a json with all requested values updated. See the response example for more information.
Add FarmGuardian
Add FarmGuardian
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"name":"dns-request"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/service/service1/fg
zcli farm-service-farmguardian add gslbfarm service1 -name dns-request
POST /farms/<farmname>/services/<id>/fg
Apply a FarmGuardian to a service.
The URI parameter is the service unique identifier.
Request parameters
Field | Type | Description |
---|---|---|
name | String | FarmGuardian unique identifier. The FarmGuardians are created and modified in the monitoring section. FarmGuardian logs are not available for gslb farms. |
Response example:
{
"description" : "Add the farm guardian dns-request to the service service1 in the farm gslbfarm",
"message" : "Success, The farm guardian dns-request was added to the service service1 in the farm gslbfarm"
}
Remove FarmGuardian
Remove FarmGuardian
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/service/service1/fg/dns-request
zcli farm-service-farmguardian remove gslbfarm service1 dns-request
DELETE /farms/<farmname>/fg/<name>
Remove the FarmGuardian from a GSLB service.
Response example:
{
"description" : "Remove the farm guardian dns-request from the service service1 in the farm gslbfarm",
"message" : "Sucess, dns-request was removed from the service service1 in the farm gslbfarm"
}
Delete a Service
Delete a Service
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/services/service1
zcli farm-service remove gslbfarm service1
DELETE /farms/<farmname>/services/<id>
Delete a given service of a GSLB Farm. id is the service unique identifier that will be deleted.
Response example:
{
"description" : "Delete service service1 in farm gslbfarm",
"message" : "The service service1 in farm gslbfarm has been deleted.",
"success" : "true",
"status": "needed restart"
}
GSLB - Services - Backends
This section will manage the real service list associated with a service.
List the backends
List the backends
Request example:
curl -k -X GET -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/services/service1/backends
zcli farm get gslbfarm
GET /farms/<farmname>/services/<id>/backends
Get the list of backends in a service. id is the service unique identifier.
Response example:
{
"description" : "List service backends",
"params" : [
{
"alias" : "localhost",
"id" : 1,
"ip" : "127.0.0.1",
"port":53,
"status":"up"
},
{
"alias" : "dns-server",
"id" : 2,
"ip" : "192.168.55.40",
"port":53,
"status":"up"
}
]
}
Response Parameters
This call returns a backend object array with the bellow parameters.
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the backend. Alias |
id | Number | Unique identifier for the backend in the service. This identifier is generated by the system. |
ip | String | IP of the backend, where the real service is listening. |
port | Number | Backend’s port where the real service is listening. |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; undefined, the backend status has been not checked. |
Create a new Backend
Create a new Backend
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.135.10.2"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/services/service1/backends
zcli farm-service-backend add gslbfarm service1 -ip 192.135.10.2
POST /farms/<farmname>/services/<id>/backends
Create a new Backend in a given service in a GSLB Farm. id is the service unique identifier where the backend will be added.
The priority services have 2 backends as maximun, the active host and the passive host.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
ip | String | IP of the backend, where the real service is listening. | true |
Response example:
{
"description" : "New service backend",
"message" : "Added backend to service succesfully",
"params" : {
"id" : 4,
"ip" : "192.135.10.2"
},
"status" : "needed restart"
}
Response parameters
The response will be a json with all requested values updated. See the response example for more information.
Modify a Backend
Modify a Backend
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.2.30"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/services/service1/backends/1
zcli farm-service-backend set gslbfarm service1 1 -ip 192.168.2.30
PUT /farms/<farmname>/services/<id>/backends/<id>
Modify the parameters of a backend for a GSLB service.
Note in the PUT
above that the first id is the service unique identifier and next id is the backend unique identifier.
Request parameters
Field | Type | Description |
---|---|---|
ip | String | IP of the backend, where the real service is listening. |
Response example:
{
"description" : "Modify service backend",
"info" : "There're changes that need to be applied, stop and start farm to apply them!",
"message" : "Backend modified",
"params" : {
"ip" : "192.168.2.30"
},
"status" : "needed restart"
}
Response parameters
The response will be a json with all requested values updated. See the response example for more information.
Delete a backend
Delete a backend
Request example:
curl -k -X DELETE -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/services/service1/backends/3
zcli farm-service-backend remove gslbfarm service1 3
DELETE /farms/<farmname>/services/<servicename>/backends/<id>
Delete a given backend in a GSLB service.
Response example:
{
"description" : "Delete service backend",
"message" : "Backend removed",
"success" : "true"
}
GSLB - Zones
The GSLB zone section will describe the DNS domain name, subdomains, aliases, etc., which will be needed to generate a complete DNS zone with additionally load balancing records using the defined services.
Create zone
Create zone
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"id":"global.com"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/zones
zcli farm-zone add gslbfarm -id global.com
POST /farms/<farmname>/zones
Create a DNS zone.
Request Parameters
This call returns a backend object array with the bellow parameters.
Field | Type | Description | Required |
---|---|---|---|
id | Number | Zone’s name used as the unique indetificator. | true |
Response example:
{
"description" : "New zone global.com",
"params" : {
"id" : "global.com"
}
}
Response parameters
The response will be a json with all requested values updated. See the response example for more information.
Modify a zone
Modify a zone
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"defnamesv":"ns3"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/zones/global.com
zcli farm-zone set gslbfarm global.com -defnamesv ns3
PUT /farms/<farmname>/zones/<id>
Modify the parameters of a zone. id is the zone unique identifier which will be modified.
Request Parameters
This call returns a backend object array with the bellow parameters.
Field | Type | Description |
---|---|---|
defnamesv | String | This will be the entry point root name server that will be available as the Start of Authority (SOA) DNS record. |
Response example:
{
"description" : "Modify zone global.com in farm gslbfarm",
"params" : {
"defnamesv" : "ns3"
}
}
Response parameters
The response will be a json with all requested values updated. See the response example for more information.
Delete a Zone
Delete a Zone
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/zones/dom.com
zcli farm-zone remove gslbfarm dom.com
DELETE /farms/<farmname>/zones/<id>
Delete a given zone of a GSLB Farm.
Response example:
{
"description" : "Delete zone dom.com in farm gslbfarm.",
"message" : "The zone dom.com in farm gslbfarm has been deleted.",
"success" : "true"
}
GSLB - Zones - Resources
Resources defined as the DNS service resolves requests. The possible DNS resources in Zevenet load balances are:
- NS. Name Server type record, it delegates a DNS zone to use the given authoritative name servers.
- A. Address type record, it returns an IPv4 address of a host.
- CNAME. Canonical name type record, it represents an alias of a given name.
- DYNA. Dynamic address type record, it returns a dynamic address specified by a GSLB service already created within the farm configuration according to the algorithm selected for such service.
- AAAA. Address type record, it returns an IPv6 address of a host.
- MX. Mail exchange type record, maps a domain name to a list of message transfer agents for that domain.
- SRV. Service locator type record, Generalized service location record, used for newer protocols instead of creating protocol-specific records such as MX.
- TXT. Text type record, it is used to store any text-based information that can be grabbed when necessary. We most commonly see TXT records used to hold SPF data and verify domain ownership.
- PTR. Pointer record, a pointer to a canonical name. Unlike a CNAME, DNS processing stops and just the name is returned. The most common use is for implementing reverse DNS lookups.
- NAPTR. Naming Authority Pointer, Allows regular-expression-based rewriting of domain names which can then be used as URIs, further domain names to lookups, etc.
List the resources
List the resources
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/zones/global.com/resources
zcli farm-zone-resource list gslbfarm global.com
GET /farms/<farmname>/zones/<id>/resources
Get the list of resources in a zone. id is the zone unique identifier.
Response example:
{
"description" : "List zone resources",
"params" : [
{
"id" : 0,
"rdata" : "ns3",
"rname" : "@",
"ttl" : null,
"type" : "NS"
},
{
"id" : 1,
"rdata" : "192.168.100.155",
"rname" : "ns3",
"ttl" : null,
"type" : "A"
},
{
"id" : 2,
"rdata" : "192.168.0.9",
"rname" : "resource2",
"ttl" : 10,
"type" : "A"
},
{
"id" : 3,
"rdata" : "resource2",
"rname" : "ns2",
"ttl" : null,
"type" : "NS"
}
]
}
Response Parameters
This call returns a resource object array with the bellow parameters.
Field | Type | Description |
---|---|---|
id | Number | Unique identifier for the resource in the zone. |
rname | String | The resource name is the nick that DNS service will translate for the real required data in the field rdata. |
ttl | Number | The Time to Live (optional) value for the current record which it’s needed to determine the length of time that the current name will be cached. |
type | String | DNS record type. The options are: NS, A, AAAA, CNAME, DYNA, MX, SRV, TXT, PTR or NAPTR). For more information, look at in GSLB - Zones - Resources section. |
rdata | String | It’s the real data needed by the record type, input value depends on the kind of Resource Name, rname and the resource type, type. |
Create a new resource
Create a new resource
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"rname":"resource2", "rdata":"192.168.0.9", "ttl":10, "type":"A" }'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/zones/global.com/resources
zcli farm-zone-resource add gslbfarm global.com -rname resource2 -rdata 192.168.0.9 -ttl 10 -type A
POST /farms/<farmname>/zones/<id>/resources
Create a new resource in a given zone in a GSLB Farm. id is the zone unique identifier which will be modified where the resource will be added.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
rname | String | The resource name is the nick that DNS service will translate for the real required data in the field rdata. | true |
ttl | Number | The Time to Live value for the current record. It is the maximun number of router devices that the request can through til die. It’s useful is that the packet not input in a net loop. | |
type | String | DNS record type. The options are: NS, A, AAAA, CNAME, DYNA, MX, SRV, TXT, PTR or NAPTR). For more information, look at in GSLB - Zones - Resources section. | true |
rdata | String | It’s the real data needed by the record type, input value depends on the kind of Resource Name, rname and the resource type, type. If DYNA is selected in type then the rdata value has to be one of the configured services in this zone. | true |
Response example:
{
"description" : "New zone resource",
"message" : "Resource added",
"params" : {
"rdata" : "192.168.0.9",
"rname" : "resource2",
"ttl" : 10,
"type" : "A",
"zone" : "global.com"
}
}
Response parameters
The response will be a json with all requested values updated. See the response example for more information.
Modify a resource
Modify a resource
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"rname":"resource2", "rdata":"192.168.200.30","ttl":null, "type":"A" }'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/zones/global.com/resources/1
zcli farm-zone-resource set gslbfarm global.com 1 -rname resource2 -rdata 192.168.200.30 -type A
PUT /farms/<farmname>/zones/<id>/resources/<id>
Modify the parameters of a resouce in a zone of a GSLB Farm.
First id is the zone unique identifier, next id is the resource unique identifier.
Request parameters
Field | Type | Description |
---|---|---|
rname | String | The resource name is the nick that DNS service will translate for the real required data in the field rdata. |
ttl | Number | The Time to Live (optional) value for the current record which it’s needed to determine the length of time that the current name will be cached. |
type | String | DNS record type. The options are: NS, A, AAAA, CNAME, DYNA, MX, SRV, TXT, PTR or NAPTR). For more information, look at in GSLB - Zones - Resources section. |
rdata | String | It’s the real data needed by the record type, input value depends on the kind of Resource Name, rname and the resource type, type. If type is loaded with value DYNA then rdata has to be loaded with an available service name |
Response example:
{
"description" : "Modify zone resource",
"message" : "Resource modified",
"params" : {
"rdata" : "192.168.200.30",
"rname" : "resource2",
"ttl" : null,
"type" : "A"
},
"success" : "true"
}
Response parameters
The response will be a json with all requested values updated. See the response example for more information.
Delete a resource
Delete a resource
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/gslbfarm/zones/global.com/resources/3
zcli farm-zone-resource remove gslbfarm global.com 3
DELETE /farms/<farmname>/zones/<id>/resources/<id>
Delete a given resouce in a zone of a GSLB Farm
Note that in DELETE
URI above the first id is the zone unique identifier and next id is the resource unique identifier.
Response example:
{
"description" : "Delete zone resource",
"message" : "Resource removed",
"success" : "true"
}
Datalink Farms
The datalink farm profile or DSLB (Datalink Service Load Balancing) allows creating a routes based farm where the backends are uplink routers or gateways. This kind of farm profile is ready to share several uplink WAN router accesses using the load balancer as an uplink channel multiplexor (1 input and several router line outputs). Therefore, the datalink farms could be used as high available communication links and additionally could be used as bandwidth increase joining the amount of bandwidth between the routers backends links.
Retrieve farm by name
Retrieve farm by name
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/dlink
zcli farm get dlink
GET /farms/<farmname>
Show all configuration about a farm.
Response example:
{
"backends" : [
{
"alias" : "main-gateway",
"id" : 0,
"interface" : "eth0",
"ip" : "192.168.100.10",
"priority" : 2,
"status" : "undefined",
"weight" : 2
},
{
"alias" : "secondary-gateway",
"id" : 1,
"interface" : "eth0",
"ip" : "192.168.100.11",
"priority" : 2,
"status" : "undefined",
"weight" : 1
}
],
"description" : "List farm dlink",
"ipds" : {
"blacklists" : []
},
"params" : {
"algorithm" : "weight",
"status" : "down",
"vip" : "192.168.100.199"
}
}
Response parameters
The response will be a JSON object with the format below.
Farm Object:
Field | Type | Description |
---|---|---|
ipds | Object | List of IPDS rules applied to this farm. |
params | Object | Parameters of farm configuration. |
backends | Object[] | Real servers created in this farm and its configuration. |
IPDS Object:
Field | Type | Description |
---|---|---|
blacklists | String[] | Blacklists applied to the farm. |
Parameters object for datalink farms:
Field | Type | Description |
---|---|---|
algorithm | String | Type of load balancing algorithm used in the Farm. The options are: weight, the balancer distributes among all available backends given more charge backends with higher weight attribute or prio, which sends all connections to the backend with the minor value of priority. |
status | String | Farm status. The available status values are: down, the farm is not running; needed restart, the farm is up but it is pending of a restart action; critical, the farm is up and all backends are unreachable; problem, the farm is up and there are some backend unreachable, but almost a backend is in up status; up, the farm is up and all the backends are working success. |
vip | String | IP of the farm, where the virtual service is listening. |
Backend object for datalink farms:
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the backend. Alias |
id | Number | Unique identifier for the backend of the farm. |
ip | String | IP of the backend, where the real service is listening. |
interface | String | It’s the local network interface where the backend is connected to. |
priority | Number | It’s the priority value for the current real server. It will be used when algorithm field is configured as a priority and lower priority will have preference |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; undefined, the backend status has been not checked. |
weight | Number | It’s the weight value for the current real server. It will be used when algorithm field is configured as weight. |
Create a new Farm
Create a new Farm
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"farmname":"dlink", "vip":"192.168.100.241", "profile":"datalink" }'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms
zcli farm create -profile datalink -farmname dlink -vip 192.168.100.241
POST /farms
Create a new datalink farm.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
farmname | String | Farm name, unique identifier. | true |
profile | String | The profile of the created Farm. For creating a farm of type datalink, the key is datalink | true |
vip | String | IP of the farm, where the virtual service is listening. | true |
copy_from (from 4.0.1) | String | This parameter expects the name of a farm that exists. If this parameter is sent, the farm is copied from the farm specified in it. The farmname and vip values will be overwritten. |
Response example:
{
"description" : "Creating farm 'dlink'",
"params" : {
"farmname" : "dlink",
"interface" : "eth0",
"profile" : "datalink",
"vip" : "192.168.100.241"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Modify a Farm
Modify a Farm
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"newfarmname":"dlink2", "vip":"192.168.100.199","algorithm":"weight"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/dlink
zcli farm set dlink -newfarmname dlink2 -vip 192.168.100.199 -algorithm weight
PUT /farms/<farmname>
Modify the configuration of a datalink farm.
Request parameters
Field | Type | Description |
---|---|---|
newfarmname | String | The new farm name. The farm must be stopped to modify this field. |
algorithm | String | Type of load balancing algorithm used in the Farm. The options are: weight, the balancer distributes among all available backends given more charge backends with higher weight attribute or prio, which sends all connections to the backend with the minor value of priority. |
vip | String | IP of the farm, where the virtual service is listening. |
Response example:
{
"description" : "Modify farm dlink",
"params" : {
"algorithm" : "weight",
"vip" : "192.168.100.199",
"newfarmname" : "dlink2"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Add an IPDS rule
Add an IPDS rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"name":"china"}' https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/dlink2/ipds/blacklists
zcli farm-blacklist add dlink2 -name china
POST /farms/<farmname>/ipds/<blacklists>
Apply a blacklist rule to the farm. A datalink profile accepts only blacklist rules.
Request parameters
Field | Type | Description |
---|---|---|
name | String | IPDS rule name used as a unique identifier. |
Response example:
{
"description" : "Apply a rule to a farm",
"message" : "Blacklist rule china was applied successful to the farm dlink2.",
"success" : "true"
}
Remove an IPDS rule
Remove an IPDS rule
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/dlink2/ipds/blacklists/china
zcli farm-blacklist remove dlink -name china
DELETE /farms/<farmname>/ipds/<blacklists>/<name>
Remove a blacklist rule of the IPDS module from a given farm using its indicator name.
Response example:
{
"description" : "Delete a rule from a farm",
"message" : "Blacklist rule china was removed successful from the farm dlink2.",
"success" : "true"
}
Datalink - Backends
Backends in datalink farms are the gateways through routing the service. The service will multiplexor among these gateways and some of them are not available, the service uses the other(s).
List the backends
List the backends
Request example:
curl -k -X GET -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/dlink/backends
zcli farm get dlink
GET /farms/<farmname>/backends
Get the list of backends in a service.
Response example:
[
{
"alias" : "main-gateway",
"id" : 6,
"interface" : "eth0",
"ip" : "192.168.100.10",
"priority" : 2,
"status" : "undefined",
"weight" : 2
},
{
"alias" : "secondary-gateway",
"id" : 7,
"interface" : "eth0",
"ip" : "192.168.100.11",
"priority" : 2,
"status" : "undefined",
"weight" : 1
}
]
Response Parameters
This call returns a backend object array with the bellow parameters.
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the backend. Alias |
id | Number | Unique identifier for the backend in the farm. This identifier is generated by the system. |
interface | String | It’s the local network interface where the backend is connected to. |
ip | String | IP of the backend, where the real service is listening. |
priority | Number | It’s the priority value for the current backend. It will be used when algorithm field is configured as a priority and lower priority will have a preference. |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; undefined, the backend status has been not checked. |
weight | Number | It’s the weight value for the current backend. It will be used when algorithm field is configured as weight. |
Create a new Backend
Create a new Backend
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.100.10","interface":"eth0","priority":2,"weight":2}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/dlink/backends
zcli farm-service-backend add dlink default_service -ip 192.168.100.10 -interface eth0 -priority 2 -weight 2
POST /farms/<farmname>/backends
Create a new Backend in a given datalink Farm.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
ip | String | IP of the backend, where the real service is listening. | true |
interface | String | It’s the local network interface where the backend is connected to. | true |
priority | Number | It’s the priority value for the current real server. It will be used when algorithm field is configured as a priority and lower priority will have a preference. The default value is 1. | |
weight | Number | It’s the weight value for the current backend. It will be used when algorithm field is configured as weight. The default value is 1. |
Response example:
{
"description" : "New farm backend",
"message" : "Backend added",
"params" : {
"id" : 6,
"interface" : "eth0",
"ip" : "192.168.100.10",
"priority" : 2,
"weight" : 2
}
}
Response parameters
The response will be a json with all requested values updated. See response example for more information.
Modify a Backend
Modify a Backend
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.102.50","interface":"eth0", "weight":1,"priority":1}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/datalink/backends/2
zcli farm-service-backend set datalink default_service 2 -ip 192.168.102.50 -interface eth0 -weight 1 -priority 1
PUT /farms/<farmname>/backends/<id>
Modify the parameters of a backend in a service of a datalink Farm. id is the backend unique identifier.
Request parameters
Field | Type | Description |
---|---|---|
ip | String | IP of the backend, where the real service is listening. |
interface | String | It’s the local network interface where the backend is connected to. |
priority | Number | It’s the backend priority to respond to a certain request. |
weight | Number | It’s the weight value for the current backend. |
Response example:
{
"description" : "Modify backend",
"message" : "Backend modified",
"params" : {
"interface" : "eth0",
"ip" : "192.168.102.50",
"priority" : 1,
"weight" : 1
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Delete a backend
Delete a backend
Request example:
curl -k -X DELETE -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/farms/dlink/backends/4
zcli farm-service-backend remove dlink default_service 4
DELETE /farms/<farmname>/backends/<id>
Delete a given backend from a datalink Farm. id is the backend unique identifier.
Response example:
{
"description" : "Delete backend",
"message" : "Backend removed",
"success" : "true"
}
Network
Zevenet can work with different types of network interfaces.
In this section, you can list, create, configure, delete and set an action in NIC, VLAN, virtual and bonding interfaces.
nic: or network interface card, it is a computer hardware component. The rest of the interfaces are based on NICs.
vlan: or virtual LAN card is a kind of network interface that provides network segmentation services. More than one VLAN can be created through a nic interface.
bonding: Also called by other vendors as trunk interfaces, this kind of nic can be created with more than one nic interface. Zevenet supports 7 different types of bonding interfaces.
virtual: This kind of interface can be created over any kind of interface described above and they use the routing tables of its parent interface, so it has to have configured in the same network segment than its parent. This kind of interface should be used for Farms.
List all interfaces
List all interfaces
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/nic
zcli network list
GET /interfaces
Get a list of interfaces in the system with their configuration.
Response example:
{
"description" : "List interfaces",
"interfaces" : [
{
"alias" : null,
"gateway" : "",
"ip" : "",
"mac" : "66:eb:31:0e:07:71",
"name" : "bond2",
"netmask" : "",
"status" : "down",
"dhcp" : "false",
"type" : "bond"
},
{
"alias" : null,
"gateway" : "192.168.100.1",
"ip" : "192.168.100.121",
"mac" : "a2:6d:80:29:87:c6",
"name" : "bondiface",
"netmask" : "255.255.255.0",
"status" : "up",
"dhcp" : "false",
"type" : "bond"
},
{
"alias" : null,
"gateway" : "192.168.100.5",
"has_vlan" : "true",
"ip" : "192.168.100.241",
"mac" : "c2:56:f6:54:ff:a0",
"name" : "eth0",
"netmask" : "255.255.255.0",
"status" : "up",
"dhcp" : "false",
"type" : "nic",
"is_slave" : "false"
},
{
"alias" : null,
"gateway" : "192.168.120.1",
"ip" : "192.168.120.120",
"mac" : "c2:56:f6:54:ff:a0",
"name" : "eth0.1",
"netmask" : "255.255.255.0",
"status" : "down",
"dhcp" : "false",
"type" : "vlan"
},
{
"alias" : null,
"gateway" : "",
"ip" : "192.168.100.155",
"mac" : "c2:56:f6:54:ff:a0",
"name" : "eth0:virt",
"netmask" : "255.255.255.0",
"status" : "up",
"type" : "virtual"
},
{
"alias" : "gestion",
"gateway" : "192.168.100.5",
"has_vlan" : "false",
"ip" : "192.168.100.102",
"mac" : "62:30:43:36:29:ac",
"name" : "eth1",
"netmask" : "255.255.255.0",
"status" : "up",
"dhcp" : "false",
"type" : "nic",
"is_slave" : "false"
},
{
"alias" : null,
"gateway" : "",
"has_vlan" : "false",
"ip" : "",
"mac" : "66:eb:31:0e:07:71",
"name" : "eth2",
"netmask" : "",
"status" : "up",
"dhcp" : "false",
"type" : "nic",
"is_slave" : "true"
},
{
"alias" : null,
"gateway" : "",
"has_vlan" : "false",
"ip" : "",
"mac" : "a2:6d:80:29:87:c6",
"name" : "eth3",
"netmask" : "",
"status" : "up",
"type" : "nic",
"dhcp" : "false",
"is_slave" : "true"
}
]
}
Response parameters
The response will be a JSON object with an interface object array.
Interface object:
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the interface. Alias |
ip | String | IP of the interface. IP must be in the same network segment that its parent interface in a virtual interface. |
has_vlan | String | true, the interface it is the parent of a VLAN interface; or false, the interface has not got any VLAN interface appending of it. This field is only for NIC interfaces. |
netmask | String | Netmask of the interface. This value could not be modified in virtual interfaces, it is inherited from parent interface. |
gateway | String | Gateway of the interface. This value could not be modified in virtual interfaces, it is inherited from parent interface. |
mac | String | MAC of the interface. This value is inherited from the first NIC slave in bonding interfaces. In virtual and VLAN interfaces it is inherited from parent interface. |
name | String | Interface’s name. It is used as a unique identifier. |
status | String | The values can be up, the interface can receive packets; down, the interface cannot receive packets. |
type | String | The different kind of interfaces are: nic, vlan, virtual or bond. |
is_slave | String | Only available in NIC interfaces, true, the interface is part of a bonding interface, false the interface is not part of a bonding interface. |
dhcp | String | Enables the DHCP service to get the network configuration for the interface from a DHCP server. This parameter accepts: true, to enable the service, the interface configuration will be blocked while the DHCP service is enabled; false to stop the service, the interface will lose all its network configuration. |
Retrieve default gateway
Retrieve default gateway
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/gateway/ipv4
zcli network-default-gateway-ipv4 get
GET /interfaces/gateway/<ip_version>
The default gateway is the node which to sending all destination traffic that does not reachable locally from any interface in the load balancer.
Get the parameters of the default gateway interface.
The system has configured two gateways, once to route IPv4 and another to route IPv6. The URI expects an IP version ipv4 or ipv6.
Response example:
{
"description" : "Default gateway",
"params" : {
"address" : "192.168.100.5",
"interface" : "eth0"
}
}
Response parameters
Field | Type | Description |
---|---|---|
address | String | It is the IP of the gateway. |
interface | String | Interface name for the gateway. |
Modify the default gateway
Modify default gateway
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"interface":"eth0","address":"192.168.100.5"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/gateway/ipv4
zcli network-default-gateway-ipv4 set -interface eth0 -address 192.168.100.5
PUT /interfaces/gateway/<ip_version>
Modify the configuration of the gateway interface.
The URI expects the IP version used in the address field. The possible values are ipv4 and ipv6.
Response example:
{
"description" : "Modify default gateway",
"message" : "The default gateway has been changed successfully",
"success" : "true"
}
Request parameters
Field | Type | Description |
---|---|---|
address | String | It is the IP of the gateway. |
interface | String | Interface name for the gateway. |
Delete gateway configuration
DELETE /interfaces/gateway/<ip_version>
Delete the configuration of the default gateway configuration.
The URI expects one IP version of the default gateway to delete. The possible values are ipv4 and ipv6.
Warning: if the gateway is unset, Zevenet is not going to be reachable from an external network segment.
Delete gateway configuration
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/gateway/ipv4
zcli network-default-gateway-ipv4 delete
Response message
If the gateway is unset from the same network segment, this message will appear, else the connection will lose.
Response example:
{
"description" : "Remove default gateway",
"message" : "The default gateway has been deleted successfully",
"params" : {
"address" : null,
"interface" : null
}
}
Network - NIC interfaces
NIC interfaces are the physical interfaces connected to your Zevenet load balancer.
The system recognizes new interfaces automatically once they are connected.
Using NIC interfaces as parents, other types of interfaces with different characteristics can be created. Available interfaces are VLAN, virtual and bonding.
List NIC interfaces
GET /interfaces/nic
Get all the parameters of the NIC interfaces.
List NIC interfaces
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/nic
zcli network-nic list
Response example:
{
"description" : "List NIC interfaces",
"interfaces" : [
{
"alias" : null,
"gateway" : "192.168.100.5",
"has_vlan" : "true",
"ip" : "192.168.100.241",
"is_slave" : "false",
"mac" : "c2:56:f6:54:ff:a0",
"name" : "eth0",
"netmask" : "255.255.255.0",
"dhcp" : "false",
"status" : "up"
},
{
"alias" : "gestion",
"gateway" : "192.168.100.5",
"has_vlan" : "false",
"ip" : "192.168.100.102",
"is_slave" : "false",
"mac" : "62:30:43:36:29:ac",
"name" : "eth1",
"netmask" : "255.255.255.0",
"dhcp" : "false",
"status" : "up"
},
{
"alias" : null,
"gateway" : "",
"has_vlan" : "false",
"ip" : "",
"is_slave" : "false",
"mac" : "a2:6d:80:29:87:c6",
"name" : "eth3",
"netmask" : "",
"dhcp" : "false",
"status" : "down"
}
]
}
Response parameters
The response will be a JSON object with an array of NIC interface objects.
NIC interface object:
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the interface. Alias |
ip | String | IP of the interface. |
has_vlan | String | true, the interface it is the parent of a VLAN interface; or false, the interface has not got any VLAN interface appending of it. |
netmask | String | Define the network segment where the interface is working. |
gateway | String | IP used to send packets to a different network segment. |
mac | String | Link layer unique identifier. It is unmodifiable. |
name | String | Interface’s name. It is used as an interface unique identifier. |
status | String | The values can be up, the interface can receive packets; down, the interface cannot receive packets. |
is_slave | String | true the interface is part of a bonding interface, false the interface is not part of a bonding interface. |
dhcp | String | Enables the DHCP service to get the network configuration for the interface from a DHCP server. This parameter accepts: true, to enable the service, the interface configuration will be blocked while the DHCP service is enabled; false to stop the service, the interface will lose all its network configuration. |
Retrieve NIC interface
Retrieve NIC interface
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/nic/eth1
zcli network-nic get eth1
GET /interfaces/nic/<name>
Get all the parameters of a NIC interface. name is the interface unique identifier.
Response example:
{
"description" : "Show NIC interface",
"interface" : {
"alias" : "gestion",
"gateway" : "192.168.100.5",
"ip" : "192.168.100.102",
"is_slave" : "false",
"mac" : "62:30:43:36:29:ac",
"name" : "eth1",
"netmask" : "255.255.255.0",
"dhcp" : "false",
"status" : "up"
}
}
Response parameters
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the interface. Alias |
ip | String | IP of the interface. |
netmask | String | Define the network segment where the interface is working. |
gateway | String | IP used to send packets to a different network segment. |
mac | String | Link layer unique identifier. It is unmodifiable. |
name | String | Interface’s name. It is used as an interface unique identifier. |
status | String | The values can be up, the interface can receive packets; down, the interface cannot receive packets. |
type | String | The different kind of interfaces is: nic, vlan, virtual or bond. Each one is defined in their network submenu. |
is_slave | String | true the interface is part of a bonding interface, false the interface is not part of a bonding interface. |
dhcp | String | Enables the DHCP service to get the network configuration for the interface from a DHCP server. This parameter accepts: true, to enable the service, the interface configuration will be blocked while the DHCP service is enabled; false to stop the service, the interface will lose all its network configuration. |
Modify NIC interface
Modify NIC interface
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.100.102","netmask":"255.255.255.0","gateway":"192.168.100.5"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/nic/eth1
zcli network-nic set eth0 -ip 192.168.100.102 -netmask 255.255.255.0 -gateway 192.168.100.5
PUT /interfaces/nic/<name>
Modify the parameters of a NIC interface. name is the interface unique identifier.
Request parameters
Field | Type | Description |
---|---|---|
ip | String | IP of the interface. |
netmask | String | Define the network segment where the interface is working. |
gateway | String | IP used to send packets of a different network segment. |
force | String | If a farm is using the interface, the interface won’t be able to be modified. Then, if this parameter is sent with the value true, the interface will be forced to take the new configuration and all farms are using the interface will be restarted. |
dhcp | String | Enables the DHCP service to get the network configuration for the interface from a DHCP server. This parameter accepts: true, to enable the service, the interface configuration will be blocked while the DHCP service is enabled; false to stop the service, the interface will lose all its network configuration. |
Response example:
{
"description" : "Configure NIC interface",
"params" : {
"alias" : null,
"dhcp" : "false",
"gateway" : "192.168.100.5",
"ip" : "192.168.100.102",
"is_slave" : "false",
"mac" : "4a:4f:3c:d7:dd:70",
"name" : "eth1",
"netmask" : "255.255.255.0",
"status" : "down"
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Delete NIC configuration
Delete NIC configuration
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/nic/eth3
zcli network-nic unset eth3
DELETE /interfaces/nic/<name>
Delete the configuration for a NIC interface. After this action, the interface will be useless, and ready to be configured again. name is the interface unique identifier.
Response example:
{
"description" : "Delete nic interface",
"message" : "The configuration for the network interface eth3 has been deleted.",
"success" : "true"
}
Set NIC interface action
Set NIC interface action
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"action":"down"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/nic/eth1/actions
zcli network-nic stop eth1
POST /interfaces/nic/<name>/actions
Apply an action to a NIC interface. This call lets enable or disable a network interface.
name is the interface unique identifier.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
action | String | Action to apply to the interface. The available values are: up, enable the interface and prepare it for being used; down, disable the interface to not receive or not send packets. | true |
Response example:
{
"description" : "Action on nic interface",
"params" : {
"action" : "up"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Network - VLAN interfaces
VLAN interface lets a NIC or bonding interface works in another network, so the networking configuration (IP, gateway, and netmask) has to be in a different network segment. VLAN interface inherits the MAC address from its parent interface.
The VLAN interfaces field name will appear with a dot “.” character that will be used to establish an identifier tag for the VLAN interface.
List VLAN interfaces
List VLAN interfaces
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/vlan
zcli network-vlan list
GET /interfaces/vlan
Get all parameters of VLAN interfaces.
Response example:
{
"description" : "List VLAN interfaces",
"interfaces" : [
{
"alias" : null,
"gateway" : "192.168.120.1",
"ip" : "192.168.120.120",
"mac" : "c2:56:f6:54:ff:a0",
"name" : "eth0.1",
"netmask" : "255.255.255.0",
"parent" : "eth0",
"dhcp" : "false",
"status" : "down"
}
]
}
Response parameters
The response will be a JSON object with a VLAN interface object array.
The VLAN parameters are:
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the interface. Alias |
ip | String | IP of the interface. It can be different from the parent interface IP. |
netmask | String | Define the network segment where the interface is working. |
gateway | String | IP used to send packets of a different network segment. |
mac | String | MAC of the interface. This value is inherited from the parent interface. |
name | String | Interface’s name. It is used as a unique identifier. This name is a chain formatted by a parent interface name, a dot character “.” and a number for the VLAN network interface or VLAN tag. |
parent | String | It is the Interface used to create this one. |
status | String | The values can be up the interface can receive packets, down the interface cannot receive packets. |
dhcp | String | Enables the DHCP service to get the network configuration for the interface from a DHCP server. This parameter accepts: true, to enable the service, the interface configuration will be blocked while the DHCP service is enabled; false to stop the service, the interface will lose all its network configuration. |
Retrieve VLAN interface
Retrieve VLAN interface
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/vlan/eth0.1
zcli network-vlan get eth0.1
GET /interfaces/vlan/<name>
Get all the parameters of the VLAN interface. name is the interface unique identifier.
Response example:
{
"description" : "Show VLAN interface",
"interface" : {
"alias" : null,
"gateway" : "192.168.131.1",
"ip" : "192.168.131.155",
"mac" : "c2:56:f6:54:ff:a0",
"name" : "eth0.1",
"netmask" : "255.255.255.0",
"dhcp" : "false",
"status" : "up"
}
}
Response parameters
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the interface. Alias |
ip | String | IP of the interface. |
netmask | String | Define the network segment where the interface is working. |
gateway | String | IP used to send packets of a different network segment. |
mac | String | MAC of the interface. This value is inherited from the parent interface. |
name | String | Interface’s name. It is used as a unique identifier. This name is a chain formatted by a parent interface name, a dot character “.” and a number for the VLAN network interface. |
status | String | The values can be up the interface can receive packets, down the interface cannot receive packets. |
dhcp | String | Enables the DHCP service to get the network configuration for the interface from a DHCP server. This parameter accepts: true, to enable the service, the interface configuration will be blocked while the DHCP service is enabled; false to stop the service, the interface will lose all its network configuration. |
Create a VLAN interface
Create VLAN interface
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.120.120","netmask":"255.255.255.0","gateway":"192.168.120.1","name":"eth0.1","mac":"52:98:19:6a:c9:18","dhcp":"false"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/vlan
zcli network-vlan create -name eth0.1 -ip 192.168.120.120 -netmask 255.255.255.0 -gateway 192.168.120.1 -mac 52:98:19:61:c9:18 -dhcp false
POST /interfaces/vlan
Create a VLAN interface from a NIC or bonding interface. The new VLAN interface will share MAC, although the following network parameters must be different: ip, and the following can change: gateway, netmask.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
ip | String | IP of the interface. It must be different from the parent interface IP. | true |
netmask | String | Define the network segment where the interface is working. | true |
gateway | String | IP used to send packets of a different network segment. | true |
name | String | Interface’s name. It is used as a unique identifier. This name is a chain formatted by a parent interface name, a dot character “.” and a number for the VLAN network interface. | true |
dhcp | String | Enables the DHCP service to get the network configuration for the interface from a DHCP server. This parameter accepts: true, to enable the service, the interface configuration will be blocked while the DHCP service is enabled; false to stop the service, the interface will lose all its network configuration. | |
mac | String | Rewrites the MAC of the interface. |
Response example:
{
"description" : "Add a vlan interface",
"params" : {
"gateway" : "192.168.120.1",
"ip" : "192.168.120.120",
"mac" : "52:98:19:6a:c9:18",
"name" : "eth0.1",
"dhcp" : "false",
"netmask" : "255.255.255.0"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Modify VLAN interface
Modify VLAN interface
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.131.155","netmask":"255.255.255.0","gateway":"192.168.131.1","mac":"96:23:25:8b:d4:af"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/vlan/eth0.1
zcli network-vlan set eth0.1 -ip 192.168.131.151 -netmask 255.255.255.0 -gateway 192.168.131.1 -mac 96:23:25:8b:d4:af
PUT /interfaces/vlan/<name>
Modify the parameters of a VLAN interface. name is the interface unique identifier.
Request parameters
Field | Type | Description |
---|---|---|
ip | String | IP of the interface. It can be different from the parent interface IP. |
netmask | String | Define the network segment where the interface is working. |
gateway | String | IP used to send packets of a different network segment. |
dhcp | String | Enables the DHCP service to get the network configuration for the interface from a DHCP server. This parameter accepts: true, to enable the service, the interface configuration will be blocked while the DHCP service is enabled; false to stop the service, the interface will lose all its network configuration. |
mac | String | Rewrites the MAC of the interface. |
force | String | If a farm is using the interface, the interface won’t be able to be modified. Then, if this parameter is sent with the value true, the interface will be forced to take the new configuration and all farms are using the interface will be restarted. |
Response example:
{
"description" : "Modify VLAN interface",
"params" : {
"gateway" : "192.168.131.1",
"ip" : "192.168.131.155",
"netmask" : "255.255.255.0",
"mac" : "96:23:25:8b:d4:af",
"dhcp" : "false",
"force" : "true"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Delete VLAN interface
Delete VLAN interface
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/vlan/eth0.1
zcli network-vlan delete eth0.1
DELETE /interfaces/vlan/<name>
Delete a VLAN interface. name is the interface unique identifier.
Response example:
{
"description" : "Delete VLAN interface",
"message" : "The VLAN interface eth0.1 has been deleted.",
"success" : "true"
}
Set VLAN interface action
Set VLAN interface action
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"action":"down"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/vlan/eth0.1/actions
zcli network-vlan stop eth0.1
POST /interfaces/vlan/<name>/actions
Apply an action to a VLAN interface. This call lets enable or disable a network interface.
name is the name unique identifier.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
action | String | Action to apply to the interface. The available values are: up, enable the interface and prepare it for being used; down, disable the interface to not receive or not send packets. | true |
Response example:
{
"description" : "Action on vlan interface",
"params" : {
"action" : "down"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Network - Virtual interfaces
Network interfaces let users set another network interface in the same networking segment than their parents, so virtual interfaces always inherit the network configuration from its parent. The different parameter will be the ip. The virtual interface can be created from NIC, bonding or VLAN. Creating a new virtual interface will appear a field with a colon “:” character that will be used to establish an identity for the virtual interface.
List Virtual interfaces
List Virtual interfaces
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/virtual
zcli network-virtual list
GET /interfaces/virtual
Get all the parameters of virtual interfaces.
Response example:
{
"description" : "List virtual interfaces",
"interfaces" : [
{
"alias" : null,
"gateway" : "",
"ip" : "192.168.100.155",
"mac" : "c2:56:f6:54:ff:a0",
"name" : "eth0:virt",
"netmask" : "255.255.255.0",
"parent" : "eth0",
"status" : "up"
},
{
"alias" : null,
"gateway" : "192.168.100.5",
"ip" : "192.168.100.41",
"mac" : "c2:56:f6:54:ff:a0",
"name" : "eth0:virtiface",
"netmask" : "255.255.255.0",
"parent" : "eth0",
"status" : "down"
}
]
}
Response parameters
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the interface. Alias |
ip | String | IP of the interface. The IP must be in the same network segment that the parent interface. |
netmask | String | Define the network segment where the interface is working. It inherits from the parent interface. |
gateway | String | IP used to send packets of a different network segment. It inherits from the parent interface. |
mac | String | MAC of the interface. It inherits from the parent interface. |
name | String | Interface’s name. It is used as a unique identifier. This name is a chain formatted by a parent interface, a colon character “:” and the name for the virtual network interface, alphanumeric characters are allowed. |
parent | String | It is the Interface used to create this one. |
status | String | The values can be up, the interface can receive packets; down, the interface cannot receive packets. |
Retrieve virtual interface
Retrieve virtual interface
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/virtual/eth0:virtiface
zcli network-virtual get eth0:vip1
GET /interfaces/virtual/<name>
Get all parameters of a virtual interface. name is the interface unique identifier.
Response example:
{
"description" : "Show virtual interface",
"interface" : {
"alias" : null,
"gateway" : "192.168.100.5",
"ip" : "192.168.100.41",
"mac" : "c2:56:f6:54:ff:a0",
"name" : "eth0:virtiface",
"netmask" : "255.255.255.0",
"status" : "down"
}
}
Response parameters
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the interface. Alias |
ip | String | IP of the interface. The IP must be in the same network segment that the parent interface. |
netmask | String | Define the network segment where the interface is working. It inherits from the parent interface. |
gateway | String | IP used to send packets of a different network segment. It inherits from the parent interface. |
mac | String | MAC of the interface. It inherits from the parent interface. |
name | String | Interface’s name. It is used as a unique identifier. This name is a chain formatted by a parent interface, a colon character “:” and an alphanumeric string for the virtual network interface. |
parent | String | It is the Interface used to create this one. |
status | String | The values can be up, the interface can receive packets; down, the interface cannot receive packets. |
Create a virtual interface
Create virtual interface
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.100.41", "name":"eth0:virtiface"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/virtual
zcli network-virtual create -name eth0:virtiface -ip 192.168.100.41
POST /interfaces/virtual
Create a virtual interface.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
ip | String | IP of the interface. The IP must be in the same network segment that the parent interface. | true |
name | String | Interface’s name. It is used as a unique identifier. This name is a chain formatted by a parent interface, a colon character “:” and an alphanumeric string for the virtual network interface. | true |
Response example:
{
"description" : "Add a virtual interface",
"params" : {
"gateway" : "192.168.100.5",
"ip" : "192.168.100.41",
"mac" : "c2:56:f6:54:ff:a0",
"name" : "eth0:virtiface",
"netmask" : "255.255.255.0"
}
}
Response parameters
The response will be a JSON with the interface configuration. See the response example for more information.
Field | Type | Description |
---|---|---|
ip | String | IP of the interface. The IP must be in the same network segment that the parent interface. |
netmask | String | Define the network segment where the interface is working. It inherits from the parent interface. |
gateway | String | IP used to send packets to a different network segment. It inherits from the parent interface. |
mac | String | MAC of the interface. It inherits from the parent interface. |
name | String | Interface’s name. It is used as a unique identifier. This name is a chain formatted by a parent interface, a colon character “:” and an alphanumeric string for the virtual network interface. |
Modify virtual interface
Modify virtual interface
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.131.155"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/virtual/eth0:virtiface
zcli network-virtual set eth0:virtiface -ip 192.168.131.155
PUT /interfaces/virtual/<name>
Modify the parameters of a virtual interface. name is the interface unique identifier.
Request parameters
Field | Type | Description | required |
---|---|---|---|
ip | String | IP of the interface. The IP must be in the same network segment that the parent interface. | true |
force | String | If a farm is using the interface, the interface won’t be able to be modified. Then, if this parameter is sent with the value true, the interface will be forced to take the new configuration and all farms are using the interface will be restarted. |
Response example:
{
"description" : "Modify virtual interface",
"params" : {
"ip" : "192.168.100.10",
"force" : "true"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Delete virtual interface
Delete virtual interface
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/virtual/eth0:virtiface
zcli network-virtual delete eth0:virtiface
DELETE /interfaces/virtual/<name>
Delete a virtual interfaces. name is the interface unique identifier.
Response example:
{
"description" : "Delete virtual interface",
"message" : "The virtual interface eth0:virtiface has been deleted.",
"success" : "true"
}
Set Virtual interface action
Set Virtual interface action
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"action":"down"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/virtual/eth0:virtiface/actions
zcli network-virtual stop eth0:virtiface
POST /interfaces/virtual/<name>/actions
Apply an action to a virtual interface. This call lets enable or disable a network interface.
name is the interface unique identifier.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
action | String | Action to apply to the interface. The available values are: up, enable the interface and prepare it for being used; down, disable the interface to not receive or not send packets. | true |
Response example:
{
"description" : "Action on virtual interface",
"params" : {
"action" : "down"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Network - Bonding interfaces
The Linux bonding interface or also called by other vendors as Trunk provides a method for aggregating multiple network interfaces into a single logical “bonded” interface. The behavior of the bonded interfaces depends upon the mode, Zevenet Load Balancer supports the following methods:
Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.
Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond’s MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of it.
XOR policy: Transmit based on source MAC address XOR’d with destination MAC address. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.
Broadcast policy: Transmits everything on all slave interfaces. This mode provides fault tolerance.
IEEE 802.3ad LACP: Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.
Pre-requisites:
Network interface support in the base drivers for retrieving the speed and duplex of each slave.
A switch that supports IEEE 802.3ad Dynamic link aggregation. Most switches will require some type of configuration to enable 802.3ad mode.
Adaptive transmit load balancing: Channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.
Pre-requisite:
Base driver support for retrieving the speed of each slave.
Adaptive load balancing: Includes Adaptive transmit load balancing plus receive load balancing for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bonding such that different peers use different hardware addresses for the server.
List Bonding interfaces
List Bonding interfaces
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/bonding
zcli network-bonding list
GET /interfaces/bonding
Get configuration about all bonding interfaces in the system.
Response example:
{
"description" : "List bonding interfaces",
"interfaces" : [
{
"alias" : null,
"gateway" : "",
"ip" : "",
"mac" : "66:eb:31:0e:07:71",
"mode" : "broadcast",
"name" : "bond2",
"netmask" : "",
"dhcp" : "false",
"slaves" : [
{
"name" : "eth2"
}
],
"status" : "down"
},
{
"alias" : null,
"gateway" : "192.168.100.1",
"ip" : "192.168.100.121",
"mac" : "a2:6d:80:29:87:c6",
"mode" : "balance-rr",
"name" : "bondiface",
"dhcp" : "false",
"netmask" : "255.255.255.0",
"slaves" : [
{
"name" : "eth3"
},
{
"name" : "eth4"
}
],
"status" : "up"
}
]
}
Response parameters
The response will be a JSON object with a bonding interface object array.
The bonding parameters are:
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the interface. Alias |
ip | String | IP of the interface. |
netmask | String | Define the network segment where the interface is working. |
gateway | String | IP used to send packets of a different network segment. |
mac | String | Link layer unique identifier. It is the mac of the first NIC interface slave. |
name | String | Interface’s name. It is used as an interface unique identifier. |
status | String | The values can be up, the interface can receive packets; down, the interface can not receive packets. |
slaves | Object[] | NIC interface members of the bonding interface. |
mode | String | It is the working mode for bonding interface. The options are: balance-rr, Round-robin policy; active-backup, Active-backup policy; balance-xor, XOR policy; broadcast, Broadcast policy; 802.3ad, IEEE 802.3ad LACP; balance-tlb, Adaptive transmit load balancing; balance-alb, Adaptive load balancing. Those values are defined in section Network - Bonding interfaces. |
dhcp | String | Enables the DHCP service to get the network configuration for the interface from a DHCP server. This parameter accepts: true, to enable the service, the interface configuration will be blocked while the DHCP service is enabled; false to stop the service, the interface will lose all its network configuration. |
Slaves object:
Field | Type | Description |
---|---|---|
name | String | Name is the interface unique identifier of the NIC slave. |
Retrieve Bonding interface
Retrieve Bonding interface
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/bonding/bondiface
zcli network-bonding get bondiface
GET /interfaces/bonding/<name>
Get all the parameters of the interface. name is the interface unique identifier.
Response example:
{
"description" : "Show bonding interface",
"interface" : {
"alias" : null,
"gateway" : "192.168.100.1",
"ip" : "192.168.100.121",
"mac" : "a2:6d:80:29:87:c6",
"mode" : "balance-rr",
"name" : "bondiface",
"netmask" : "255.255.255.0",
"dhcp" : "false",
"slaves" : [
{
"name" : "eth3"
},
{
"name" : "eth2"
}
],
"status" : "up"
}
}
Response parameters
The response will be a JSON object with a bonding interface object.
The bonding parameters are:
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the interface. Alias |
ip | String | IP of the interface. |
netmask | String | Define the network segment where the interface is working. |
gateway | String | IP used to send packets of a different network segment. |
mac | String | Link layer unique identifier. It is the mac of the first NIC interface slave. |
name | String | Interface’s name. It is used as an interface unique identifier. |
status | String | The values can be up, the interface can receive packets; down, the interface can not receive packets. |
slaves | Object[] | NIC interface members of the bonding interface. |
mode | String | It is the working mode for bonding interface. The options are: balance-rr, Round-robin policy; active-backup, Active-backup policy; balance-xor, XOR policy; broadcast, Broadcast policy; 802.3ad, IEEE 802.3ad LACP; balance-tlb, Adaptive transmit load balancing; balance-alb, Adaptive load balancing. Those values are defined in Network > Bonding interfaces. |
dhcp | String | Enables the DHCP service to get the network configuration for the interface from a DHCP server. This parameter accepts: true, to enable the service, the interface configuration will be blocked while the DHCP service is enabled; false to stop the service, the interface will lose all its network configuration. |
Slave object:
Field | Type | Description |
---|---|---|
name | String | Name is the interface unique identifier of the NIC slave. |
Create Bonding interface
Create Bonding interface
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"slaves":["eth3","eth2"],"name":"bondiface","mode":"balance-rr"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/bonding
zcli network-bonding create -slave eth3,eth2 -name bondiface -mode balance-rr
POST /interfaces/bonding
Create a bonding interface joining NIC interfaces.
The bonding MAC address will be taken from its first NIC interface. Bonding mode can’t be changed once the bonding interface is created, but member interfaces can be added or deleted in the bonding interface as needed. A NIC interface will be locked if it is part of a bonding interface.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
name | String | Interface’s name. It is used as an interface unique identifier. | true |
slaves | String[] | All NIC interfaces that build the bonding. It is required the NIC parameter name. | true |
mode | String | It is the working mode for bonding interface. The options are: balance-rr, Round-robin policy; active-backup, Active-backup policy; balance-xor, XOR policy; broadcast, Broadcast policy; 802.3ad, IEEE 802.3ad LACP; balance-tlb, Adaptive transmit load balancing; balance-alb, Adaptive load balancing. Those values are defined in Network > Bonding interfaces. | true |
Response example:
{
"description" : "Add a bond interface",
"params" : {
"mac" : "a2:6d:80:29:87:c6",
"mode" : "balance-rr",
"name" : "bondiface",
"slaves" : [
{
"name" : "eth3"
},
{
"name" : "eth2"
}
],
"status" : "down"
}
}
Response parameters
The response will be a JSON object with the bonding configurated parameters.
Field | Type | Description |
---|---|---|
mac | String | Link layer unique identifier. It is the mac of the first NIC interface slave. |
name | String | Interface’s name. It is used as an interface unique identifier. |
status | String | The values can be up, the interface can receive packets; down, the interface can not receive packets. |
slaves | Object[] | NIC interfaces that build the bonding interface. |
mode | String | It is the working mode for bonding interface. The options are: balance-rr, Round-robin policy; active-backup, Active-backup policy; balance-xor, XOR policy; broadcast, Broadcast policy; 802.3ad, IEEE 802.3ad LACP; balance-tlb, Adaptive transmit load balancing; balance-alb, Adaptive load balancing. Those values are defined in Network > Bonding interfaces. |
Slave object:
Field | Type | Description |
---|---|---|
name | String | Name is the interface unique identifier of the NIC slave. |
Modify Bonding interface
Modify Bonding interface
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"ip":"192.168.100.121","netmask":"255.255.255.0","gateway":"192.168.100.1","mac":"86:2f:0e:9a:30:14"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/bonding/bondiface
zcli network-bonding set bondiface -ip 192.168.100.121 -netmask 255.255.255.0 -gateway 192.168.100.1 -mac 86:2f:0e:9a:30:14
PUT /interfaces/bonding/<name>
Modify the parameters of a bonding interface. name is the interface unique identifier.
Request parameters
Field | Type | Description |
---|---|---|
ip | String | IP of the interface. |
netmask | String | Define the network segment where the interface is working. |
gateway | String | IP used to send packets of a different network segment. |
force | String | If a farm is using the interface, the interface won’t be able to be modified. Then, if this parameter is sent with the value true, the interface will be forced to take the new configuration and all farms are using the interface will be restarted. |
dhcp | String | Enables the DHCP service to get the network configuration for the interface from a DHCP server. This parameter accepts: true, to enable the service, the interface configuration will be blocked while the DHCP service is enabled; false to stop the service, the interface will lose all its network configuration. |
mac | String | Rewrites the MAC of the interface. |
Response example:
{
"description" : "Modify bond address",
"params" : {
"gateway" : "192.168.100.1",
"ip" : "192.168.100.121",
"netmask" : "255.255.255.0",
"mac" : "86:2f:0e:9a:30:14",
"dhcp" : "false",
"force" : "true"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Delete Bonding configuration
Delete Bonding configuration
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/bonding/bondiface
zcli network-bonding delete bondiface
DELETE /interfaces/bonding/<name>
Delete the bonding interface configuration. The configuration parameters are: gateway, ip and netmask.
name is the interface unique identifier.
Response example:
{
"description" : "Delete bonding network configuration",
"message" : "The configuration for the bonding interface bondiface has been deleted.",
"success" : "true"
}
Set Bonding interface action
Set Bonding interface action
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"action":"up"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/bonding/bondiface/actions
zcli network-bond start bondiface
POST /interfaces/bonding/<name>/actions
Apply an action to a bonding interface. This call lets delete the bonding interface and enable or disable it.
It is needed to delete the bonding interface using destroy action if you want to unlock the used NIC interfaces in the bonding. The bonding driver will then restore the MAC addresses that the member interfaces had before they were added to the bonding interface.
name is the interface unique identifier.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
action | String | Action to apply to the interface. The available values are: up enable the interface and prepare it for being used, down disable the interface to not receive or not send packets, destroy delete the bonding and restore the NIC slaves interfaces. | true |
Response example:
{
"description" : "Action on bond interface",
"params" : {
"action" : "up"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Add a Bonding slave interface
Add a Bonding slave interface
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"name":"eth4"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/bonding/bondiface/slaves
zcli network-bonding-slave add bondiface -name eth4
POST /interfaces/bonding/<name>/slaves
Add a NIC interface as a slave to an existing bonding interface.
name is the interface unique identifier.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
name | String | NIC Interface’s name to add to the bonding interface. | true |
Response example:
{
"description" : "Add a slave to a bond interface",
"params" : {
"mac" : "a2:6d:80:29:87:c6",
"mode" : "balance-rr",
"name" : "bondiface",
"slaves" : [
{
"name" : "eth3"
},
{
"name" : "eth2"
},
{
"name" : "eth4"
}
],
"status" : "up"
}
}
Response parameters
The response will be a JSON with updated configurated values. See the response example for more information.
Remove a Bonding slave interface
Remove a Bonding slave interface
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/bonding/bondiface/slaves/eth2
zcli network-bonding-slave remove bondiface eth2
DELETE /interfaces/bonding/<name>/slaves/<name>
Delete a NIC slave interface from a bonding interface. The bonding interface must have almost one NIC slave interface.
First, name is the DELETE
call is the bonding name unique identifier, next name in the DELETE
call is the interface name unique identifier of the NIC.
Response example:
{
"description" : "Remove bonding slave interface",
"message" : "The bonding slave interface eth2 has been removed.",
"success" : "true"
}
Network - Floating interfaces
This kind of interface uses a defined virtual interface and mask the outgoing traffic of a nic, bonding or VLAN interface with a child virtual interface. This interface is used for stateful failover behavior in l4xnat profiles if a cluster is configured.
List Floating interfaces
List Floating interfaces
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/floating
zcli network-floating list
GET /interfaces/floating
Show all available or configurated interfaces where a floating IP has been created.
Response example:
{
"description" : "List floating interfaces",
"params" : [
{
"alias" : null,
"floating_alias" : null,
"floating_ip" : null,
"interface" : "bondiface",
"interface_virtual" : null
},
{
"alias" : null,
"floating_alias" : null,
"floating_ip" : "192.168.100.41",
"interface" : "eth0",
"interface_virtual" : "eth0:virtiface"
},
{
"alias" : null,
"floating_alias" : null,
"floating_ip" : null,
"interface" : "eth0.1",
"interface_virtual" : null
},
{
"alias" : "gestion",
"floating_alias" : null,
"floating_ip" : null,
"interface" : "eth1",
"interface_virtual" : null
}
]
}
Response parameters
The response will be a JSON object with a floating interface object array:
Floating object:
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the interface. Alias |
floating_alias | String | It is the alias of the virtual interface. |
floating_ip | String | Floating IP used in interface. floating_ip must exist as virtual interface child of the interface. |
interface | String | Interface masked by the floating IP. |
interface_virtual | String | It is the virtual interface name of the floating IP used to mask the interface. |
Retrieve Floating interface
Retrieve Floating interface
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/floating/eth0
zcli network-floating get eth0
GET /interfaces/floating/<name>
Shows if an interface has a configured floating IP. If it has one configurated it will be shown here.
name is the interface unique identifier which can be of type nic, bonding or VLAN.
Response example:
{
"description" : "Show floating interface",
"params" : {
"alias" : null,
"floating_alias" : null,
"floating_ip" : "192.168.100.41",
"interface" : "eth0",
"interface_virtual" : "eth0:virtiface"
}
}
Response parameters
Field | Type | Description |
---|---|---|
alias | String | It is a nick to help to identify the interface. Alias |
floating_alias | String | It is the alias of the virtual interface. |
floating_ip | String | Floating IP used in interface. floating_ip must exist as virtual interface child of the interface. |
interface | String | Interface masked by the floating IP. |
interface_virtual | String | It is the virtual interface name of the floating IP used to mask the interface. |
Modify Floating interface
Modify Floating interface
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"floating_ip":"192.168.100.199"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/floating/eth0
zcli network-floating set eth0 -floating_ip 192.168.100.199
PUT /interfaces/floating/<name>
Configure a floating IP for a NIC, bonding or VLAN interface.
name is the interface unique identifier which can be of type nic, bonding or VLAN.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
floating_ip | String | Floating IP used in interface. floating_ip must exist as virtual interface child of the interface. | true |
Response example:
{
"description" : "Modify floating interface",
"message" : "Floating interface modification done",
"success" : "true"
}
Delete Floating configuration
Delete Floating configuration
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/interfaces/floating/eth0
zcli network-floating delete eth0
DELETE /interfaces/floating/<name>
Remove the floating IP configuration in an interface.
name is the interface unique identifier which can be of type nic, bonding or VLAN.
Response example:
{
"description" : "Remove floating interface",
"message" : "The floating interface has been removed.",
"success" : "true"
}
Network - Aliases
Put an alias to an interface or a backend to identifies it quickly.
Two types of aliases exist, interface alias can be applied in all types of interfaces: NIC, bonding, VLAN or virtual. It is an easy way of relating an interface name with a more friendly name.
The other type of alias is for backends. This relates the backend IP with an alias.
The aliases are only visual information, it does not replace the backend IP or the interface name in a ZAPI request.
List aliases
List aliases
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/aliases/backends
zcli network-alias-backend list
GET /aliases/<backends|interfaces>
List the aliases in the system for interfaces or backends.
Response example:
{
"description" : "List the aliases",
"params" : [
{
"id" : "192.168.11.13",
"alias" : "http-backend"
},
{
"id" : "127.0.0.1",
"alias" : "localhost"
}
]
}
Response parameters
The ZAPI returns a hash where the key is the backend IP or the interface name and the value is its alias.
Create an alias
Create an alias
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"id":"eth0","alias":"management"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/aliases/interfaces
zcli network-alias-interface set eth0 -alias management
POST /aliases/<backends|interfaces>
The backend or interfaces kind of object which will receive the alias.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
alias | String | It is the nick for the element id sent in the URI. | true |
id | String | It is the backend IP or the interface name. | true |
Response example:
{
"description" : "Set an alias",
"message" : "Alias for eth0 has been updated successfully",
"success" : "true"
}
Response parameters
The ZAPI returns a success message if the process was correct.
Modify an alias
Modify an alias
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"alias":"gateway"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/aliases/interfaces/eth0
zcli network-alias-interface set eth0 -alias gateway
PUT /aliases/<backends|interfaces>/<id>
If the object has an alias, it will be replaced, else an alias will be created for the object.
The id URI parameter is the backend IP or the interface name.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
alias | String | It is the nick for the element id sent in the URI. | true |
Response example:
{
"description" : "Set an alias",
"message" : "Alias for eth0 has been updated successfully",
"success" : "true"
}
Response parameters
The ZAPI returns a success message if the process was correct.
Delete an alias
Delete an alias
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/aliases/interfaces/eth0
zli network-alias-interface delete eth0
DELETE /aliases/<backends|interfaces>/<id>
It deletes the alias of an interface or backend.
The id URI parameter is the backend IP or the interface name.
Response example:
{
"description" : "Delete an alias",
"message" : "The alias has been deleted.",
"success" : "true"
}
Response parameters
The ZAPI returns a success message if the process was correct.
Network - Routing
This module is available from zapi version 4.0.1.
This module manages the routes for traffic is going through or from the load balancer. This process calculates the output interface depends on the packet source and the packet destination. For this task, the load balancer uses two kinds of objects rules and tables.
The first step is looking for a rule where the packet source matches, once the rule is found, the packet outcoming interface is looking for in the table that rule defined. The interface is token of the route which matches with packet destination.
List routing rules
List routing rules
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/rules
zcli network-routing-rule list
GET /routing/rules
List the routing rules of the load balancer. Routing rules are used to get the interface table depend on the source packet IP
Response example:
{
"description" : "List routing rules",
"params" : [
{
"id" : 1024,
"not" : "true",
"from" : "10.10.10.0/24",
"priority" : 30000,
"table" : "table_eth1",
"type" : "user"
},
{
"table" : "local",
"type" : "system",
"id" : 0,
"priority" : 0,
"from" : "all"
},
{
"id" : 0,
"priority" : 31000,
"from" : "10.3.0.0/24",
"table" : "205",
"type" : "system"
},
{
"type" : "system",
"table" : "table_eth1",
"priority" : 31000,
"from" : "4.4.4.0/24",
"id" : 0
},
{
"type" : "system",
"table" : "main",
"priority" : 32766,
"from" : "all",
"id" : 0
}
]
}
Response parameters
The response will be a JSON list with all the routing rules in the system. Each rule is an object with the following parameters:
Field | Type | Description |
---|---|---|
id | Number | It is the unique identifier used for routing rules. |
not | String | This field is used combined with the parameter from to negate the match result. This parameter is a boolean string with the value true to enabled it or with the value false if the match result does not be negated. |
from | String | It is the source IP or networking segment used to match with the source IP of the packet. |
priority | Number | It is the rule priority, a minor value of priority is a high priority. |
table | String | It is the interface table used to route if the packet source IP matches with parameter from. |
type | String | It is the kind of rule, this field can have the values: farm is a route used to route traffic of an l4xnat farm, user is a rule that was created by the load balancer administrator or system is a rule generated automatically for the system. |
Create Routing Rule
Create Routing Rule
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"table":"table_eth1","not":"true","priority":"30000","from":"192.168.0.0/16"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/rules
zcli network-routing-rule -table table_eth1 -not true -priority 30000 -from 192.168.0.0/16
POST /routing/rules
Create a routing rule.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
not | String | This field is used combined with the parameter from to negate the match result. This parameter is a boolean string with the value true to enabled it or with the value false if the match result does not be negated. | |
from | String | It is the source IP or networking segment used to match with the source IP of the packet. | true |
priority | Number | It is the rule priority, a minor value of priority is a high priority. The created rules must have a value between 29000 and 30999 | |
table | String | It is the interface table used to route if the packet source IP matches with parameter from. | true |
Response example:
{
"description" : "Create a routing rule",
"params" : [
{
"not" : "true",
"id" : 1024,
"from" : "192.168.0.0/16",
"priority" : 30000,
"table" : "table_eth1",
"type" : "user"
},
{
"table" : "table_eth0",
"type" : "system",
"id" : 0,
"priority" : 32765,
"from" : "192.168.100.0/24"
},
{
"from" : "all",
"priority" : 32766,
"id" : 0,
"type" : "system",
"table" : "main"
},
{
"id" : 0,
"priority" : 32767,
"from" : "all",
"table" : "default",
"type" : "system"
}
]
}
Response parameters
The response will be a JSON object with all the routes rules of the system. Each route is an object with the parameters:
Field | Type | Description |
---|---|---|
id | Number | It is the unique identifier used for routing rules. |
not | String | This field is used combined with the parameter from to negate the match result. This parameter is a boolean string with the value true to enabled it or with the value false if the match result does not be negated. |
from | String | It is the source IP or networking segment used to match with the source IP of the packet. |
priority | Number | It is the rule priority, a minor value of priority is a high priority. |
table | String | It is the interface table used to route if the packet source IP matches with parameter from. |
type | String | It is the kind of rule, this field can have the values: farm is a route used to route traffic of an l4xnat farm, user is a rule that was created by the load balancer administrator or system is a rule generated automatically for the system. |
Modify Routing Rule
Modify Routing Rule
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"table":"table_eth1","from":"10.10.10.0/24","priority":"30000","not":"false"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/rules/1024
zcli network-routing-rule set 1024 -table table_eth1 -from 10.10.10.0/24 -priority 30000 -not false
PUT /routing/rules/<id>
Modify the parameters of a routing rule.
The id URI parameter is the rule unique identifier.
The rules of type user are the unique that can be modified
Request parameters
Field | Type | Description | Required |
---|---|---|---|
not | String | This field is used combined with the parameter from to negate the match result. | |
from | String | It is the source IP or networking segment used to match with the source IP of the packet. This parameter is a boolean string with the value true to enabled it or with the value false if the match result does not be negated. | true |
priority | Number | It is the rule priority, a minor value of priority is a high priority. The created rules must have a value between 29000 and 30999 | |
table | String | It is the interface table used to route if the packet source IP matches with parameter from. | true |
Response example:
{
"description" : "Modify a routing rule",
"params" : [
{
"not" : "true",
"id" : 1024,
"priority" : 30000,
"from" : "10.10.10.0/24",
"table" : "table_eth1",
"type" : "user"
},
{
"id" : 0,
"from" : "4.4.4.0/24",
"priority" : 31000,
"table" : "table_eth1",
"type" : "system"
},
{
"table" : "table_eth2",
"type" : "system",
"id" : 0,
"from" : "5.5.5.0/24",
"priority" : 31000
},
{
"type" : "system",
"table" : "table_eth0",
"from" : "192.168.100.0/24",
"priority" : 32765,
"id" : 0
},
]
}
Response parameters
The response will be a JSON object with all the routes rules of the system. Each route is an object with the parameters:
Field | Type | Description |
---|---|---|
id | Number | It is the unique identifier used for routing rules. |
not | String | This field is used combined with the parameter from to negate the match result. This parameter is a boolean string with the value true to enabled it or with the value false if the match result does not be negated. |
from | String | It is the source IP or networking segment used to match with the source IP of the packet. |
priority | Number | It is the rule priority, a minor value of priority is a high priority. |
table | String | It is the interface table used to route if the packet source IP matches with parameter from. |
type | String | It is the kind of rule, this field can have the values: farm is a route used to route traffic of an l4xnat farm, user is a rule that was created by the load balancer administrator or system is a rule generated automatically for the system. |
Delete Routing Rule
Delete Routing Rule
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/rules/1024
zcli network-routing-rule remove 1024
DELETE /routing/rules/<id>
Delete a routing rule.
The id URI parameter is the rule unique identifier.
Response example:
{
"message" : "The routing rule '1024' has been deleted successfully.",
"description" : "Delete the routing rule '1024'"
}
List routing tables
List routing tables
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/tables
zcli network-routing-table list
GET /routing/tables
List the routing tables that the load balancer manages.
The main table is global for all interfaces. It contains default routes for all interfaces that will be used if no rules match with the packet. Each interface table manages the routes for the outcoming traffic of that interface.
Response example:
{
"description" : "List routing tables",
"params" : [
"main",
"table_eth0",
"table_eth1",
"table_eth2",
"table_eth3"
]
}
Response parameters
The response will be a JSON object with the params key that contains a list with the tables that exist in the system.
List Routes of a table
List routing rules
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/tables/table_eth2
zcli network-routing-table get table_eth2
GET /routing/tables/<table>
List the routes entries that an interface table manages. Those entries are used to match the packet destination IP. The outcoming interface for the packet will be the first interface that will match with an entry of the table.
Response example:
{
"description" : "Get the routing table 'table_eth2'",
"params" : [
{
"to" : "84.1.21.5",
"via" : "4.4.4.45",
"priority" : 2,
"raw" : "84.1.21.5 dev eth1 src 4.4.4.4 via 4.4.4.45 metric 2 table table_eth2",
"id" : 1024,
"source" : "4.4.4.4",
"type" : "user",
"interface" : "eth1"
},
{
"priority" : 10,
"raw" : "5.5.5.0/24 dev eth2 scope link src 5.5.5.5 initcwnd 10 initrwnd 10 table table_eth2",
"interface" : "eth2",
"source" : "5.5.5.5",
"type" : "system",
"to" : "5.5.5.0/24",
"via" : ""
},
{
"via" : "",
"to" : "192.168.100.0/24",
"interface" : "eth0",
"type" : "system",
"source" : "192.168.100.241",
"raw" : "192.168.100.0/24 dev eth0 scope link src 192.168.100.241 initcwnd 10 initrwnd 10 table table_eth2",
"priority" : 10
}
]
}
Response parameters
The response will be a JSON object with the key params and a list of the routes that contains the table.
Field | Type | Description |
---|---|---|
raw | String | It is the routing entry with the IP route format. |
priority | Number | It is the priority in which the route will be examined. A lower value is more priority. This field has to have a value between 1 and 10. |
interface | String | It is the outcoming interface used if the route matches. |
source | String | It is the IP used to masquerade the packet. This source has to exist in the load balancer as a virtual interface. |
type | String | It is the type of route. The routes can be of type system that are created and managed automatically by the system, or user when the route was created by a load balancer user. Checking the unmanage feature to remove a system route. |
to | String | It is de match condition. If the packet destination IP matches with it the route is successful. |
via | String | It is the next hop of the packet. It is used as a gateway. This IP has to be reached from the interface networking segment. |
id | Number | It is the unique identifier of the route. This parameter is used to modify or delete the route and only is available in routes of type user. |
Create Routing Entry
Create Routing Entry
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"source":"4.4.4.4","via":"4.4.4.45","interface":"eth1","priority":2,"to":"84.1.21.5"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/tables/table_eth2/routes
zcli network-routing-table add table_eth2 -source 4.4.4.4 -via 4.4.4.45 -interface eth1 -priority 2 -to 84.1.21.5
POST /routing/tables/<table>/routes
Create a route for an interface.
The table URI parameter is the interface table where the route will be added.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
raw | String | It is the routing entry with the IP route format. If this parameter is used, the others will be avoided. | |
to | String | It is de match condition. If the packet destination IP matches with it the route is successful. | It is required when raw is not sent |
priority | Number | It is the priority in which the route will be examined. A lower value is more priority. This field has to have a value between 1 and 10. | |
interface | String | It is the outcoming interface used if the route matches. | |
source | String | It is the IP used to masquerade the packet. This source has to exist in the load balancer as a virtual interface. | |
via | String | It is the next hop of the packet. It is used as a gateway. This IP has to be reached from the interface networking segment. |
Response example:
{
"description" : "Create a routing entry in the table 'table_eth2'",
"params" : [
{
"to" : "84.1.21.5",
"via" : "4.4.4.45",
"priority" : 2,
"raw" : "84.1.21.5 dev eth1 src 4.4.4.4 via 4.4.4.45 metric 2 table table_eth2",
"id" : 1024,
"source" : "4.4.4.4",
"type" : "user",
"interface" : "eth1"
},
{
"raw" : "default via 5.5.5.1 dev eth2 initcwnd 10 initrwnd 10 table table_eth2",
"priority" : 10,
"source" : "",
"type" : "system",
"interface" : "eth2",
"to" : "default",
"via" : "5.5.5.1"
},
{
"priority" : 10,
"raw" : "4.4.4.0/24 dev eth1 scope link src 4.4.4.4 initcwnd 10 initrwnd 10 table table_eth2",
"source" : "4.4.4.4",
"type" : "system",
"interface" : "eth1",
"to" : "4.4.4.0/24",
"via" : ""
},
]
}
Response parameters
The response will be a JSON object with the key params and a list of the routes that contains the table.
Field | Type | Description |
---|---|---|
priority | Number | It is the priority in which the route will be examined. A lower value is more priority. This field has to have a value between 1 and 10. |
raw | String | It is the routing entry with the IP route format. |
interface | String | It is the outcoming interface used if the route matches. |
source | String | It is the IP used to masquerade the packet. This source has to exist in the load balancer as a virtual interface. |
type | String | It is the type of route. The routes can be of type system that are created and managed automatically by the system, or user when the route was created by a load balancer user. Checking the unmanage feature to remove a system route. |
to | String | It is de match condition. If the packet destination IP matches with it the route is successful. |
via | String | It is the next hop of the packet. It is used as a gateway. This IP has to be reached from the interface networking segment. |
id | Number | It is the unique identifier of the route. This parameter is used to modify or delete the route and only is available in routes of type user. |
Modify a Route Entry
Modify a Route Entry
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"priority":2,"source":"4.4.4.4","interface":"eth1","to":"71.71.71.0/24","via":"4.4.4.45"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/tables/table_eth2/routes/1024
zcli network-routing-table -id 1024 -priority 2 -source 4.4.4.4 -interface eth1 -to 71.71.71.0/24 -via 4.4.4.45
PUT /routing/tables/<table>/routes/<id>
Modify the parameters of a route entry.
The table URI parameter is the interface table of the route that will be modified. The id URI parameter is the route unique identifier of the route that will be modified.
Request parameters
Field | Type | Description |
---|---|---|
raw | String | It is the routing entry with the IP route format. If this parameter is used, the others will be avoided. |
priority | Number | It is the priority in which the route will be examined. A lower value is more priority. This field has to have a value between 1 and 10. |
interface | String | It is the outcoming interface used if the route matches. |
source | String | It is the IP used to masquerade the packet. This source has to exist in the load balancer as a virtual interface. |
to | String | It is de match condition. If the packet destination IP matches with it the route is successful. |
via | String | It is the next hop of the packet. It is used as a gateway. This IP has to be reached from the interface networking segment. |
Response example:
{
"description" : "Modify a routing entry in the table 'table_eth2'",
"params" : [
{
"to" : "71.71.71.0/24",
"via" : "4.4.4.45",
"raw" : "71.71.71.0/24 dev eth1 src 4.4.4.4 via 4.4.4.45 metric 2 table table_eth2",
"priority" : 2,
"id" : 1024,
"type" : "user",
"source" : "4.4.4.4",
"interface" : "eth1"
},
{
"raw" : "default via 5.5.5.1 dev eth2 initcwnd 10 initrwnd 10 table table_eth2",
"priority" : 10,
"interface" : "eth2",
"source" : "",
"type" : "system",
"to" : "default",
"via" : "5.5.5.1"
},
{
"via" : "",
"to" : "4.4.4.0/24",
"interface" : "eth1",
"source" : "4.4.4.4",
"type" : "system",
"priority" : 10,
"raw" : "4.4.4.0/24 dev eth1 scope link src 4.4.4.4 initcwnd 10 initrwnd 10 table table_eth2"
},
]
}
Response parameters
The response will be a JSON object with the key params and a list of the routes that contains the table.
Field | Type | Description |
---|---|---|
priority | Number | It is the priority in which the route will be examined. A lower value is more priority. This field has to have a value between 1 and 10. |
raw | String | It is the routing entry with the IP route format. |
interface | String | It is the outcoming interface used if the route matches. |
source | String | It is the IP used to masquerade the packet. This source has to exist in the load balancer as a virtual interface. |
type | String | It is the type of route. The routes can be of type system that are created and managed automatically by the system, or user when the route was created by a load balancer user. Checking the unmanage feature to remove a system route. |
to | String | It is de match condition. If the packet destination IP matches with it the route is successful. |
via | String | It is the next hop of the packet. It is used as a gateway. This IP has to be reached from the interface networking segment. |
id | Number | It is the unique identifier of the route. This parameter is used to modify or delete the route and only is available in routes of type user. |
Delete a Route Entry
Delete a Route Entry
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/tables/table_eth2/routes/1024
zcli network-routing-table remove table_eth2 1024
DELETE /routing/tables/<table>/routes/<id>
Delete a route of an interface table.
The table URI parameter is the interface table from which the route will be deleted. The id URI parameter is the route unique identifier of the route that will be deleted.
Response example:
{
"description" : "Delete the routing entry '1024' from the table 'table_eth2'",
"message" : "The routing rule '1024' has been deleted successfully."
}
List of Interfaces Unmanaged in a Table
List of Interfaces Unmanagned in a Table
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/tables/table_eth1/unmanaged
zcli network-routing-table-unmanaged get table_eth1
GET /routing/tables/<table>/unmanaged
This feature is used to avoid traffic from an interface that can go outcoming for another one.
table is the routing table of the incoming interface.
List the interfaces and if they can be used to outcoming the traffic.
Response example:
{
"params" : [
{
"unmanaged" : "false",
"interface" : "eth3"
},
{
"unmanaged" : "false",
"interface" : "eth0"
}
],
"description" : "Get the list of interfaces that cannot manage traffic when traffic incoming through the table 'table_eth1'"
}
Response parameters
The response will be a JSON object with the key params that contains a list of objects with the following parameters.
Field | Type | Description |
---|---|---|
interface | String | It is the name of the output interface. |
unmanaged | String | It is the routing status of the interface. If it has the value false, this interface can be reached from the table; if it has the value true, it won’t outcoming traffic from the table. |
Add an interface to the list of unmanaged
Unmanage an Interface
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"interface":"eth2"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/tables/table_eth1/unmanaged
zcli network-routing-table-unmanaged add table_eth1 interface eth0
POST /routing/tables/<table>/unmanaged
Disable an interface for outcoming traffic.
The table URI parameter is the routing table name from which a route will not be reacheable. If table has the value “*” (asterisk), the interface will not be accessible from any table.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
interface | String | It is the interface that won’t be able to route from the table. | true |
Response example:
{
"description" : "Do not route traffic through an interface for the table 'table_eth1'",
"message" : "The interface 'eth2' is not accesible from the table 'table_eth1'"
}
Remove an interface from the list of unmanaged
Manage a Routing Table
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/routing/tables/table_eth1/unmanaged/eth2
zcli network-routing-table-unmanaged remove table_eth1 eth2
DELETE /routing/tables/<table>/unmanaged/<interface>
Allow the interface will be visibility from another interface table
The table URI parameter is the interface table that is being modified. If table has the value “*” (asterisk), the interface will be managed from all tables. The interface URI parameter is the interface that will be allowed for the table table.
Response example:
{
"description" : "Enable an interface as possible route path from the table 'table_eth1'",
"message" : "The interface 'eth2' is now accesible from the table 'table_eth1'"
}
Monitoring - FarmGuardian
FarmGuardian is used for advanced monitoring state of backends. When a problem is detected by FarmGuardian automatically disables the real server and will be marked as blacklisted.
List FarmGuardians
List FarmGuardians
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/monitoring/fg
zcli farmguardian list
GET /monitoring/fg
List the FarmGuardians. Templates and custom FarmGuardians appear this the list.
Response example:
{
"description" : "List farm guardian checks and templates",
"params" : [
{
"command" : "check_tcp -p PORT -H HOST",
"cut_conns" : "false",
"description" : "It does a TCP connection to test if the backend is alive",
"farms" : [],
"interval" : 5,
"log" : "false",
"name" : "check_tcp-cut_conns",
"template" : "true",
"backend_alias" : "false"
},
{
"command" : "check_tcp -p 80 -H HOST",
"cut_conns" : "false",
"description" : "TCP check to the port 80",
"farms" : [
"web_service",
"my_welcome_web"
],
"interval" : 7,
"log" : "true",
"name" : "custom-tcp",
"template" : "false",
"backend_alias" : "true"
},
{
"command" : "check_tcp -p PORT -H HOST",
"cut_conns" : "false",
"description" : "It does a TCP connection to test if the backend is alive",
"farms" : [],
"interval" : 5,
"log" : "false",
"name" : "check_tcp",
"template" : "true",
"backend_alias" : "false"
}
]
}
Response parameters
The response will be a JSON object with the key params and the format below:
Field | Type | Description |
---|---|---|
command | String | Command to check the service status in the backend. Those available commands are in libexec path. |
cut_conns | String | The possible values are: true, FarmGuardian cuts the current connections when the backend is not available; or false, if the backend it is not available, it will be disabled but the alive sessions continue. |
description | String | Brief description of the check. |
farms | String[ ] | Farms where the FarmGuardian is applied. |
interval | Number | Time between checks. |
log | String | The possible values are: true, FarmGuardian will log each check; or false, if the backend it is not available, it will be disabled but the alive sessions continue. |
name | String | Unique identifier. |
template | String | If the FarmGuardian is a template, it won’t be applied to any farm. The templates are useful to create a new FarmGuardian. |
backend_alias (from 4.0.1) | String | If this parameter has the value false, the backend host will be the backend IP. The alias of the backend will be used as host if this parameter has the value true, the alias has to be defined and the load balancer should be able to resolve it. |
Retrieve a FarmGuardian
Retrieve a FarmGuardian
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/monitoring/fg/check_tcp
zcli farmguardian get check_tcp
GET /monitoring/fg/<name>
Show the configuration of a FarmGuardian.
The URI parameter name is the FarmGuardian unique identifier.
Response example:
{
"description" : "Retrive the farm guardian check_tcp",
"params" : {
"command" : "check_tcp -p PORT -H HOST",
"cut_conns" : "false",
"description" : "It does a TCP connection to test if the backend is alive",
"farms" : [],
"interval" : 10,
"log" : "false",
"name" : "check_tcp",
"template" : "true",
"backend_alias" : "false",
"timeout" : 5
}
}
Response parameters
The response will be a JSON object with the key params and the format below:
Field | Type | Description |
---|---|---|
command | String | Command to check the service status in the backend. Those available commands are in libexec path. |
cut_conns | String | The possible values are: true, FarmGuardian cuts the current connections when the backend is not available; or false, if the backend it is not available, it will be disabled but the alive sessions continue. |
description | String | Brief description of the check. |
farms | String[ ] | Farms where the FarmGuardian is applied. |
interval | Number | Time between checks. This is the time from when the last backend in the list is tested until the first backend is tested again. |
log | String | The possible values are: true, FarmGuardian will log each check; or false, if the backend it is not available, it will be disabled but the alive sessions continue. |
name | String | Unique identifier. |
template | String | If the FarmGuardian is a template, it won’t be modified. The templates are useful to create a new FarmGuardian or apply directly to farms. |
backend_alias (from 4.0.1) | String | If this parameter has the value false, the backend host will be the backend IP. The alias of the backend will be used as host if this parameter has the value true, the alias has to be defined and the load balancer should be able to resolve it. |
timeout (from 4.0.2) | Number | Timeout for each backend. After this time during the backend test, it will be considered down. By default, timeout is equal to interval. |
Create a FarmGuardian
Create a FarmGuardian
Request example:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"name":"check_tcp-cut_conns", "copy_from":"check_tcp"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/monitoring/fg
zcli farmguardian create -name check_tcp-cut_conns -copy_from check_tcp
POST /monitoring/fg
Create a new FarmGuardian.
Request parameters
The response will be a JSON object with the key params and the format below:
Field | Type | Description | Required |
---|---|---|---|
name | String | Unique identifier. | true |
copy_from | String | It is the FarmGuardian used as a template to create the new FarmGuardian. If this field is not sent, the new FarmGuardian is created without configuration. |
Response example:
{
"description" : "Create a farm guardian check_tcp-cut_conns",
"message" : "The farm guardian check_tcp-cut_conns has been created successfully",
"params" : {
"command" : "check_tcp -p PORT -H HOST",
"cut_conns" : "false",
"description" : "It does a TCP connection to test if the backend is alive",
"farms" : [],
"interval" : 5,
"log" : "false",
"name" : "check_tcp-cut_conns",
"template" : "true",
"backend_alias" : "false",
"timeout" : 5
}
}
Response parameters
The response will be a JSON object with the key params and the format below:
Field | Type | Description |
---|---|---|
command | String | Command to check the service status in the backend. Those available commands are in libexec path. |
cut_conns | String | The possible values are: true, FarmGuardian cuts the current connections when the backend is not available; or false, if the backend it is not available, it will be disabled but the alive sessions continue. |
description | String | Brief description of the check. |
farms | String[ ] | Farms where the FarmGuardian is applied. |
interval | Number | Time between checks. This is the time from when the last backend in the list is tested until the first backend is tested again. |
log | String | The possible values are: true, FarmGuardian will log each check; or false, if the backend it is not available, it will be disabled but the alive sessions continue. |
name | String | Unique identifier. |
template | String | If the FarmGuardian is a template, it won’t be modified. The templates are useful to create a new FarmGuardian or apply directly to farms. |
backend_alias (from 4.0.1) | String | If this parameter has the value false, the backend host will be the backend IP. The alias of the backend will be used as host if this parameter has the value true, the alias has to be defined and the load balancer should be able to resolve it. |
timeout (from 4.0.2) | Number | Timeout for each backend. After this time during the backend test, it will be considered down. By default, timeout is equal to interval. |
Modify a FarmGuardian
Modify a FarmGuardian
Request example:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"interval":7,"log":"true","description":"TCP check to the port 80","command":"check_tcp -p 80 -H HOST","cut_conns":"false"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/monitoring/fg/custom-tcp
zcli farmguardian set custom-tcp -interval 7 -log true -description 'TCP check to the port 80' -command 'check_tcp -p 80 -H HOST' -cut_conns false
PUT /monitoring/fg/<name>
Modify a FarmGuardian.
The URI parameter name is the FarmGuardian unique identifier.
Request parameters
The response will be a JSON object with the key params and the format below:
Field | Type | Description | Required |
---|---|---|---|
command | String | Command to check the service status in the backend. Those available commands are in libexec path. | |
cut_conns | String | The possible values are: true, FarmGuardian cuts the current connections when the backend is not available; or false, if the backend it is not available, it will be disabled but the alive sessions continue. | |
description | String | Brief description of the check. | |
interval | Number | Time between checks. This is the time from when the last backend in the list is tested until the first backend is tested again. | |
log | String | The possible values are: true, FarmGuardian will log each check; or false, if the backend it is not available, it will be disabled but the alive sessions continue. | |
force | String | If a running farm is using the FarmGuardian, FarmGuardian won’t be able to be modified. Then, if this parameter is sent with the value true, the FarmGuardian will be forced to take the new configuration. | |
backend_alias (from 4.0.1) | String | If this parameter has the value false, the backend host will be the backend IP. The alias of the backend will be used as host if this parameter has the value true, the alias has to be defined and the load balancer should be able to resolve it. | |
timeout (from 4.0.2) | Number | Timeout for each backend. After this time during the backend test, it will be considered down. By default, timeout is equal to interval. |
Response example:
{
"description" : "Modify farm guardian custom-tcp",
"message" : "Success, some parameters have been changed in farm guardian custom-tcp.",
"params" : {
"command" : "check_tcp -p 80 -H HOST",
"cut_conns" : "false",
"description" : "TCP check to the port 80",
"farms" : [],
"interval" : 7,
"log" : "true",
"name" : "custom-tcp",
"template" : "false",
"backend_alias" : "false",
"timeout" : 7
}
}
Response parameters
The response will be a JSON object with the key params and the format below:
Field | Type | Description |
---|---|---|
command | String | Command to check the service status in the backend. Those available commands are in libexec path. |
cut_conns | String | The possible values are: true, FarmGuardian cuts the current connections when the backend is not available; or false, if the backend it is not available, it will be disabled but the alive sessions continue. |
description | String | Brief description of the check. |
farms | String[ ] | Farms where the FarmGuardian is applied. |
interval | Number | Time between checks. This is the time from when the last backend in the list is tested until the first backend is tested again. |
log | String | The possible values are: true, FarmGuardian will log each check; or false, if the backend it is not available, it will be disabled but the alive sessions continue. |
name | String | Unique identifier. |
template | String | If the FarmGuardian is a template, it won’t be applied to any farm. The templates are useful to create a new FarmGuardian. |
backend_alias (from 4.0.1) | String | If this parameter has the value false, the backend host will be the backend IP. The alias of the backend will be used as host if this parameter has the value true, the alias has to be defined and the load balancer should be able to resolve it. |
timeout (from 4.0.2) | Number | Timeout for each backend. After this time during the backend test, it will be considered down. By default, timeout is equal to interval. |
Delete a FarmGuardian
Delete a FarmGuardian
Request example:
curl -k -X DELETE -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/monitoring/fg/custom-tcp
zcli farmguardian delete custom-tcp
DELETE /monitoring/fg/<name>
DELETE a FarmGuardian.
The URI parameter name is the FarmGuardian unique identifier.
Response example:
{
"description" : "Delete the farm guardian custom-tcp",
"message" : "custom-tcp has been deleted successful.",
"success" : "true"
}
Monitoring - Statistics
Show information about the system and farms. This information will be useful to monitor the Zevenet load balancer status.
Show system statistics
Show system statistics
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats
zcli statistics-system get
GET /stats
Get global system statistics.
Response example:
{
"description" : "System stats",
"params" : {
"cpu" : {
"cores" : 2,
"idle" : 94.42,
"iowait" : 0,
"irq" : 0,
"nice" : 0,
"softirq" : 0,
"sys" : 2.54,
"usage" : 5.58,
"user" : 3.05
},
"date" : "Fri Jan 27 11:40:32 2017",
"hostname" : "api3",
"load" : {
"Last_1" : 1.17,
"Last_15" : 0.36,
"Last_5" : 0.6
},
"memory" : {
"Buffers" : 21.68,
"Cached" : 147.95,
"MemFree" : 348.06,
"MemTotal" : 2005.01,
"MemUsed" : 1656.95,
"SwapCached" : 2.67,
"SwapFree" : 614.38,
"SwapTotal" : 672,
"SwapUsed" : 57.62
},
"network" : {
"bond0 in in" : 234.72,
"bond0 out out" : 0,
"bond0.10 in in" : 0,
"bond0.10 out out" : 0,
"bond1 in in" : 234.72,
"bond1 out out" : 0,
"bond3 in in" : 815.69,
"bond3 out out" : 4300.38,
"eth0 in in" : 2702.29,
"eth0 out out" : 50701.95,
"eth0.2 in in" : 0,
"eth0.2 out out" : 0,
"eth1 in in" : 234.72,
"eth1 out out" : 0,
"eth2 in in" : 234.72,
"eth2 out out" : 0,
"eth3 in in" : 0,
"eth3 out out" : 0,
"eth4 in in" : 436.89,
"eth4 out out" : 4300.38,
"eth4.6 in in" : 0,
"eth4.6 out out" : 0,
"eth5 in in" : 301.39,
"eth5 out out" : 0,
"eth5.5 in in" : 0,
"eth5.5 out out" : 0,
"eth6 in in" : 77.42,
"eth6 out out" : 0
}
}
}
Response parameters
Field | Type | Description |
---|---|---|
cpu | Object | CPU statistics. |
date | String | System date. |
hostname | String | Host’s name. |
load | Object | Core load statistics. |
memory | Object | Used memory statistics. |
network | Object | Network traffic statistics. |
CPU object:
Field | Type | Description |
---|---|---|
cores | Number | Number of cores in the processor. |
idle | Number | CPU does not use by any program. |
iowait | Number | CPU used by input or output process. |
irq | Number | CPU used by hardware interruptions. |
nice | Number | CPU scheduling priority. |
softirq | Number | CPU used by software interruptions. |
sys | Number | CPU used by the system. |
usage | Number | Total CPU used. |
user | Number | CPU used by the user. |
Load object:
Field | Type | Description |
---|---|---|
Last_1 | Number | Load system percentage the last minute. |
Last_5 | Number | Load system percentage five minutes ago. |
Last_15 | Number | Load system percentage fifteen minutes ago. |
Memory object.
Field | Type | Description |
---|---|---|
Buffers | Number | It’s the memory used by the buffers. This amount is indicated in Mb. |
Cached | Number | It’s the total memory cached by the system. This amount is indicated in Mb. |
MemFree | Number | It’s the total free memory not cached by the system. This amount is indicated in Mb. |
MemTotal | Number | It’s the total RAM on the system. This amount is indicated in Mb. |
MemUsed | Number | It’s the memory used by the system. This amount is indicated in Mb. |
SwapCached | Number | It’s the total cache memory reserved. |
SwapFree | Number | It’s the total free memory not cached by the system. This amount is indicated in Mb. |
SwapTotal | Number | It’s the total swap memory reserved. |
SwapUsed | Number | It’s the swap used memory by the system, on optimal systems should be 0. |
Network object:
Field | Type | Description |
---|---|---|
<interface> in in | Number | Input traffic for this interface. |
<interface> out out | Number | Output traffic for this interface. |
Show network statistics
Show network statistics
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats/system/network
zcli statistic-network get
GET /stats/system/network
Get a summary of total input and output traffic through a network interface.
Response example:
{
"description" : "Network interfaces usage",
"params" : {
"date" : "Fri Jan 27 11:58:05 2017",
"hostname" : "api3",
"interfaces" : [
{
"in" : "234.72",
"interface" : "bond1",
"out" : "0.00"
},
{
"in" : "77.42",
"interface" : "eth6",
"out" : "0.00"
},
{
"in" : "2703.88",
"interface" : "eth0",
"out" : "50917.65"
},
{
"in" : "815.69",
"interface" : "bond2",
"out" : "4300.38"
}
]
}
}
Response parameters
The response will be a JSON with a key params whose value is an object with the following keys:
Field | Type | Description |
---|---|---|
date | String | System date. |
hostname | String | Host’s name. |
interfaces | Object[] | Network traffic statistics. |
Interfaces object
Field | Type | Description |
---|---|---|
in | String | Total input traffic in MB. |
interface | String | Interface name. |
out | String | Total output traffic in MB. |
Show interfaces statistics
Show interfaces statistics
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats/system/network/interfaces
zcli statistics-network get
GET /stats/system/network/interfaces
Get a summary of each network interface.
Response example:
{
"description" : "Interfaces info",
"params" : {
"bond" : [
{
"in" : "234.72",
"interface" : "bond1",
"ip" : "",
"mac" : "3a:3a:a7:e3:33:73",
"out" : "0.00",
"slaves" : [
"eth2"
],
"status" : "down",
"virtual" : [],
"vlan" : []
},
{
"in" : "815.70",
"interface" : "bond3",
"ip" : "",
"mac" : "ea:00:7d:88:1d:bd",
"out" : "4300.38",
"slaves" : [
"eth4",
"eth5",
"eth6"
],
"status" : "up",
"virtual" : [],
"vlan" : []
},
{
"in" : "234.72",
"interface" : "bond0",
"ip" : "",
"mac" : "c2:d0:d7:64:df:68",
"out" : "0.00",
"slaves" : [
"eth1"
],
"status" : "down",
"virtual" : [],
"vlan" : [
"bond0.10"
]
}
],
"nic" : [
{
"in" : "77.42",
"interface" : "eth6",
"ip" : "",
"mac" : "ea:00:7d:88:1d:bd",
"out" : "0.00",
"status" : "up",
"virtual" : [],
"vlan" : []
},
{
"in" : "2704.81",
"interface" : "eth0",
"ip" : "192.168.101.46",
"mac" : "9e:2e:3e:a5:2e:6a",
"out" : "51039.13",
"status" : "up",
"virtual" : [
"eth0:1",
"eth0:2",
"eth0.2:6"
],
"vlan" : [
"eth0.2"
]
},
{
"in" : "234.72",
"interface" : "eth1",
"ip" : "192.168.101.58",
"mac" : "c2:d0:d7:64:df:68",
"out" : "0.00",
"status" : "up",
"virtual" : [],
"vlan" : []
},
{
"in" : "234.72",
"interface" : "eth2",
"ip" : "",
"mac" : "3a:3a:a7:e3:33:73",
"out" : "0.00",
"status" : "up",
"virtual" : [],
"vlan" : []
},
{
"in" : "0.00",
"interface" : "eth3",
"ip" : "192.168.101.72",
"mac" : "16:97:ab:43:87:02",
"out" : "0.00",
"status" : "down",
"virtual" : [
"eth3:1",
"eth3:8",
"eth3:6"
],
"vlan" : []
},
{
"in" : "436.89",
"interface" : "eth4",
"ip" : "",
"mac" : "ea:00:7d:88:1d:bd",
"out" : "4300.38",
"status" : "up",
"virtual" : [
"eth4.6:5"
],
"vlan" : [
"eth4.6"
]
},
{
"in" : "301.39",
"interface" : "eth5",
"ip" : "",
"mac" : "ea:00:7d:88:1d:bd",
"out" : "0.00",
"status" : "up",
"virtual" : [],
"vlan" : [
"eth5.5"
]
}
]
}
}
Response parameters
The response will be a JSON with a key params whose value is an object with the keys bond and nic.
Field | Type | Description |
---|---|---|
bond | Object[] | Bond interface statistics. |
nic | Object[] | NIC interface statistics. |
Bond object:
Field | Type | Description |
---|---|---|
in | String | Total input traffic in MB. |
interface | String | Interface name used as a unique identifier. |
ip | String | Interface’s IP. |
mac | String | Interface’s MAC. |
out | String | Total output traffic in MB. |
slaves | String [] | List of slaves that build the bond interface. |
status | String | Interface status. The value can be down, the interface is disabled; up, the interface is enabled. |
virtual | String [] | Virtual interfaces that inherit from this interface. |
vlan | String [] | VLAN interfaces that inherit from this interface. |
Nic object:
Field | Type | Description |
---|---|---|
in | String | Total input traffic in MB. |
interface | String | Interface name used as a unique identifier. |
ip | String | Interface’s IP. |
mac | String | Interface’s MAC. |
out | String | Total output traffic in MB. |
status | String | Interface status. The value can be down, the interface is disabled; up, the interface is enabled. |
virtual | String [] | Virtual interfaces that inherit from this interface. |
vlan | String [] | VLAN interfaces that inherit from this interface. |
Show memory statistics
Show memory statistics
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats/system/memory
zcli statistics-system get -filter memory
GET /stats/system/memory
Get a summary of the system memory.
Response example:
{
"description" : "Memory usage",
"params" : {
"Buffers" : 1.01,
"Cached" : 42.47,
"MemFree" : 880.11,
"MemTotal" : 2005.01,
"MemUsed" : 1124.91,
"SwapCached" : 8.27,
"SwapFree" : 565.15,
"SwapTotal" : 672,
"SwapUsed" : 106.84,
"date" : "Fri Jan 27 12:27:11 2017",
"hostname" : "api3"
}
}
Response parameters
The response will be a JSON with a key params whose value is a memory object.
Memory object.
Field | Type | Description |
---|---|---|
Buffers | Number | It’s the memory used by the buffers. This amount is indicated in Mb. |
Cached | Number | It’s the total memory cached by the system. This amount is indicated in Mb. |
MemFree | Number | It’s the total free memory not cached by the system. This amount is indicated in Mb. |
MemTotal | Number | It’s the total RAM on the system. This amount is indicated in Mb. |
MemUsed | Number | It’s the memory used by the system. This amount is indicated in Mb. |
SwapCached | Number | It’s the total cache memory reserved. |
SwapFree | Number | It’s the total free memory not cached by the system. This amount is indicated in Mb. |
SwapTotal | Number | It’s the total swap memory reserved. |
SwapUsed | Number | It’s the swap used memory by the system, on optimal systems should be 0. |
date | String | System date. |
hostname | String | Host’s name. |
Show load statistics
Show load statistics
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats/system/load
zcli statistics-system get -filter load
GET /stats/system/load
Get a summary of the CPU system load.
Response example:
{
"description" : "System load",
"params" : {
"Last_1" : 0.66,
"Last_15" : 0.39,
"Last_5" : 0.49,
"date" : "Fri Jan 27 13:15:01 2017",
"hostname" : "api3"
}
}
Response parameters
Field | Type | Description |
---|---|---|
Last_1 | Number | Load system usage the last. |
Last_5 | Number | Load system usage in the last five minutes. |
Last_15 | Number | Load system usage the last fifteen minutes. |
date | String | System date. |
hostname | String | Host’s name. |
Show CPU statistics
Show CPU statistics
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats/system/cpu
zcli statistics-system get -filter cpu
GET /stats/system/cpu
Response example:
{
"description" : "System CPU usage",
"params" : {
"cores" : 2,
"date" : "Fri Jan 27 13:30:52 2017",
"hostname" : "api3",
"idle" : 94.9,
"iowait" : 0,
"irq" : 0,
"nice" : 0,
"softirq" : 0,
"sys" : 3.06,
"usage" : 5.1,
"user" : 2.04
}
}
Response parameters
Field | Type | Description |
---|---|---|
cores | Number | Number of cores in the processor. |
idle | Number | CPU does not use by any program. |
iowait | Number | CPU used by input or output process. |
irq | Number | CPU used by hardware interruptions. |
nice | Number | CPU scheduling priority. |
softirq | Number | CPU used by software interruptions. |
sys | Number | CPU used by the system. |
usage | Number | Total CPU used. |
user | Number | CPU used by the user. |
date | String | System date. |
hostname | String | Host’s name. |
Show connections statistics
Show connections statistics
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats/system/connections
zcli statistics-network-connections get
GET /stats/system/connections
Get the total current connections in the system. The counter sums any type of tracked connections: ASSURED, ESTABLISHED, SYN_SENT, TIME_WAIT, LISTEN…
Response example:
{
"description" : "System connections",
"params" : {
"connections" : 324
}
}
Response parameters
Field | Type | Description |
---|---|---|
connections | Number | Total tracked connections. |
Show number of farms
Show number of farms
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats/farms/total
GET /stats/farms/total
Show the total of farms created in the system.
Response example:
{
"description" : "Number of farms.",
"number" : 8
}
Response parameters
Field | Type | Description |
---|---|---|
number | Number | It is the number of farms existing in the system. |
Show farms statistics
Show farms statistics
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats/farms
statistics-farm list
GET /stats/farms
Get a summary of connections and configuration for all farms in the system.
Response example:
{
"description" : "List all farms stats",
"farms" : [
{
"established" : 0,
"farmname" : "testHttps",
"pending" : 0,
"profile" : "https",
"status" : "up",
"vip" : "192.168.101.20",
"vport" : "120"
},
{
"established" : 0,
"farmname" : "httpFarm",
"pending" : 0,
"profile" : "http",
"status" : "up",
"vip" : "192.168.10.31",
"vport" : "8080"
},
{
"established" : 0,
"farmname" : "testDL",
"pending" : 0,
"profile" : "datalink",
"status" : "up",
"vip" : "192.168.102.72",
"vport" : "eth1"
},
{
"established" : 0,
"farmname" : "testL4",
"pending" : 0,
"profile" : "l4xnat",
"status" : "up",
"vip" : "192.168.10.31",
"vport" : "30"
},
{
"established" : 0,
"farmname" : "testGSLB",
"pending" : 0,
"profile" : "gslb",
"status" : "up",
"vip" : "192.168.10.31",
"vport" : "53"
}
]
}
Response parameters
Field | Type | Description |
---|---|---|
established | Number | the total number of currently established connections. |
farmname | String | Farm name, unique identifier. |
pending | Number | Number of pending connections. |
profile | String | Type of farm. The possible values are: datalink, l4xnat, http, https or gslb. Each profile is defined in its section. |
status | String | Farm status. The available status values are: down, the farm is not running; needed restart, the farm is up but it is pending of a restart action; critical, the farm is up and all backends are unreachable or maintenance; problem, the farm is up and there are some backend unreachable, but almost a backend is in up status; maintenance, the farm is up and there are backends in up status, but almost a backend is in maintenance mode; up, the farm is up and all the backends are working success. |
vip | String | IP of the farm, where the virtual service is listening. |
vport | String | Port of the farm, where the virtual service is listening. |
Show farm statistics
Show farm statistics
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats/farms/farmname
zcli statistic-farm list
GET /stats/farms/<farmname>
Shows the current farm status, their backend status and connections. Each farm will response with a different object, depending on the profile.
Response example for HTTP farm:
{
"backends" : [
{
"established" : 0,
"id" : 0,
"ip" : "192.168.0.168",
"pending" : 0,
"port" : 80,
"service" : "srv1",
"status" : "up"
}
],
"description" : "List farm stats",
"sessions" : [
{
"client" : "0",
"id" : "0"
"backend_ip" : "192.168.0.168"
"backend_port" : 80
"service" : "srv1",
"session" : "192.168.0.186",
"ttl" : "1m28s0ms"
}
],
"total_sessions" : 1
}
Response parameters in HTTP farms
Field | Type | Description |
---|---|---|
backends | Object[] | Show information about backends. |
sessions | Object[] | Show information about sessions. |
total_sessions | Number | From version 4.0.2. Displays the total number of registered sessions. |
Backend Object
Field | Type | Description |
---|---|---|
established | Number | The total number of established connections. |
id | Number | Backend unique identifier. |
ip | String | IP where the real service is listening. |
pending | Number | Number of pending connections. |
port | Number | Port where the real service is listening. |
service | String | Service name used as a unique identifier. |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; maintenance, backend is marked as not ready for receiving connections by the administrator, this option is useful for backend’s maintenance tasks; undefined, the backend status has been not checked. |
Session Object
Field | Type | Description |
---|---|---|
client | String | Client unique identifier. |
id | String | Backend unique identifier assigned to the client. |
service | String | Service unique identifier assigned to the client. |
session | String | Session unique identifier. This value depends on the persistence type. |
ttl | String | From version 4.0.2. Time remaining until the session ends |
backend_ip | String | From version 4.0.2. Backend Ip assigned to the client. |
backend_port | String | From version 4.0.2. Backend port assigned to the client. |
Response example for GSLB farm:
{
"backends" : [
{
"id" : 1,
"ip" : "127.0.0.1",
"port" : 53,
"service" : "service1",
"status" : "down"
},
{
"id" : 2,
"ip" : "192.168.55.40",
"port" : 53,
"service" : "service1",
"status" : "down"
},
{
"id" : 4,
"ip" : "192.135.10.2",
"port" : 53,
"service" : "service1",
"status" : "down"
},
{
"id" : 1,
"ip" : "127.0.0.1",
"port" : 80,
"service" : "prioServ",
"status" : "down"
},
{
"id" : 2,
"ip" : "127.0.0.1",
"port" : 80,
"service" : "prioServ",
"status" : "down"
}
],
"client" : {
"edns_big" : 0,
"edns_tc" : 0,
"recvfail" : 0,
"reqs" : 0,
"sendfail" : 0,
"tc" : 0
},
"description" : "List farm stats",
"extended" : {
"badvers" : 0,
"dropped" : 0,
"edns" : 0,
"edns_clientsub" : 0,
"formerr" : 0,
"noerror" : 0,
"notimp" : 0,
"nxdomain" : 0,
"refused" : 0,
"v6" : 0
},
"server" : {
"recvfail" : 0,
"reqs" : 0,
"sendfail" : 0
}
}
Response parameters in GSLB farms
Field | Type | Description |
---|---|---|
backends | Object[] | Show information about the backends. |
client | Object | Statistics related to the client. |
extended | Object | Extended information about the service. |
server | Object | Statistics related to the server. |
Backend object
Field | Type | Description |
---|---|---|
id | Number | Backend unique identifier. |
ip | String | IP where the real service is listening. |
port | Number | Port where the real service is listening. |
service | String | Service name used as a unique identifier. |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; undefined, the backend status has been not checked. |
Client object
Field | Type | Description |
---|---|---|
edns_big | Number | Responses that were greater than 512 bytes. |
edns_tc | Number | The client’s specified extended DNS buffer size was too small for the data requested. |
recvfail | Number | Number of UDP errors, where the OS indicated that something bad happened on receiving. |
reqs | Number | Total number of UDP requests handled by the server. |
sendfail | Number | Number of UDP errors, where the OS indicated that something bad happened on sending. |
tc | Number | Responses that were truncated with the TC bit set. |
Extended object
Field | Type | Description |
---|---|---|
badvers | Number | Request that had an EDNS OPT-RR with a version not supported. |
dropped | Number | Dropped requests for malformed format. |
edns | Number | Request contained an EDNS OPT-RR. |
edns_clientsub | Number | Subset of edns requests that specified the edns_client_subnet option. |
formerr | Number | Request was badly-formatted but was sane enough that we did send a response with the rcode FORMERR. |
noerror | Number | Successful requests. |
notimp | Number | Requested service not implemented by this daemon, such as zone transfer requests. |
nxdomain | Number | Request for a non-existant domain name. |
refused | Number | Request was refused by the server because the server is not authoritative for the queried name. |
v6 | Number | Request from an IPv6 client. |
Server object
Field | Type | Description |
---|---|---|
recvfail | Number | Number of TCP errors, where the OS indicated that something bad happened on receiving. |
reqs | Number | Total number of TCP requests handled by the server. |
sendfail | Number | Number of TCP errors, where the OS indicated that something bad happened on sending. |
Response example for L4xNAT farm:
{
"backends" : [
{
"established" : 5,
"id" : 1,
"ip" : "192.168.5.40",
"pending" : 0,
"port" : "8080",
"status" : "maintenance"
},
{
"established" : null,
"id" : 3,
"ip" : "192.5.1.1",
"pending" : 0,
"port" : "787",
"status" : "down"
},
{
"established" : 1,
"id" : 5,
"ip" : "192.168.5.100",
"pending" : 0,
"port" : "8080",
"status" : "up"
}
],
"description" : "List farm stats",
"sessions" : [
{
"client": 0,
"id" : 5,
"backend_ip" : "192.168.5.100",
"backend_port" : "8080",
"session" : "192.168.5.100",
"ttl" : "1m51s564ms",
"type" : "dynamic"
}
],
"total_sessions" : 1
}
Response parameters in L4xNAT farms
The response will be a JSON with object backends and sessions:
Backend object:
Field | Type | Description |
---|---|---|
established | Number | The total number of currently established connections. |
id | Number | Backend unique identifier. |
ip | String | IP where the real service is listening. |
pending | Number | Number of pending connections. |
port | Number | Port where the real service is listening. |
status | String | Backend status. The possible values are: up, the farm is running and the backend is ready to receive connections; down, the farm is running and the service has detected that the backend is not working; maintenance, backend is marked as not ready for receiving connections by the administrator, this option is useful for backend’s maintenance tasks; undefined, the backend status has been not checked. |
Session object:
Field | Type | Description |
---|---|---|
client | Number | Session secuential identifier. |
id | Number | Backend unique identifier where the client is assigned. |
session | String | Session unique identifier. It is the client IP. |
type | String | Values are: static or dynamic. Static if the session was made manually and dynamic if the session was made automatically. |
ttl | String | From version 4.0.2. Time remaining until the session ends |
backend_ip | String | From version 4.0.2. Backend ip assigned to the client. |
backend_port | Number | From version 4.0.2. Backend port assigned to the client. |
Response parameters in datalink farms
Datalink farms statistics is not available actually.
Show module status
Show module status
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats/farms/modules
GET /stats/farms/modules
Get a summary of statistic modules. This call shows each module status, the number of configured, the number of farms put down and up.
The definition of modules is in Farms section.
Response example:
{
"description" : "Module status",
"params" : {
"dslb" : {
"critical" : 0,
"down" : 1,
"problem" : 0,
"total" : 2,
"up" : 1
},
"gslb" : {
"critical" : 0,
"down" : 0,
"problem" : 0,
"total" : 1,
"up" : 1
},
"lslb" : {
"critical" : 0,
"down" : 2,
"problem" : 0,
"total" : 4,
"up" : 2
}
}
}
Response parameters
The response will be a JSON with three keys: dslb, gslb and lslb.
Field | Type | Description |
---|---|---|
critical | Number | Number of farms in critical status. The farm is critical when it is up and all backends are unreachable (down or maintenance). |
down | Number | Number of stopped farms. The farms are stopped by the system administrator. |
problem | Number | Number of farms in problem status. The farm is a problem when it is up and almost a backend is in down status. |
total | Number | Number of total farms. |
up | Number | Number of running farms. Here is displayed maintenance and need to restart farm status. |
Show module statistics
Show module statistics
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/stats/farms/modules/lslb
GET /stats/farms/modules/<module>
Show farm statistics of a specified module.
The available values for the module parameter are: lslb, gslb or dslb.
Response example:
{
"description" : "List lslb farms stats",
"farms" : [
{
"established" : 0,
"farmname" : "newfarm",
"pending" : 0,
"profile" : "http",
"status" : "up",
"vip" : "192.168.100.199",
"vport" : "40"
},
{
"established" : 0,
"farmname" : "nwl4farm",
"pending" : 0,
"profile" : "l4xnat",
"status" : "down",
"vip" : "192.168.100.241",
"vport" : "88"
},
{
"established" : 0,
"farmname" : "l4farm",
"pending" : 0,
"profile" : "l4xnat",
"status" : "up",
"vip" : "192.168.100.102",
"vport" : "70"
}
]
}
Response parameters
The response will be a JSON object with information about farms in the module.
Field | Type | Description |
---|---|---|
established | Number | The total number of currently established connections. |
farmname | String | Farm name, a unique identifier for farms. |
pending | Number | Number of pending connections. |
profile | String | Type of farm. The possible values are: datalink, l4xnat, http, https or gslb. Each profile is defined themselves section. |
status | String | Farm status. The available status values are: down, the farm is not running; needed restart, the farm is up but it is pending of a restart action; critical, the farm is up and all backends are unreachable or maintenance; problem, the farm is up and there are some backend unreachable, but almost a backend is in up status; maintenance, the farm is up and there are backends in up status, but almost a backend is in maintenance mode; up, the farm is up and all the backends are working success. |
vip | String | IP of the farm, where the virtual service is listening. |
vport | String | Port of the farm, where the virtual service is listening. |
Monitoring - Graphs
This section is useful to monitor the internal load balancer system to detect problems through the parameters of CPU usage, swap memory, RAM, all configured network interfaces, load and hard disk storage.
Also, you’ll be able to access the weekly, monthly and yearly history.
Graphs with information are responded in the base64 format.
List available graphs
List available graphs
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/graphs
GET /graphs
Show an object with all available graphs in the system. It shows the possible request that can be made.
Response example:
{
"description" : "These are the possible graphs, you`ll be able to access to the daily, weekly, monthly or yearly graph",
"farms" : [
"l4farm",
"newfarm",
"gslbfarm",
"nwl4farm",
"httpweb"
],
"interfaces" : [
"eth0.1",
"eth2",
"eth1",
"eth3",
"bondiface",
"eth0"
],
"system" : [
"cpu",
"load",
"ram",
"swap",
{
"disk" : [
"root/",
"root/boot",
"root/usr/local/zenloadbalancer/config",
"root/var/log"
]
}
]
}
Response parameters
The response will be a JSON three types of graphs, farms, interfaces and system.
Field | Type | Description |
---|---|---|
farms | String[] | List of farm graphs available. |
interfaces | String[] | List of interface graphs available. |
system | Object[] | List of system graphs available. The array has an object with an array wich indicates disk mount points. |
System object:
The system object contains an array list related to the system and a disk objects with the next format.
Field | Type | Description |
---|---|---|
disk | String[] | The values of this array are all existing mount points in the system, each one has available graphs. |
Show graphs
Show graphs
Request example for a farm:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/graphs/farms/httpweb
Request example for an interface:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/graphs/interfaces/eth3
Request example for a disk:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/graphs/system/disk/root/boot
GET /graphs/<graph>
The available values for graph are:
Value | Description |
---|---|
farms/<farmname> |
farmname, farm unique identifier. |
interfaces/<interface> |
interface, interface unique identifier. |
system/<system> |
system, possible system graphs are: cpu, load, ram or swap. |
system/disk/<mount point> |
mount point, is a value of disk object, returned by ‘GET /graphs’ call. |
Response example:
{
"description" : "Get cpu graphs",
"graphs" : [
{
"frequency" : "daily",
"graph" : "PNG IN BASE 64"
},
{
"frequency" : "weekly",
"graph" : "PNG IN BASE 64"
},
{
"frequency" : "monthly",
"graph" : "PNG IN BASE 64"
},
{
"frequency" : "yearly",
"graph" : "PNG IN BASE 64"
}
]
}
Response parameters
Field | Type | Description |
---|---|---|
frequency | String | Period used to generate the graph. The possible values are: daily, weekly, monthly or yearly. |
graphs | String | Graph in base64 format. |
Show frequency graph
Show frequency graph
Request example for a farm:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/graphs/farms/httpweb/daily
Request example for an interface:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/graphs/interfaces/eth3/monthly
Request example for a disk:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/graphs/system/disk/root/boot/yearly
GET /graphs/<graph>/<frequency>
The available values for graph are:
Value | Description |
---|---|
farms/<farmname> |
farmname, farm unique identifier. |
interfaces/<interface> |
interface, interface unique identifier. |
system/<system> |
system, possible system graphs are: cpu, load, ram or swap. |
system/disk/<mount point> |
mount point, is a value of disk object, returned by 'GET /graphs’ call. |
The available values for frequency are:
Field | Type | Description |
---|---|---|
frequency | String | Period used to generate the graph. The possible values are: daily, weekly, monthly or yearly. |
Response example:
{
"description" : "Get farm graphs",
"graph" : "PNG IN BASE 64"
}
Response parameters
Field | Type | Description |
---|---|---|
graphs | String | Graph in base64 format. |
IPDS
This module is the implementation of an IPS (Intrusion Prevention System) and IDS (Intrusion Detection System) system for offering to the user a security layer. IPDS module inspects the traffic just before to reach the Load Balancing modules LSLB or GSLB, if the traffic is detected as malicious then it will be rejected.
It works applying security rules to the system which will be defined as an object of different natures. Each one offers a solution for external malicious or suspicious activity. This tool helps system administrators controlling threats and attacks.
The available rules to apply to Zevenet can be blacklists, DoS, RBL or WAF.
Retrieve IPDS package
Retrieve IPDS package
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/package
zcli ipds-package get
GET /ipds/package
Retrieve the zevenet-ipds package information. This package contains updated rules for each IPDS module.
Response example:
{
"description" : "zevenet-ipds package status info",
"params" : {
"frequency" : 0,
"mode" : "disabled",
"ruleset_date" : "05-06-2019",
"scheduled" : "none",
"status" : "Updates available",
"time" : {
"hour" : 0,
"minute" : 0
}
}
}
Response parameters
The response will be a JSON object with a key set to params, its value will be the information of the IPDS package.
Field | Type | Description |
---|---|---|
status | String | Shows the update status information about the IPDS package. If the package is installed, if it is updated and if there are pending updates. |
ruleset_date | String | It is the date when the package was built. It is not the installed date. |
scheduled | String | Descriptive message explains the schedule configuration. |
mode | String | It indicates how often the update will happen or to disable the schedule. The available values are: Daily Schedule the update to be done each day, it enables the Frequency field to indicate how many hours will the update be repeated, from the time set; Weekly, Schedule the update to be done once a week, it enables the frequency as Day of the week to indicate which day of the week will the update be scheduled (from Monday to Sunday); monthly, schedule the update to be done once a month. |
frequency | Number | If mode is daily, frequency is the number of hours between package update from time; If mode is weekly, the expected value is the number weekday (from Monday, 1, to Sunday, 7); If mode is monthly, the expected value is the number month day (from 1 to 31). |
time | Object | Allows to set at which time will the update occur or from which time will the package be updated if the mode is set as Daily and Frequency is greater than 0. |
Time object:
This object, hour:minute, is the hour when the package will be updated.
Field | Type | Description |
---|---|---|
hour | Number | Is the hour in format form 0 to 23. |
minute | Number | are the minutes in format form 0 to 59. |
Apply an action to IPDS package
Apply an action to IPDS package
Request example for updating the IPDS rules:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>" -H 'Content-Type: application/json'
-d '{"action":"upgrade"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/package/actions
zcli ipds-package upgrade
Response example:
{
"desc" : "Execute an action over the zevenet-ipds package",
"params" : {
"ruleset_date" : "07-06-2019",
"status" : "Installed and updated"
}
}
Request example for scheduling updates:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>" -H 'Content-Type: application/json'
-d '{"mode":"daily","frequency":1,"time":{"hour":0,"minute":0},"action":"schedule"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/package/actions
Response example:
{
"desc" : "Execute an action over the zevenet-ipds package",
"params" : {
"frequency" : 1,
"mode" : "daily",
"scheduled" : "daily from 0:00 to 23:00 each 1 hours",
"status" : "Installed and updated",
"time" : {
"hour" : 0,
"minute" : 0
}
}
}
POST /ipds/package
Apply action about the zevenet-ipds package.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
action | String | It is the action to apply regarding the IPDS rules package. The options are: upgrade to force an upgrade of the package. schedule to configure the system upgrades the package with a periodicity. | |
mode | String | It indicates how often the update will happen or to disable the schedule. The available values are: Daily Schedule the update to be done each day, it enables the Frequency field to indicate how many hours will the update be repeated, from the time set; Weekly, Schedule the update to be done once a week, it enables the frequency as Day of the week to indicate which day of the week will the update be scheduled (from Monday to Sunday); monthly, schedule the update to be done once a month. | |
frequency | Number | If mode is daily, frequency is the number of hours between package update form time; If mode is weekly, the expected value is the number weekday (from Monday, 1, to Sunday, 7); If mode is monthly, the expected value is the number month day (from 1 to 31). | |
time | Object | Allows to set at which time will the update occur or from which time will the package be updated if the mode is set as Daily and Frequency is greater than 0. |
Time object:
This object, hour:minute, is the hour when the package will be updated.
Field | Type | Description |
---|---|---|
hour | Number | Is the hour in format form 0 to 23. |
minute | Number | are the minutes in format form 0 to 59. |
Response parameters
The response will be a JSON object with a key set to params. The value of this will be the information about the IPDS package.
Field | Type | Description |
---|---|---|
status | String | Shows the update status information about the IPDS package. If the package is installed, if it is updated and if there are pending updates. |
ruleset_date | String | It is the date when the package was built. It is not the installed date. |
scheduled | String | Descriptive message explains the schedule configuration. |
mode | String | It indicates how often the update will happen or to disable the schedule. The available values are: Daily Schedule the update to be done each day, it enables the Frequency field to indicate how many hours will the update be repeated, from the time set; Weekly, Schedule the update to be done once a week, it enables the frequency as Day of the week to indicate which day of the week will the update be scheduled (from Monday to Sunday); monthly, schedule the update to be done once a month. |
frequency | Number | If mode is daily, frequency is the number of hours between package update from time; If mode is weekly, the expected value is the number weekday (from Monday, 1, to Sunday, 7); If mode is monthly, the expected value is the number month day (from 1 to 31). |
time | Object | Allows to set at which time will the update occur or from which time will the package be updated if the mode is set as Daily and Frequency is greater than 0. |
Time object:
This object, hour:minute, is the hour when the package will be updated.
Field | Type | Description |
---|---|---|
hour | Number | Is the hour in format form 0 to 23. |
minute | Number | are the minutes in format form 0 to 59. |
List all IPDS rules
List ipds rules
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds
zcli ipds list
GET /ipds
List all IPDS rules that exist in the system.
Response example:
{
"description" : "List the available IPDS rules.",
"params" : [
{
"name" : "dosrst",
"rule" : "dos",
"type" : "farm"
},
{
"name" : "ssh_brute_force",
"rule" : "dos",
"type" : "system"
},
{
"name" : "geo_IL_israel",
"rule" : "blacklist"
},
{
"name" : "geo_ME_montenegro",
"rule" : "blacklist"
},
{
"name" : "sip",
"rule" : "rbl"
},
{
"name" : "ssh",
"rule" : "rbl"
}
]
}
Response parameters
The response will be a JSON object with a key set to params. The value of this will be an array of blacklist objects, each of which contains the key attributes below.
Field | Type | Description |
---|---|---|
name | String | IPDS rule name. It is used as a unique identifier. |
rule | String | It is the nature of the IPDS rule. It can be blacklist, dos or rbl. |
type | String | This field appears in dos rules and it defines if the rule is system, it applies to balancer; or farm, the rules apply to a farm. |
IPDS - Blacklists
Blacklists lets users use lists to filter or allow traffic according to source IPs (Incoming traffic).
There are two types of lists:
- Remotes: Lists are obtained from a URL, those lists are not modifiable and can be scheduled to be downloaded.
- Local: Users can create their lists with a given policy, deny if the incoming IP matches then the traffic will be rejected or allow if the incoming IP matches then the traffic will be allowed.
This module includes preloaded lists provided by Zevenet team, the list is ready to be applied to farms. Additionally, users can create their personalized lists.
Several lists can be applied to the same farm if the source IP matches in some of the lists the traffic will be allowed or denied depending on the blacklist policy. At the moment the IP matches then no more blacklist checks are done to the source IP.
If a source IP is in two different lists, one of type deny and the other of type allow, then always the allow policy is evaluated first.
List all blacklists rules
List all blacklists
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists
zcli ipds-blacklist list
GET /ipds/blacklists
List all blacklists created by the user or preloaded in the system that can be applied to the farms.
Response example:
{
"description" : "Get black lists",
"params" : [
{
"farms" : [],
"name" : "china",
"policy" : "deny",
"preload" : "true",
"status" : "down",
"type" : "local"
},
{
"farms" : [],
"name" : "russia",
"policy" : "deny",
"preload" : "true",
"status" : "down",
"type" : "local"
},
{
"farms" : [],
"name" : "northkorea",
"policy" : "deny",
"preload" : "true",
"status" : "down",
"type" : "local"
},
{
"farms" : [
"FarmHttp1",
"FarmGslb1",
],
"name" : "remoteList",
"policy" : "deny",
"preload" : "false",
"status" : "up",
"type" : "remote"
},
{
"farms" : [],
"name" : "myWhiteList",
"policy" : "allow",
"preload" : "false",
"status" : "down",
"type" : "local"
},
]
}
Response parameters
The response will be a JSON object with a key set to params. The value of this will be an array of blacklist objects, each of which contains the key attributes below.
Field | Type | Description |
---|---|---|
farms | String[] | Farms list where the blacklist is applied. |
name | String | Blacklist name. It is used as a unique identifier. |
policy | String | Action to apply to the source. The options are: deny, block the input traffic from sources of the list; or allow accept the traffic from sources of the list. |
preload | String | The possible values are: true, the blacklist has been preloaded in the system; or false, the blacklist has been created by the system administrator. |
status | String | The possible values are: up, the blacklist is activated and blocking (or allowing) traffic of sources form the list; or down, actually the rule is not running and it is not filtering traffic. |
type | String | Where the list is saved and who maintains it. The values are: local, the list is saved in the local system and can be modified locally, or remote, the list is downloaded from the remote source through a url, It can’t be modified locally so the modifications need to be taken in the remote source. |
Retrieve a blacklist rule
Retrieve blacklist
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/loc
zcli ipds-blacklist get loc
GET /ipds/blacklists/<name>
Show the blacklist configuration and description parameters. name is the blacklist unique identifier.
Response parameters
Response local list example:
{
"description" : "Get list loc",
"params" : {
"farms" : [],
"name" : "loc",
"policy" : "deny",
"preload" : "false",
"sources" : [
{
"id" : 0,
"source" : "192.168.0.167"
},
{
"id" : 1,
"source" : "192.168.0.186"
}
],
"status" : "up",
"type" : "local"
}
}
Local blacklist object:
Field | Type | Description |
---|---|---|
farms | String[] | Farms list where the blacklist is applied. |
name | String | Blacklist name. It is used as a unique identifier. |
policy | String | Action to apply to a source. The options are: deny, block the input traffic from sources of the list; or allow accept the traffic from sources of the list. |
preload | String | The possible values are: true, the blacklist has been preloaded in the system; or false, the blacklist has been created by the system administrator. |
status | String | The possible values are: up, the blacklist is activated and blocking (or allowing) traffic of sources form the list; or down, actually the rule is not running and it is not filtering traffic. |
type | String | Where the list is saved and who maintains it. The values are: local, the list is saved in the system and maintained by the system administrator; or remote, the list is downloaded from a remote URL. |
sources | Object[] | List of IPs that the list checks. Source network format accepted: Network address/Mask bit or IP |
Response remote list example:
{
"description" : "Get list remoteList",
"params" : {
"day" : "thursday",
"farms" : [
"FarmHttp1",
"FarmGslb1",
],
"frequency" : "weekly",
"name" : "remoteList",
"policy" : "deny",
"sources" : [
{
"id" : 0,
"source" : "78.12.0.4"
},
{
"id" : 1,
"source" : "68.100.15.5"
},
{
"id" : 2,
"source" : "65.12.12.95"
}
],
"time" : {
"hour" : 0,
"minutes" : 0
},
"status" : "up",
"update_status" : "This list isn't downloaded yet.",
"type" : "remote",
"url" : "http://192.168.10.10/lists/test.txt"
}
}
Remote blacklist object:
Field | Type | Description |
---|---|---|
farms | String[] | Farms list where the blacklist is applied. |
name | String | Blacklist name. It is used as a unique identifier. |
policy | String | Action to apply to a source. The options are: deny, block the input traffic from sources of the list; or allow accept the traffic from sources of the list. |
preload | String | The possible values are: true, the blacklist has been preloaded in the system; or false, the blacklist has been created by the system administrator. |
type | String | Where the list is saved and who maintains it. The values are: local, the list is saved in the system and maintained by the system administrator; or remote, the list is downloaded from a remote url. |
sources | Object[] | Source IPs that list checks. If the list is of type remote then the list content is not shown until the first download. |
update_status | String | Status of the last download of the list and date of the last successful update in the local system. |
url | String | Where the remote list is downloaded from. The remote format must be a list of one source network/bitmask or IP per line. |
frequency | String | Remote list update frequency. The options are: daily, update all days, once or periodically, this is indicated in frequency_type field; weekly, update once in a week; or monthly, update once in a month. |
frequency_type | String | This parameter completes the frequency daily when its value is daily. The possible values are: exact. define an hour in the day; or period, define a period time to update during the day. |
day | String or Number | This parameter completes the parameter frequency when frequency value is weekly or monthly. If frequency is weekly this parameter must be a day of the week (monday, tuesday, wednesday, thursday, friday, saturday or sunday) if frequency value is monthly then this parameter must be a day of the month (a number between 1 and 31). |
time | Object | It’s a struct which depends on the fields frequency. |
status | String | The possible values are: up, the blacklist is activated and blocking (or allowing) traffic of sources form the list; or down, actually the rule is not running and it is not filtering traffic. |
Time object for daily frequency and period frequency_type
Field | Type | Description |
---|---|---|
period | Number | How often the list is updated. |
units | String | Period unit. The options are: minutes, indicate the list will be updated every configured minutes; or hours, the list will be updated every configured hours. |
Time object for other frequencies
Field | Type | Description |
---|---|---|
hour | Number | Hour to update the list. The value must be a number between 0 and 23. |
minutes | Number | Minutes to update the list. The value must be a number between 0 and 59. |
Sources object
Field | Type | Description |
---|---|---|
id | Number | Source unique identifier in the list. |
source | String | IP addresses or net segments that the list checks. |
Create a blacklist rule
Create a new blacklist
Request example for a local list:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>" -H 'Content-Type: application/json'
-d '{"name":"newListLoc", "type":"local", "policy":"allow"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists
ipds-blacklist create -name newListLoc -type local -policy allow
Request example for a remote list:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>" -H 'Content-Type: application/json'
-d '{"name":"newListRem", "type":"remote", "url":"https://192.168.10.12/lists/test.txt"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists
POST /ipds/blacklists
Create a blacklist to be used in the farms. Blacklists can be of two types:
- Local: The sources are added by the user. The list is saved locally.
- Remote: The sources are obtained from a remote location. This location is indicated by a URL. The remote list format supported is one Network address/Mask bit or IP line per line.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
name | String | Blacklist name. It is used as a unique identifier. | true |
type | String | Where the list is saved and who maintenances it. The values are: local, the list is saved in system and maintenance for administration system; or remote, the list is taken from an out service through a url and the administrator’s service will maintenance the list. | true |
policy | String | Action to apply to a source. The options are: deny, block the input traffic from sources of the list; or allow accept the traffic from sources of the list. The default value is denied. | |
url | String | Where the remote list is downloaded from. The remote format must be a list of one source per line in the format Network address/Mask bit or IP. | true for the remote list |
{
"description" : "Post list list1",
"params" : {
"farms" : [],
"name" : "newListLoc",
"policy" : "deny",
"preload" : "false",
"type" : "local"
}
}
Response parameters
The response will be a JSON object with a key set to params. The value of this will be an array of blacklist objects, each of which contains the next key attributes.
Field | Type | Description |
---|---|---|
farms | String[] | Farms list where the blacklist is applied. |
name | String | Blacklist name. It is used as a unique identifier. |
policy | String | Action to apply to a source. The options are: deny, block the input traffic from sources of the list; or allow accept the traffic from sources of the list. |
preload | String | The possible values are: true, the blacklist has been preloaded in the system; or false, the blacklist has been created for the system administrator. |
type | String | Where the list is saved and who maintenances it. The values are: local, the list is saved in system and maintenance for administration system; or remote, the list is taken from an out service through a url and the administrator’s service will maintenance the list. |
Modify a blacklist rule
Modify a blacklist
Request example for a local list:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"policy":"allow","source":["78.12.0.4","68.100.15.5","65.12.12.95"]}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/whiteList
zcli ipds-blacklist set whiteList -policy allow
PUT /ipds/blacklists/<name>
Modify the configuration of a blacklist rule. name is the blacklist unique identifier.
Request parameters for a local list:
Field | Type | Description |
---|---|---|
name | String | Blacklist name. It is used as a unique identifier. Only it is modifiable on no preload lists. |
policy | String | Action to apply to a source. The options are: deny, block the input traffic from sources of the list; or allow accept the traffic from sources of the list. |
source | String[] | It is a list of IP addresses or net segments that the list checks. To change only a source please see documentation section IPDS > Blacklists > Modify a source of a blacklist. Sources only are modifiable on no preload lists. |
Response example:
{
"description" : "Modify list whiteList.",
"params" : {
"name" : "whiteList",
"policy" : "allow",
"preload" : "false",
"type" : "local"
}
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Request example for a remote list:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"name":"remoteList","url":"http://192.168.10.10/lists/test.txt","policy":"deny","frequency":"daily","frequency_type":"exact","time":{"hour":1,"minutes":0}}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/newListRem
Request example for updating a list each 2 hours:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"frequency":"daily","frequency_type":"period","time":{"period":2,"units":"hours"}}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/newListRem
Request example for updating a list all days at 2:00 AM:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"frequency":"daily","frequency_type":"exact","time":{"hour":2,"minutes":0}}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/newListRem
Request example for updating all mondays at 0:00 AM:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"frequency":"weekly","day":"monday","time":{"hour":0,"minutes":0}}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/newListRem
Request example for updating the day 1 of the month at 12:00 PM:
curl -k -X PUT -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"frequency":"monthly","day":"1","time":{"hour":12,"minutes":0}}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/newListRem
Request parameters for a remote list
Field | Type | Description |
---|---|---|
farms | String[] | Farms list where the blacklist is applied. |
name | String | Blacklist name. It is used as a unique identifier. |
policy | String | Action to apply to a source. The options are: deny, block the input traffic from sources of the list; or allow accept the traffic from sources of the list. |
url | String | Where the remote list is downloaded from. |
frequency | String | Remote list update frequency. The options are: daily, update all days, once or period, this is indicated in frequency_type field; weekly, update once in a week; or monthly, update once in a month. |
frequency_type | String | This parameter completes the frequency daily when its value is daily. The possible values are: exact. define an hour in the day; or period, define a period time to update during the day. |
day | String or Number | This parameter completes the frequency when its value is weekly or monthly. If it is weekly this parameter must be a weekday (monday, tuesday, wednesday, thursday, friday, saturday or sunday) else if frequency is monthly then this parameter must be a month day (number between 1 and 31). |
time | Object | It’s a struct which depends on the fields frequency. |
Time period object
These are the fields when a period will be configurated.
It is neccessary configurating frequency with the value daily, and frequency_type with the value period.
Field | Type | Description |
---|---|---|
period | Number | How often to update the list. |
unit | String | Period unit. The options are: minutes or hours, indicate the unit of measurement for the list updates. |
Time exact hour object
These are the fields when an exact hour time will be configurated.
This object is used with the next configurations:
frequency field has the value daily and frequency_type is exact.
frequency field has the value weekly and day is the weekday when the list updates.
frequency field has the value monthly and day is the number of day month when the list updates.
Field | Type | Description |
---|---|---|
hour | Number | Hour to update the list. The value must be a number between 0 and 23. |
minutes | Number | Minutes to update the list. The value must be a number between 0 and 59. |
Response example:
{
"description" : "Modify list newListRem.",
"params" : {
"day": 1,
"frequency" : "monthly",
"name" : "newListRem",
"policy" : "deny",
"preload" : "false",
"time" : {
"hour" : 12,
"minutes" : 0
},
"type" : "remote",
"update_status" : "Sync fail. Last update: 2017-02-16 14:23:00",
"url" : "https://192.168.10.12/lists/test.txt"
}
}
Response parameters
The response will be a JSON with all list configuration. See the response example for more information.
Delete a blacklists rule
Delete a blacklists list
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/remoteList
zcli ipds-blacklist delete remoteList
DELETE /ipds/blacklists/<name>
Delete a given blacklist. name is the blacklist unique identifier.
Response example:
{
"description" : "Delete list 'remoteList'",
"message" : "The list remoteList has been deleted successful.",
"success" : "true"
}
List of sources of a blacklist
List source from a blacklist
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/localList/sources
zcli ipds-blacklist get localList
GET /ipds/blacklists/<name>/sources
List sources of a blacklist. name is the blacklist unique identifier.
Response example:
{
"description" : "Get localList sources",
"params" : [
{
"id" : 0,
"source" : "78.12.0.4"
},
{
"id" : 1,
"source" : "68.100.15.5"
},
{
"id" : 2,
"source" : "65.12.12.95"
}
]
}
Response parameters
The response will be a JSON with the key params and source object array as value.
Source object:
Field | Type | Description |
---|---|---|
id | Number | Source unique identifier in the list. |
source | String[] | IP addresses or net segments that the list checks. |
Add sources to a blacklist
Add a source to a blacklist
Request example:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>" -H 'Content-Type: application/json'
-d '{"source":"192.168.3.1"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/localList/sources
zcli ipds-blacklist-source add localList -source 192.168.3.1
Request example for batching:
curl -k -X POST -H "ZAPI_KEY: <ZAPI_KEY_STRING>" -H 'Content-Type: application/json'
-d '{"source":["192.168.3.1", "22.2.32.7"]}'
https://<zevenet_server>:444/zapi/v4.1/zapi.cgi/ipds/blacklists/localList/sources
zcli ipds-blacklist-source add localList -source 192.168.3.1,22.2.32.7
POST /ipds/blacklists/<name>/sources
Push a new source to a blacklist. Only available for local lists and non-preloaded lists. name is the blacklist unique identifier.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
source | String or String[] | IP address or network segment that the list checks. | true |
Response example:
{
"description" : "Post source to localList.",
"message" : "Added 192.168.3.1 successful.",
"params" : [
{
"id" : 0,
"source" : "78.12.0.4"
},
{
"id" : 1,
"source" : "68.100.15.5"
},
{
"id" : 2,
"source" : "65.12.12.95"
},
{
"id" : 3,
"source" : "192.168.3.1"
}
]
}
Response parameters
The response will be a JSON with all requested values updated. See the response example for more information.
Modify a source of a blacklist
Modify a source of a blacklist
Request example:
curl -k -X PUT -H "ZAPI_KEY: <ZAPI_KEY_STRING>" -H 'Content-Type: application/json'
-d '{"source":"192.168.3.1"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/localList/sources/2
ipds-blacklist-source set localList 2 -source 192.168.3.1
PUT /ipds/blacklists/<name>/sources/<id>
Modify a source of a blacklist.
name is the blacklist unique identifier. id is the source unique identifier.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
source | String | IP address or network segment that the list checks. | true |
Response example:
{
"description" : "Put source into localList",
"message" : "Source 2 has been modified successful.",
"params" : {
"id" : 2,
"source" : "192.168.3.1"
}
}
Response parameters
The response will be a JSON with the source updated. See the response example for more information.
Delete a source of a blacklist
Delete a source of a blacklist
Request example:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/localList/sources/2
zcli ipds-blacklist-source remove localList 2
Request example for batching:
curl -k -X DELETE -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.1/zapi.cgi/ipds/blacklists/localList/sources/65.21.7.2,90.53.0.11/24,5.82.2.64
zcli ipds-blacklist-source remove localList 65.21.7.2,90.53.0.11/24,5.82.2.64
DELETE /ipds/blacklists/<name>/sources/<id>
Remove a source from a blacklist.
name is the blacklist unique identifier. id is the source unique identifier.
Response example:
{
"description" : "Delete source from the list localList",
"message" : "Source 2 has been deleted successful.",
"success" : "true"
}
Apply an action to a blacklist rule
Apply an action
Request example for a remote list:
curl -k -X POST -H 'Content-Type: application/json' -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
-d '{"action":"update"}'
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/blacklists/remoteList/actions
zcli ipds-blacklist update remoteList
POST /ipds/blacklists/<name>/actions
Apply an action to a blacklist. name is the blacklist unique identifier.
Request parameters
Field | Type | Description | Required |
---|---|---|---|
action | String | Action desired to apply to a blacklist rule. The available values are: start, it actives the blacklist in all farms where it is applied; stop, it stops the blacklist for all farm where the blacklist rule is applied, the traffic won’t be blocked or allowed; update, this action only can be applied to remote blacklists, this action updates the source list from the remote URL. | true |
Response example:
{
"description" : "Update a remote list",
"update" : "Sync OK. Last update: 2017-02-01 05:31:57"
}
Response parameters
The response will be a JSON with the download status. See the response example for more information.
Field | Type | Description | Required |
---|---|---|---|
update | String | Status of the last download of the list and date of the last successful update. |
IPDS - DoS
DoS set connection limits for sources or incoming throughtput in order to ensure the service is available and it is not overloaded. It can enforcement the TCP protocol, checking the traffic is coherent and it is not bogus. Before applying a rule to a farm, create an object with the configuration wished. Next, applied it to all the farms that you need it.
It is necessary to create an object before to apply a rule to a farm.
limitsec
Limit of new connection per second and source. Only available in farms working with TCP protocol.
Field | Type | Description |
---|---|---|
name | String | It is the object rule unique identifier. |
limit | Number | It is the maximum number of new connections per second for a source. |
limit_burst | Number | It is an allowed peak of new connections. A burst unit regenerates when “limit” seconds will pass. |
limitconns
Limit total current connections per source. Only available in farms working with TCP protocol.
Field | Type | Description |
---|---|---|
name | String | It is the object rule unique identifier. |
limit_conns | Number | It is the maximum number of current connection from a source. |
bogustcpflags
Check TCP protocol is respected. This rule has not got configuration parameters so creating only an object you will be able to use in all farms. Only available in farms working with TCP protocol.
Field | Type | Description |
---|---|---|
name | String | It is the object rule unique identifier. |
limitrst
Limit number of reset connection request per second. Only available in farms working with TCP protocol.
Field | Type | Description |
---|---|---|
name | String | It is the object rule unique identifier. |
limit | Number | It is the maximum number of reset requests per second for a source. |
limit_burst | Number | It is an allowed peak of reset request. A burst unit regenerates when “limit” seconds will pass. |
List all type of DoS rules
List all type of DoS rules
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/dos/rules
zcli ipds-dos list
GET /ipds/dos/rules
Show a list of DoS rules.
Each rule has different configuration parameters
Response example:
{
"description" : "Get DoS settings.",
"params" : {
"farm" : [
{
"description" : "Connection limit per seconds.",
"rule" : "limitsec"
},
{
"description" : "Total connections limit per source IP.",
"rule" : "limitconns"
},
{
"description" : "Check bogus TCP flags.",
"rule" : "bogustcpflags"
},
{
"description" : "Limit RST request per second.",
"rule" : "limitrst"
}
],
"system" : [
{
"description" : "SSH brute force.",
"rule" : "sshbruteforce"
},
]
}
}
Response parameters
The JSON response has two arrays farm and system. Each array item is a type of rule to apply to a farm o the system.
Field | Type | Description |
---|---|---|
description | String | Briefly description of the rule. |
rule | String | type rule unique identifier. |
List all DoS rules
List all DoS objects
Request example:
curl -k -X GET -H "ZAPI_KEY: <ZAPI_KEY_STRING>"
https://<zevenet_server>:444/zapi/v4.0/zapi.cgi/ipds/dos
zcli ipds-dos list
GET /ipds/dos
Show configuration about all existing DoS objects.
Response example:
{
"description" : "Get DoS settings.",
"params" : [
{
"farms" : [],
"limit_conns" : 10,
"name" : "limitConnHttp",
"rule" : "limitconns",
"status" : "down",
"type" : "farm"
},
{
"farms" : [],
"limit" : 2,
"limit_burst" : 2,
"name" : "limitUsers",
"rule" : "limitsec",
"status" : "down",
"type" : "farm"
},
{
"hits" : 5,
"name" : "ssh_brute_force",
"port" : 22,
"rule" : "sshbruteforce",
"status" : "down",
"time" : 180,
"type" : "system"
},
{
"farms" : [],
"name" : "tcpAuth",
"rule" : "bogustcpflags",
"status" : "down",
"type" : "farm"
},
{
"farms" : [],
"limit" : 2,
"limit_burst" : 2,
"name" : "dos4",
"rule" : "limitrst",
"status" : "down",
"type" : "farm"
},
]
}
Response parameters
The response will be an array of all available DoS objects.
Field | Type | Description |
---|---|---|
name | String | It is the object rule unique identifier. |
rule | String | It is the type rule identifier. |
type | String | The possible values are: farm, the rule applies to farms; or system, the rule applies to the system. |
status | String | The possible values are: up, the DoS |