-
Notifications
You must be signed in to change notification settings - Fork 5
api utils
The following section would describe the API for the utils section of StorLever. The utils part of StorLever is to manage some common utility tools of the Linux System.
StorLever utils API has the following structure:
-
- 5 SNMP Agent Management
-
- 5.1 Get basic configuration
- 5.2 Set basic configuration
- 5.3 Get community list
- 5.4 Get a community configuration
- 5.5 Add community
- 5.6 Modify community
- 5.7 Delete community
- 5.8 Get trap sink list
- 5.9 Set trap sink list
- 5.10 Get monitor list
- 5.11 Get a monitor configuration
- 5.12 Add monitor
- 5.13 Modify monitor
- 5.14 Delete monitor
The following operations are used to manage NTP configuration of system.
This API is used to return all upper NTP server configuration which the local NTP server would connect to
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/ntp/server_list
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON list where its each entry is a JSON object describing one upper NTP server configuration
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/ntp/server_list
This API is used to set the upper NTP Server configuration
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/ntp/server_list
-
HTTP Method
PUT
-
Request Content
A JSON list where each entry is JSON object with the following definition:
Fields
Type
Optional
Meaning
server_addr
string
Required
The server address, it can be a ipv4 address, ipv6 address, or host DNS name
ipv6
bool
Optional
If set to True, it would be forced to resolve the host name to ipv6 address in DNS resolution. Default is false
prefer
bool
Optional
Marks the server as preferred. If all other things being equal, this host will be chosen for synchronization among set of correctly operating hosts. Default is false.
mode
int
Optional
Specifies a mode number which is interpreted in a device specific fashion. For instance, it selects a dialing, protocol in the ACTS driver and a device subtype in the parse drivers. Only valid for reference clock server, i.e. server_addr is 127.127.t.n. Default is 0
stratum
int
Optional
Specifies the stratum number assigned to the driver, an integer between 0 and 15. Only valid for reference clock server, i.e. server_addr is 127.127.t.n Default is 0
flag1
int
Optional
These four flags are used for customizing the clock driver. The interpretation of these values, and whether they are used at all, is a function of the particular clock driver. However, by convention flag4 is used to enable recording monitoring data to the clockstats file configured with the filegen command. Further information on the filegen command can be found in Monitoring Options. Only valid for reference clock server, i.e. server_addr is 127.127.t.n. The valid value is 0 or 1, default is 0.
flag2
int
Optional
The same
flag3
int
Optional
The same
flag4
int
Optional
The same
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
NULL
-
Example
curl -v -X PUT -H "Content-Type: application/json; charset=UTF-8" -d '[{"server_addr":"0.centos.pool.ntp.org", "prefer":true}]' http://192.168.1.15:6543/storlever/api/v1/utils/ntp/server_list
This API is used to retrieve all the restrict entries for the local NTP server, the restrict entry is used for access control.
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/ntp/restrict_list
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON list where its each entry is a JSON object describing one restrict configuration
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/ntp/restrict_list
This API is used to set the restrict list for the local NTP server, the restrict entry is used for access control.
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/ntp/restrict_list
-
HTTP Method
PUT
-
Request Content
A JSON list where each entry is JSON object with the following definition:
Fields
Type
Optional
Meaning
restrict_addr
string
Required
The restrict address, it can be a ipv4 address, ipv6 address, or "default"
ipv6
bool
Optional
If set to True, it would be forced to resolve the host name to ipv6 address in DNS resolution. Default is false
mask
string
Optional
mask the restrict_addr to indicate the network address. For ipv4, is xxx.xxx.xxx.xxx. for ipv6 is xxxx:xxxx:xxxx:: Default is empty, which is equal to 255.255.255.255
ignore
bool
Optional
Deny packets of all kinds, including ntpq and ntpdc queries. Default is false
nomodify
bool
Optional
Deny ntpq(8) and ntpdc(8) queries which attempt to modify the state of the server (i.e., run time reconfiguration). Queries which return information are permitted. Default is false.
noquery
bool
Optional
Deny ntpq(8) and ntpdc(8) queries. Time service is not affected. Default is false
noserve
bool
Optional
Deny all packets except ntpq(8) and ntpdc(8) queries. Default is false
notrap
bool
Optional
Decline to provide mode 6 control message trap service to matching hosts. The trap service is a subsystem of the ntpdq control message protocol which is intended for use by remote event logging programs
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
NULL
-
Example
curl -v -X PUT -H "Content-Type: application/json; charset=UTF-8" -d '[{"restrict_addr":"192.168.1.0", "mask":"255.255.255.0"}]' http://192.168.1.15:6543/storlever/api/v1/utils/ntp/restrict_list
This API is used to retrieve all the remote NTP server peer status which the local NTP server is communicating with
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/ntp/peer_list
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON list where its each entry is a JSON object describing one peer communication status
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/ntp/peer_list
The following operations are used to configure the email sending system (mailx) of system
This API is used to retrieve the configuration of the mail sending agent (mailx). Mail sending agent (mailx) is used to send the mail of the system warning info to administrator for other subsystem of system
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/mail/conf
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON object to describe the mail sending agent configuration.
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/mail/conf
This API is used to set the configuration of the mail sending agent (mailx).
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/mail/conf
-
HTTP Method
PUT
-
Request Content
A JSON object with the following field definition.
Fields
Type
Optional
Meaning
email_addr
string
Optional
The email address, like [email protected], from which the mail is sent. And it also be the username of your SMTP server. Default is unchanged
smtp_server
string
Optional
SMTP server address. AUTH LOGIN auth method is used
password
string
Optional
user's password for SMTP. Default is unchanged
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
NULL
-
Example
curl -v -X PUT -H "Content-Type: application/json; charset=UTF-8" -d '{"email_addr":"[email protected]", "smtp_server":"mail.company.com", "password":"bob"}' http://192.168.1.15:6543/storlever/api/v1/utils/mail/conf
This API is used to send a test email to verify whether mail configuration is correct or not
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/mail/send_mail
-
HTTP Method
POST
-
Request Content
A JSON object with the following field definition.
Fields
Type
Optional
Meaning
to
string
Required
The email address to send the mail
subject
string
Required
Email subject
content
string
Optional
mail' content. Default is empty
debug
bool
Optional
Enable debug mode or not. If enabled, the response would contain the debug message for sending this mail. Default is false
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON object to describe the debug output message for sending this mail.
-
Example
curl -v -X POST -H "Content-Type: application/json; charset=UTF-8" -d '{"to":"[email protected]", "subject":"test"}' http://192.168.1.15:6543/storlever/api/v1/utils/mail/send_mail
The following operations are used to configure the SMART (Self-Monitoring, Analysis and Reporting Technology) daemon in system
This API is used to retrieve all monitor configuration entries of SMARTD
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/smartd/monitor_list
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON list where its each entry is a JSON object describing one SMARTD monitor configuration
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/smartd/monitor_list
This API is used to set the monitor configuration list of SMARTD
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/smartd/monitor_list
-
HTTP Method
PUT
-
Request Content
A JSON list where each entry is JSON object with the following definition:
Fields
Type
Optional
Meaning
dev
string
Required
block device file path which would be SMART-enabled and monitor. The device must exist in system and support SMART
mail_to
string
Optional
the (e)mail address to which smartd would send when a error is detected. To send email to more than one user, please use the following "comma separated" form for the address: user1@add1, user2@add2,...,userN@addN (with no spaces). Default is empty
mail_test
bool
Optional
test the mail. if true, send a single test email immediately upon smartd startup. This allows one to verify that email is delivered correctly Default is false.
mail_exec
string
Optional
run the executable PATH instead of the default mail command. if this list is empty, smartd would run the default "/bin/mail" utility to send warning email to user in "mail_to" option. Otherwise, smartd would run the scripts in this option. See man smartd.conf for more detail. Default is empty
schedule_regexp
string
Optional
Run Self-Tests or Offline Immediate Tests, at scheduled times. A Self or Offline Immediate Test will be run at the end of periodic device polling, if all 12 characters of the string T/MM/DD/d/HH match the extended regular expression REGEXP. See man smartd.conf for detail. if this option is empty, no schedule test at all. Default is empty
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
NULL
-
Example
curl -v -X PUT -H "Content-Type: application/json; charset=UTF-8" -d '[{"dev":"/dev/sda", "mail_to":"[email protected]", "mail_test":true}]' http://192.168.1.15:6543/storlever/api/v1/utils/smartd/monitor_list
The following operations are used to configure the Zabbix (www.zabbix.com) agent
This API is used to retrieve the basic agent configure options in system
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/zabbix_agent/conf
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON object to describe the Zabbix agent basic configuration options.
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/zabbix_agent/conf
This API is used to set the basic configuration of the Zabbix agent.
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/zabbix_agent/conf
-
HTTP Method
PUT
-
Request Content
A JSON object with the following field definition.
Fields
Type
Optional
Meaning
hostname
string
Optional
used for active check, this name must match the hostname set in the active server. Default is unchanged. If it is empty, system default hostname would be used
refresh_active_check
int
Optional
How often list of active checks is refreshed, in seconds. Note that after failing to refresh active checks the next refresh will be attempted after 60 seconds. Valid range is 60~3600. Default is unchanged.
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
NULL
-
Example
curl -v -X PUT -H "Content-Type: application/json; charset=UTF-8" -d '{"hostname":"test_agent1"}' http://192.168.1.15:6543/storlever/api/v1/utils/zabbix_agent/conf
This API is used to retrieve active server address list of Zabbix agent.
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/zabbix_agent/active_server_list
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON list where its each entry is a address string of active server
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/zabbix_agent/active_server_list
This API is used to set the active server address list of Zabbix agent.
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/zabbix_agent/active_server_list
-
HTTP Method
PUT
-
Request Content
A JSON list where each entry is a IP address string of one active server. IP address format is IP:PORT, IP is also can be a DNS name.
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
NULL
-
Example
curl -v -X PUT -H "Content-Type: application/json; charset=UTF-8" -d '["192.168.1.20:7890"]' http://192.168.1.15:6543/storlever/api/v1/utils/zabbix_agent/active_server_list
This API is used to retrieve passive server address list of Zabbix agent.
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/zabbix_agent/passive_server_list
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON list where its each entry is a address string of active server
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/zabbix_agent/passive_server_list
This API is used to set the passive server address list of Zabbix agent. Passive server address is used to restrict which server can query/control Zabbix agent.
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/zabbix_agent/passive_server_list
-
HTTP Method
PUT
-
Request Content
A JSON list where each entry is a IP address string of one pasive server. IP address format is xxx.xxx.xxx.xxx, but also can be a DNS name.
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
NULL
-
Example
curl -v -X PUT -H "Content-Type: application/json; charset=UTF-8" -d '["192.168.1.20"]' http://192.168.1.15:6543/storlever/api/v1/utils/zabbix_agent/passive_server_list
The following operations are used to manage the SNMP agent, SNMP agent of StorLever only support SNMP 2/2c, not support SNMP 3
This API is used to retrieve the basic agent configure options for SNMP agent
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/conf
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON object to describe the SNMP agent basic configuration options.
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/conf
This API is used to set the basic configuration of the Zabbix agent.
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/conf
-
HTTP Method
PUT
-
Request Content
A JSON object with the following field definition.
Fields
Type
Optional
Meaning
sys_location
string
Optional
set the system location, system contact or system name (sysLocation.0, sysContact.0 and sysName.0). for the agent respectively. Ordinarily these objects are writeable via suitably authorized SNMP SET requests if these object are empty, However, specifying one of these directives makes the corresponding object read-only, and attempts to SET it will result in a notWritable error response. Default is unchanged
sys_contact
string
Optional
Described above
sys_name
string
Optional
Described above
agent_address
string
Optional
defines a list of listening addresses(separated by commas), on which to receive incoming SNMP requests. See the section LISTENING ADDRESSES in the snmpd(8) manual page for more information about the format of listening addresses. If it's empty, it would be the default address and port. Default is unchanged
iquery_sec_name
string
Optional
specifies the default SNMPv3 username, to be used when making internal queries to retrieve any necessary information (either for evaluating the monitored expression, or building a notification payload). These internal queries always use SNMPv3, even if normal querying of the agent is done using SNMPv1 or SNMPv2c. This option cannot be empty, default is unchanged
link_up_down_notifications
bool
Optional
monitor the interface link up and down. Default is unchanged
default_monitors
bool
Optional
enable the default monitors for system. Default is unchanged
load_max
float
Optional
system one minutes load max threshold for default load monitor, if it's 0, this monitor never report error. Default is unchanged
swap_min
int
Optional
swap space min threshold for default memory monitor, in kB
disk_min_percent
int
Optional
disk space min percent for the default disk usage monitor, 0 means never report error. Valid range is 0 ~ 99
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
NULL
-
Example
curl -v -X PUT -H "Content-Type: application/json; charset=UTF-8" -d '{"sys_name":"test_snmp_agent"}' http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/conf
This API is used to retrieve the community configuration list of SNMP agent
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/community_list
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON list with each entry is a JSON object describing one community configuration
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/community_list
This API is used to retrieve one community configuration info of SNMP agent
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/community_list/[community_name]
[community_name] is the name of the community to retrieve
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON object to describe this community configuration
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/community_list/abc
This API is used to add a new community to SNMP
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/community_list
-
HTTP Method
POST
-
Request Content
A JSON object with the following field definition.
Fields
Type
Optional
Meaning
community_name
string
Required
new community name, SNMP client, which access this agent, must match community name
ipv6
bool
Optional
if set to True, it would be forced to resolve the host name to ipv6 address in DNS resolution. Default is false
source
string
Optional
restrict access from the specified source. A restricted source can either be a specific hostname (or address), or a subnet-represented as IP/MASK (e.g. 10.10.10.0/255.255.255.0), or IP/BITS (e.g. 10.10.10.0/24), or the IPv6 equivalents. if it's empty, it would give access to any system, that means "global" range. Default is empty.
oid
string
Optional
this field restricts access for that community to the subtree rooted at the given OID. if it's empty, the whole tree would be access. Default is empty
read_only
bool
Optional
if set to true, this commnunity can only read the oid tree. Or, it can set the the oid tree. Default is false
-
Status Code
201 - Successful
Others - Error
-
Special Response Headers
The following response header would be added
Location: [community_url]
[community_url] is the URL to retrieve the new community info
-
Response Content
NULL
-
Example
curl -v -X POST -H "Content-Type: application/json; charset=UTF-8" -d '{"community_name":"abc"}' http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/community_list
This API is used to modify a community configuration of SNMP agent.
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/community_list/[community_name]
[community_name] is the name of the community to modify
-
HTTP Method
PUT
-
Request Content
A JSON object with the following field definition.
Fields
Type
Optional
Meaning
ipv6
bool
Optional
if set to True, it would be forced to resolve the host name to ipv6 address in DNS resolution. Default is unchanged
source
string
Optional
restrict access from the specified source. A restricted source can either be a specific hostname (or address), or a subnet-represented as IP/MASK (e.g. 10.10.10.0/255.255.255.0), or IP/BITS (e.g. 10.10.10.0/24), or the IPv6 equivalents. if it's empty, it would give access to any system, that means "global" range. Default is unchanged.
oid
string
Optional
this field restricts access for that community to the subtree rooted at the given OID. if it's empty, the whole tree would be access. Default is unchanged
read_only
bool
Optional
if set to true, this commnunity can only read the oid tree. Or, it can set the the oid tree. Default is unchanged
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
NULL
-
Response Content
NULL
-
Example
curl -v -X PUT -H "Content-Type: application/json; charset=UTF-8" -d '{"read_only": true, "oid":".1.3"}' http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/community_list/abc
This API is used to delete a community of SNMP agent
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/community_list/[community_name]
[community_name] is the name of the community to delete
-
HTTP Method
DELETE
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
NULL
-
Example
curl -v -X DELETE http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/community_list/abc
This API is used to retrieve all the trap sink configuration options of SNMP agent. When a trap is trigger at SNMP agent, a trap notification would be sent to each host on this list
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/trap_sink_list
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON list where its each entry is a JSON object describing one sink configuration
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/trap_sink_list
This API is used to set the trap sink list of SNMP agent
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/trap_sink_list
-
HTTP Method
PUT
-
Request Content
A JSON list where each entry is JSON object with the following definition:
Fields
Type
Optional
Meaning
host
string
Required
The host IP address
type
string
Optional
trap type, can only be set to trap/trap2/inform, which would send SNMPv1 TRAPs, SNMPv2c TRAP2s, or SNMPv2 INFORM notifications respectively. Default is trap
community
string
Optional
community name used by this sink, which must match the community setting of the remote host. Default is set to "public"
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
NULL
-
Example
curl -v -X PUT -H "Content-Type: application/json; charset=UTF-8" -d '[{"host":"192.168.1.12", "type":"trap2", "community":"test"}]' http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/trap_sink_list
This API is used to retrieve the monitor list of SNMP agent. Monitor is used to trigger SNMP trap of SNMP agent.
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/monitor_list
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON list with each entry is a JSON object describing one monitor configuration
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/monitor_list
This API is used to retrieve one monitor info of SNMP agent
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/monitor_list/[monitor_name]
[monitor_name] is the name of the monitor to retrieve
-
HTTP Method
GET
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
A JSON object to describe this monitor configuration
-
Example
curl -v -X GET http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/monitor_list/test_monitor
This API is used to add a new monitor to SNMP agent
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/monitor_list
-
HTTP Method
POST
-
Request Content
A JSON object with the following field definition.
Fields
Type
Optional
Meaning
monitor_name
string
Required
new monitor name
option
string
Optional
options to control the monitor's behavior, see monitor option section of man snmpd.conf for more detail. Default is empty
expression
string
Required
expression to check of this monitor, see monitor expression of man snmpd.conf for more detail
-
Status Code
201 - Successful
Others - Error
-
Special Response Headers
The following response header would be added
Location: [monitor_url]
[monitor_url] is the URL to retrieve the new monitor info
-
Response Content
NULL
-
Example
curl -v -X POST -H "Content-Type: application/json; charset=UTF-8" -d '{"monitor_name":"test_monitor", "expression":".1.3.4"}' http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/monitor_list
This API is used to modify a monitor of SNMP agent.
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/monitor_list/[monitor_name]
[monitor_name] is the name of the monitor to retrieve
-
HTTP Method
PUT
-
Request Content
A JSON object with the following field definition.
Fields
Type
Optional
Meaning
option
string
Optional
options to control the monitor's behavior, see monitor option section of man snmpd.conf for more detail. Default is unchanged.
expression
string
Optional
expression to check of this monitor, see monitor expression of man snmpd.conf for more detail. Default is unchanged
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
NULL
-
Response Content
NULL
-
Example
curl -v -X PUT -H "Content-Type: application/json; charset=UTF-8" -d '{"expression":".1.3.8"}' http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/monitor_list/test_monitor
This API is used to delete a monitor of SNMP agent
-
Resource URI
http://[host_ip]:[storlever_port]/storlever/api/v1/utils/snmp_agent/monitor_list/[monitor_name]
[monitor_name] is the name of the monitor to delete
-
HTTP Method
DELETE
-
Request Content
NULL
-
Status Code
200 - Successful
Others - Error
-
Special Response Headers
No
-
Response Content
NULL
-
Example
curl -v -X DELETE http://192.168.1.15:6543/storlever/api/v1/utils/snmp_agent/monitor_list/test_monitor