Announcement

Collapse
No announcement yet.

Can 'lastlogsize' be changed by API?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Can 'lastlogsize' be changed by API?

    Hi, everyone.

    I tried to use 'item.update' method to set 'lastlogsize' to 0. However, it did not return an error, but the value did not change.

    Meanwhile, my zabbix's version is 2.2.14. I tried to do this on bash with curl. I think I can guarantee that I gave the right command, since I can change other values like 'descriptions' with equivalent command.

    Is this a bug? Has it been fixed in newer versions? Or is zabbix designed to behave like this.

    Could anyone help me with this please?
    Last edited by RogerQea; 07-12-2017, 03:40.

    #2
    additional information

    The following text is what shown on my shell when I tried to change "lastlogsize" and "description"; it can be clearly found that "description" has been successfully changed from "c1" to "c1test_writable", but "lastlogsize" is still "6923" not "0" . I hope this can provide some detail information and might be helpful. Is it really a bug? Should I ask this questions in the bug report session?


    [[email protected] ~]$ curl -i -X POST -H 'Content-Type:application/json' -d'{"jsonrpc":"2.0","method":"user.authenticate","p arams":{"user":"Admin","password":"zabbix"},"auth" :null,"id":0}' http://127.0.0.1:9820/zabbix/api_jsonrpc.php
    HTTP/1.1 200 OK
    Date: Thu, 07 Dec 2017 01:22:52 GMT
    Server: Apache
    X-Powered-By: PHP/5.5.14
    Transfer-Encoding: chunked
    Content-Type: application/json

    {"jsonrpc":"2.0","result":"f7d8fc8623ef5bf3bf72ec9 c65161a10","id":0}[[email protected] ~]$
    [[email protected] ~]$
    [[email protected] ~]$ curl -i -X POST -H 'Content-Type:application/json' -d'{"jsonrpc":"2.0","method":"item.get","params":{" output":"extend","search": {"key_":"log[/home/rogerqea/cluster/c1/log_test,,,,skip,]"}},"auth":"f7d8fc8623ef5bf3bf72ec9c65161a10","id" :0}' http://127.0.0.1:9820/zabbix/api_jsonrpc.php
    HTTP/1.1 200 OK
    Date: Thu, 07 Dec 2017 01:24:48 GMT
    Server: Apache
    X-Powered-By: PHP/5.5.14
    Transfer-Encoding: chunked
    Content-Type: application/json

    {"jsonrpc":"2.0","result":[{"itemid":"24579","type":"7","snmp_community":""," snmp_oid":"","hostid":"10115","name":"c1i","key_": "log[\/home\/rogerqea\/cluster\/c1\/log_test,,,,skip,]","delay":"2","history":"1","trends":"365","status ":"0","value_type":"2","trapper_hosts":"","units": "","multiplier":"0","delta":"0","snmpv3_securityna me":"","snmpv3_securitylevel":"0","snmpv3_authpass phrase":"","snmpv3_privpassphrase":"","formula":"1 ","error":"","lastlogsize":"6923","logtimefmt":"", "templateid":"0","valuemapid":"0","delay_flex":"", "params":"","ipmi_sensor":"","data_type":"0","auth type":"0","username":"","password":"","publickey": "","privatekey":"","mtime":"0","flags":"0","filter ":"","interfaceid":"0","port":"","description":"c1 ","inventory_link":"0","lifetime":"30","snmpv3_aut hprotocol":"0","snmpv3_privprotocol":"0","state":" 0","snmpv3_contextname":"","lastclock":"0","lastns ":"0","lastvalue":"0","prevvalue":"0"}],"id":0}[[email protected] ~]$
    [[email protected] ~]$ curl -i -X POST -H 'Content-Type:application/json' -d'{"jsonrpc":"2.0","method":"item.update","params" :{"itemid":"24579","lastlogsize":"0"},"auth":"f7d8 fc8623ef5bf3bf72ec9c65161a10","id":0}' http://127.0.0.1:9820/zabbix/api_jsonrpc.php
    HTTP/1.1 200 OK
    Date: Thu, 07 Dec 2017 01:30:48 GMT
    Server: Apache
    X-Powered-By: PHP/5.5.14
    Transfer-Encoding: chunked
    Content-Type: application/json

    {"jsonrpc":"2.0","result":{"itemids":["24579"]},"id":0}[[email protected] ~]$
    [[email protected] ~]$ curl -i -X POST -H 'Content-Type:application/json' -d'{"jsonrpc":"2.0","method":"item.update","params" :{"itemid":"24579","description":"c1test_writable" },"auth":"f7d8fc8623ef5bf3bf72ec9c65161a10","id":0 }' http://127.0.0.1:9820/zabbix/api_jsonrpc.php
    HTTP/1.1 200 OK
    Date: Thu, 07 Dec 2017 01:32:37 GMT
    Server: Apache
    X-Powered-By: PHP/5.5.14
    Transfer-Encoding: chunked
    Content-Type: application/json

    {"jsonrpc":"2.0","result":{"itemids":["24579"]},"id":0}[[email protected] ~]$
    [[email protected] ~]$ curl -i -X POST -H 'Content-Type:application/json' -d'{"jsonrpc":"2.0","method":"item.get","params":{" output":"extend","search": {"key_":"log[/home/rogerqea/cluster/c1/log_test,,,,skip,]"}},"auth":"f7d8fc8623ef5bf3bf72ec9c65161a10","id" :0}' http://127.0.0.1:9820/zabbix/api_jsonrpc.php
    HTTP/1.1 200 OK
    Date: Thu, 07 Dec 2017 01:34:10 GMT
    Server: Apache
    X-Powered-By: PHP/5.5.14
    Transfer-Encoding: chunked
    Content-Type: application/json

    {"jsonrpc":"2.0","result":[{"itemid":"24579","type":"7","snmp_community":""," snmp_oid":"","hostid":"10115","name":"c1i","key_": "log[\/home\/rogerqea\/cluster\/c1\/log_test,,,,skip,]","delay":"2","history":"1","trends":"365","status ":"0","value_type":"2","trapper_hosts":"","units": "","multiplier":"0","delta":"0","snmpv3_securityna me":"","snmpv3_securitylevel":"0","snmpv3_authpass phrase":"","snmpv3_privpassphrase":"","formula":"1 ","error":"","lastlogsize":"6923","logtimefmt":"", "templateid":"0","valuemapid":"0","delay_flex":"", "params":"","ipmi_sensor":"","data_type":"0","auth type":"0","username":"","password":"","publickey": "","privatekey":"","mtime":"0","flags":"0","filter ":"","interfaceid":"0","port":"","description":"c1 test_writable","inventory_link":"0","lifetime":"30 ","snmpv3_authprotocol":"0","snmpv3_privprotocol": "0","state":"0","snmpv3_contextname":"","lastclock ":"0","lastns":"0","lastvalue":"0","prevvalue":"0" }],"id":0}[[email protected] ~]$
    [[email protected] ~]$
    Last edited by RogerQea; 07-12-2017, 03:38.

    Comment

    Working...
    X