Rectangle 27 2

No, there seem to be a few things wrong. First, the Zabbix API is JSON-RPC (not REST). Second, the item.get method is primarily used to get item configuration from the server.

To request item values from an agent (and this is how remote commands are implemented with the system.run item key), you can use the already mentioned zabbix_get:

$ zabbix_get -s host-name -k "system.run[sudo systemctl stop nginx.service]"

Note that when you say "This works well for gathering data", you are not telling Zabbix to collect data at that point - it just returns you some data that is already in the database. In the case of remote commands, the best you could get would be "1" that indicates that last time this remote command was sent to the agent successfully.

Thank you! This is some useful information. But I'm not sure that I'm following - you say I can use zabbix_sender to request item values from an agent (so I can execute system.run as well, i guess?) but then you give an example with zabbix_get. Sorry for being slow, but I'm sincerely confused.

oops, sorry, mistyped the utility there - it should be zabbix_get everywhere. fixed.

Is it possible to execute system.run[] with Zabbix 3.0 JSON-RPC API? -...

json api json-rpc zabbix
Rectangle 27 0

I think you'll soon realize that expression won't solve your targeted behavior and will keep on flapping between PROBLEM and OK.

You have just shifted the 'did a -100 change occurred' check between 'the last and previous last' values to 'the last and the average of the last half an hour'.

Checking if either there was an abrupt change OR if the value is still too low will probably better mimic your expected scenario,

{monitoring:test.item.last(0)}>100 | {monitoring:test.item.max(#2)}<20

max(#2)<20 checks if the maximum of the last 2 values is bellow 20.

({monitoring:test.item.avg(1800)}<10 & {monitoring:test.item.avg(1800)}-{monitoring:test.item.last(0)}>20) | ({monitoring:test.item.avg(1800)}>100 & {monitoring:test.item.avg(1800)}-{monitoring:test.item.last(0)}>100)

This way, you'll better fit your trigger for the different volumes during the day.

I am actually working with the average for the last half-hour, not for the value posted half an hour ago. Also note that the values have greatly varying averages during different times of the day. Between 2 and 4 AM the average is about 5, while between 6 PM and 8 PM, the average goes as high as 376 units. I am trying not to have false alerts generated during off-peak hours because of the low values, that's why I am working with averages. As the day wears on, the graph goes up smoothly rather than sharply as a spike. The reverse is also true for when the graph is going up.

Zabbix trigger expression help sought - Stack Overflow

zabbix
Rectangle 27 0

If you can, then run VisualVm (probably using a tunneled X session) on the zabbix host, and see if you can connect to the target JVM with that. If you can't connect from that, you won't be able to connect from Zabbix.

Try with the following CATALINA_OPTS, replacing with the IP on the target that you want JMX to listen on:

export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=falseom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=<LOCAL_IP>"

Once you hopefully get it to connect, the "Tomcat JMX" items in Zabbix are also all incorrect! e.g.

jmx["Catalina:type=GlobalRequestProcessor,name=http-8080",bytesReceived]
jmx["Catalina:type=ThreadPool,name=\"http-bio-8080\"", bytesReceived]

Note the escaped quotes and incorrect thread name. Add the Mbeans plugin to VisualVM, and use that to browse the MBeans on the target VM, and check the Zabbix names.

It does work eventually, but is a real pain to setup. Zabbix is however one of the few open source monitoring tools that supports JMX at all!

Instead of installing VisualVm, I was able to connect using jconsole, which was already installed on my system. jconsole appears to a standard part of the JDK (source:en.wikipedia.org/wiki/JConsole).

Zabbix JMX Tomcat monitoring - Stack Overflow

zabbix
Rectangle 27 0

But you can use some workaround: 1.) zabbix_sender you script (bat file) implement your monitoring logic and collected metrics will be sent by zabbix_sender. These zabbix sender items must be Zabbix trapper type. You can send also many metrics in one go (see manual -i)

2.) save value into file your script will save all collected metrics into tmp file and then you have to create special items for parsing this tmp file. Key vfs.file.regexp is the best for this job:

vfs.file.regexp[/tmp/file.txt,^(\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ (\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ \w+ (\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ \w+ \w+ (\w+),,,,\1]
vfs.file.regexp[/tmp/file.txt,^\w+ \w+ \w+ \w+ (\w+),,,,\1]

3.) similar concept as 2nd one, but instead of file you will use shared memory it can be over engineering, but if you care about IOps.

I use https://gist.github.com/jangaraj/edc9dde939cbd577bbba for Raspberry Pi - system on SD card so I need to minimize IOPs. I'll store ping output into shared memory segment and then I'm parsing ping output from different items (ping.max, ping.avg, ping.min, ...)

Yes, you can use string, but how do you want to parse string into values then with Calculated items - again it's not possible. Zabbix doesn't provide suitable parsing (sub)string functions for calculated items.

You can do it using runcached (run cached) bitbucket.org/sivann/runcached/overview . It automates caching the command output and parsing different parts of it.

zabbix UserParameter return 2 or more values - Stack Overflow

zabbix
Rectangle 27 0

There are two main options:

  • use web.page.regexp[] item and put your string into the <regexp> parameter.

In both cases, you can make a trigger that will alert you if the string is not there.

monitor - Monitoring a website that contains a defined string with Zab...

string monitor zabbix
Rectangle 27 0

Zabbix server polls its agent according to frequency set in the template and brings and stores the value in database.When we click on graph it creates a graph from those values fetching them from database.You can specify the type of input whether you want percentage or decimal or integer in the template attached to the host.You can specify the time period for the graph and it will calculate the values for that specific period.The values are based on the values in database.

python - Zabbix 2.2 API get Processor load (1 min average) min/max val...

python zabbix
Rectangle 27 0

In time_from and time_till parameters, try using a Unix timestamp, like so:

>>> history = zapi.history.get({"itemids":"23297", "time_from":"1412370600", "time_till":"1412370601", "output":"extend" })
>>> print history

scripting - getting history from zabbix with python api - Stack Overfl...

python scripting zabbix
Rectangle 27 0

zapi = ZabbixAPI(server=server, log_level=debuglevel)
zapi.login(username, password)

hosts = zapi.host.get(output=["hostid", "name"])
print hosts
[{u'hostid': u'10084', u'name': u'Zabbix server'}]

Thanks, Jan! For anyone else reading, I switched from zabbix_api to pyzabbix to get the above to work.

python - zabbix api get all host names - Stack Overflow

python zabbix
Rectangle 27 0

You might want to look at the JMX Proxy servlet or write your own if the default one doesn't do what you want.

java - JMX Monitoring using Zabbix - Stack Overflow

java monitoring jmx zabbix
Rectangle 27 0

You are trying to guess what the problem is. Look at the agent's log, for execs (scripts) the answer is most probably there. If it isn't, disable the passive monitoring of this agent, enable full debug output (DebugLevel=4), then run the zabbix_get of the param and look again at the log. If it's still not there, then strace is your friend.

I've seen the logs of zabbix agent, it could not help because there was nothing exception... I'll try the debug mode~

monitoring - Why dose zabbix agent UserParameter not work when it is o...

monitoring zabbix
Rectangle 27 0

This has nothing to do with zabbix as you can clearly see. This is a "problem" with the server and not even with the "OS" but with the platform. What you describe seems to be some pseudo virtualization container like OpenVZ or some weird kernel patch. I try my best to avoid these so can't advice anything specific. But start from getting the information about the platform.

I agree that this is an OS issue. Unfortunately the budget hosting company this server runs on do not offer support ... you have to fix things for yourself. So far no one in the Zabbix forum has been able to answer ... I was hoping someone here would have come across this and can advise what I can do... surely if the data is available when I run as sudo then it should be a matter of changing settings... thanks anyway

start from checking for grsecurity, see if /proc/sys/kernel/grsecurity is there. show us uname -a

Thanks Michael. The output from uname -a is: Linux ns3097402.ip-91-zzz-zzz.eu 3.10.23-xxxx-grs-ipv6-64 #1 SMP Mon Dec 9 19:06:18 CET 2013 x86_64 x86_64 x86_64 GNU/Linux. And the directory "/proc/sys/kernel/grsecurity/" does exist

well, this seems like OVH. and -grs- is exactly that. the grsecurity patch. search how to disable access restrictions to the dev/net

I've been busy for a few days, but I think the answer lies here: en.wikibooks.org/wiki/Grsecurity/Appendix/ GRKERNSEC_PROC_GID Setting this GID determines which group will be exempted from grsecurity's /proc restrictions, allowing users of the specified group to view network statistics and the existence of other users' processes on the system. This GID may also be chosen at boot time via "grsec_proc_gid=" on the kernel commandline. I'll test it and come back...

zabbix agent no network data - unless sudo - Stack Overflow

zabbix
Rectangle 27 0

For instance, item zabbix[requiredperformance] will show you the same theoretical "New values per second" value as the frontend does, but item zabbix[wcache,<cache>,<mode>] will show you how many values per second are actually gathered and split them by type.

zabbix[process,<type>,<mode>,<state>]

Most of these items are available in "Template App Zabbix Server", which comes by default with Zabbix 2.2.

Zabbix performance study - Stack Overflow

zabbix
Rectangle 27 0

Actually zabbix have scenario, can post and support certain authentication mechanism. In addition, it can run any script that you provide either on server side or client side to collect just any information that you need.

monitoring - Best alternative to zabbix to monitor website, http serve...

http monitoring zabbix
Rectangle 27 0

I still haven't tried the Zabbix 2.0 API, but this was how I did it in 1.8.x

I'm quite sure dns field is mandatory,

hostid = zapi.host.create({ 'host': host_name, 'dns' : host_name,'ip' : host_ip, 
'groups': [{"groupid":hostgroup_id}]})['hostids'][0]

Also, from the docs ,

"interfaces":[
      {
          "type":1,
          "main":1,
          "useip":1,
          "ip":"192.168.3.1",
          "dns":"",
          "port":10050
      }

it does seem "Invalid params., No interfaces for host" is complaining about a missing "interfaces" parameter,

Oh, 2.x have change this API. Yes,is the problem of without interfaces in params. Thank you

You're welcome. You can accept the answer by ticking the green right mark.

Thumbs up for mentioning the "Invalid params.". It could have been a real timesink to find out what the reason for this message is. Thanks!

zabbix python api errors while create a host - Stack Overflow

python api zabbix
Rectangle 27 0

It depends on which parameters would you like to monitor. We are using SNMP monitoring on hosts (clusters and standalones) where vendor does not allow installation any other application except from himself.

Even in case of SNMP you need to modify configuration of your SNMP daemon on monitored host. But in some cases default configuration is sufficient to monitor at least some values without any installation/configuration/modification on monitored host. Be advised that the network must allow SNMP traffic (161/udp). I don't need to mention that SNMP v1 and v2c can be seen by somebody listening on the network. Values which can be monitored by SNMP daemon are listed in OID list http://www.alvestrand.no/objectid/top.html.

On the other hand Zabbix agent can monitor similar values like SNMP daemon. Additionaly there are some parameters which are more complex (like DNS response etc.). The list of values which can be monitored by Zabbix agent is on https://www.zabbix.com/documentation/2.2/manual/config/items/itemtypes/zabbix_agent

cluster computing - Is it feasible to use "snmp agent" instead of "zab...

cluster-computing monitoring snmp zabbix
Rectangle 27 0

PyZabbix is vital and pretty usable. In fact it is 1:1 mapping of Zabbix API to Python.

Have you actually tried to use it? can you please provide a working small example to fetch a list of hosts and the full info of each host?

Yes. I combined it with Fabric... getting list of all servers in group Solaris and then connecting to them by SSH in Fabric tasks and getting configuration data, IPs, Solaris release/patches... and those goes back to Zabbix hosts inventory. Doing it manually in GUI... I'm too lazy for that. ;-)

using zabbix API to create a grid view from python - Stack Overflow

python zabbix
Rectangle 27 0

Finally I found it was a humman error that my workmate had installed another zabbix_agentd on the server, so there's two zabbix agentds on it.

Although I start the agentd process with -c parameter, but when I used -t to test the user parameters , the config file was default link to another file, so that the user parameters I config in the file dose not effect...

monitoring - Why dose zabbix agent UserParameter not work when it is o...

monitoring zabbix
Rectangle 27 0

It looks like you have to start Zabbix Java gateway as well on host where it is installed (it is a daemon/service).

Zabbix JMX Tomcat monitoring - Stack Overflow

zabbix
Rectangle 27 0

finally got it working, have to create a apache http client and plug it in the jersey client as a handler and parse the response as stream:

HttpClient apacheClient = HttpClientBuilder.create().build();
        Client client = new Client(new ApacheHttpClient4Handler(apacheClient,
                new BasicCookieStore(),
                true));

        WebResource webResource = client.resource("http://comapany_host/zabbix/api_jsonrpc.php");
        ClientResponse response = webResource.type("application/json").post(ClientResponse.class, mainJObj);

        if (response.getStatus() != 200) {
            throw new RuntimeIOException("Failed : HTTP error code: " + response.getStatus());
        }

        BufferedReader br = new BufferedReader(
                new InputStreamReader((response.getEntityInputStream())));

        String output;
        System.out.println("Output from Server .... \n");
        while ((output = br.readLine()) != null) {
            System.out.println(output);
        }

It's perfectly OK to accept a correct answer, even if it's you (the OP) who answered. That way it's much clearer for future visitors that this is the correct solution.

Zabbix API user login with Jersey client - Stack Overflow

jersey-client zabbix