zabbix_pusher 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +99 -0
- data/lib/zabbix_pusher/jmx.rb +3 -3
- data/lib/zabbix_pusher/version.rb +1 -1
- metadata +5 -4
data/README.md
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# Zabbix Pusher
|
2
|
+
|
3
|
+
* Source: [http://github.com/iteh/zabbix_pusher](http://github.com/iteh/zabbix_pusher)
|
4
|
+
|
5
|
+
Zabbix Pusher is a gem with a set of binaries to push data to a zabbix server
|
6
|
+
|
7
|
+
The current package provides a implementation for querying jmx data with
|
8
|
+
[jolokia](http://www.jolokia.org/) from tomcat and a predefined tomcat_template.xml to import in zabbix.
|
9
|
+
You must deploy the jolkia.war to your tomcat instance.
|
10
|
+
|
11
|
+
## Quick Start
|
12
|
+
|
13
|
+
Install the gem with.
|
14
|
+
|
15
|
+
gem install zabbix_pusher
|
16
|
+
|
17
|
+
import the examples/tomcat_template.xml into your zabbix server
|
18
|
+
|
19
|
+
zabbix_pusher -z 192.168.1.40 -s vagrantup.com -v
|
20
|
+
|
21
|
+
sample output:
|
22
|
+
|
23
|
+
{
|
24
|
+
"jmx[java.lang:type=OperatingSystem;OpenFileDescriptorCount;]" => 46,
|
25
|
+
"jmx[Catalina:name=http-8080,type=GlobalRequestProcessor;errorCount;]" => 1,
|
26
|
+
"jmx[java.lang:type=ClassLoading;TotalLoadedClassCount;]" => 1918,
|
27
|
+
"jmx[java.lang:type=OperatingSystem;MaxFileDescriptorCount;]" => 1024,
|
28
|
+
"jmx[java.lang:type=Runtime;Uptime;]" => 4807550,
|
29
|
+
"jmx[java.lang:type=ClassLoading;LoadedClassCount;]" => 1916,
|
30
|
+
"jmx[Catalina:name=http-8080,type=ThreadPool;maxThreads;]" => 200,
|
31
|
+
"jmx[java.lang:type=Compilation;TotalCompilationTime;]" => 852,
|
32
|
+
"jmx[java.lang:type=Runtime;VmVersion;]" => "19.1-b02",
|
33
|
+
"jmx[java.lang:name=CMS Perm Gen,type=MemoryPool;Usage;max]" => 67108864,
|
34
|
+
"jmx[Catalina:type=Server;serverInfo;]" => "Apache Tomcat/6.0.24",
|
35
|
+
"jmx[Catalina:name=http-8080,type=GlobalRequestProcessor;bytesReceived;]" => 616016,
|
36
|
+
"jmx[java.lang:type=Compilation;Name;]" => "HotSpot Client Compiler",
|
37
|
+
"jmx[java.lang:name=Copy,type=GarbageCollector;CollectionTime;]" => 114,
|
38
|
+
"jmx[java.lang:name=CMS Perm Gen,type=MemoryPool;Usage;used]" => 10244896,
|
39
|
+
"jmx[java.lang:type=Threading;DaemonThreadCount;]" => 13,
|
40
|
+
"jmx[java.lang:name=CMS Old Gen,type=MemoryPool;Usage;committed]" => 50331648,
|
41
|
+
"jmx[java.lang:name=Code Cache,type=MemoryPool;Usage;used]" => 2310528,
|
42
|
+
"jmx[Catalina:name=http-8080,type=GlobalRequestProcessor;requestCount;]" => 173,
|
43
|
+
"jmx[Catalina:name=http-8080,type=GlobalRequestProcessor;processingTime;]" => 1992,
|
44
|
+
"jmx[Catalina:name=http-8080,type=ThreadPool;currentThreadsBusy;]" => 1,
|
45
|
+
"jmx[java.lang:type=Threading;ThreadCount;]" => 14,
|
46
|
+
"jmx[java.lang:name=ConcurrentMarkSweep,type=GarbageCollector;CollectionCount;]" => 4,
|
47
|
+
"jmx[java.lang:name=Code Cache,type=MemoryPool;Usage;committed]" => 2326528,
|
48
|
+
"jmx[java.lang:name=Code Cache,type=MemoryPool;Usage;max]" => 33554432,
|
49
|
+
"jmx[Catalina:name=http-8080,type=GlobalRequestProcessor;bytesSent;]" => 9622082,
|
50
|
+
"jmx[Catalina:name=http-8080,type=ThreadPool;currentThreadCount;]" => 1,
|
51
|
+
"jmx[java.lang:type=Threading;PeakThreadCount;]" => 14,
|
52
|
+
"jmx[java.lang:name=CMS Old Gen,type=MemoryPool;Usage;max]" => 83886080,
|
53
|
+
"jmx[java.lang:name=CMS Old Gen,type=MemoryPool;Usage;used]" => 3707304,
|
54
|
+
"jmx[java.lang:name=ConcurrentMarkSweep,type=GarbageCollector;CollectionTime;]" => 0,
|
55
|
+
"jmx[java.lang:name=CMS Perm Gen,type=MemoryPool;Usage;committed]" => 17063936,
|
56
|
+
"jmx[java.lang:type=ClassLoading;UnloadedClassCount;]" => 2,
|
57
|
+
"jmx[java.lang:type=Memory;ObjectPendingFinalizationCount;]" => 0,
|
58
|
+
"jmx[java.lang:type=Threading;TotalStartedThreadCount;]" => 14,
|
59
|
+
"jmx[java.lang:name=Copy,type=GarbageCollector;CollectionCount;]" => 49,
|
60
|
+
"jmx[Catalina:port=8080,type=ProtocolHandler;compression;]" => "off"
|
61
|
+
}
|
62
|
+
|
63
|
+
will push the data to a zabbix server running on port 10051. The -v option will print out what gets send to the server.
|
64
|
+
|
65
|
+
## Options
|
66
|
+
|
67
|
+
zabbix_pusher -h
|
68
|
+
Usage: zabbix_pusher (options)
|
69
|
+
-c, --config CONFIG The configuration file to use
|
70
|
+
--jmx_base_uri uri The jmx base uri
|
71
|
+
-l, --log_level LEVEL Set the log level (debug, info, warn, error, fatal)
|
72
|
+
-s, --host HOSTNAME Specify host name. Host IP address and DNS name will not work.
|
73
|
+
-v, --show_send_values shows what values got send to zabbix
|
74
|
+
-t, --template FILE The template file(s) to use, can be a file a comma separated list of files or a directory
|
75
|
+
-z, --zabbix-server SERVER Hostname or IP address of Zabbix Server
|
76
|
+
-p, --port SERVER PORT Specify port number of server trapper running on the server. Default is 10051
|
77
|
+
-h, --help Show this message
|
78
|
+
|
79
|
+
## Additional Command zabbix_pusher_jmx
|
80
|
+
|
81
|
+
Can be used to explore all the options of your jmx data.
|
82
|
+
|
83
|
+
$ zabbix_pusher_jmx -h
|
84
|
+
Usage: /usr/bin/zabbix_pusher_jmx (options)
|
85
|
+
-a, --attribute attribute The name of the action e.g. HeapMemoryUsage (needed for read command)
|
86
|
+
-b, --base_uri uri The jmx base uri
|
87
|
+
-o, --command action The command to perform
|
88
|
+
-m, --mbean mbean The name of the mbean e.g. java.lang:type=Memory (needed for read command)
|
89
|
+
-p, --path path The name of the path e.g. used (needed for read and list command)
|
90
|
+
-h, --help Show this message
|
91
|
+
|
92
|
+
Examples:
|
93
|
+
|
94
|
+
zabbix_pusher_jmx --command search -m "Catalina:*"
|
95
|
+
zabbix_pusher_jmx --command read -m "Catalina:host=localhost,path=/,type=Manager"
|
96
|
+
zabbix_pusher_jmx --command read -m "Catalina:name=http-8080,type=GlobalRequestProcessor" -a bytesReceived
|
97
|
+
zabbix_pusher_jmx --command list -m Catalina:host=localhost,path=/,resourcetype=Context,type=NamingResources
|
98
|
+
|
99
|
+
See [http://www.jolokia.org/reference/html/protocol.html](http://www.jolokia.org/reference/html/protocol.html) for details
|
data/lib/zabbix_pusher/jmx.rb
CHANGED
@@ -54,7 +54,7 @@ module ZabbixPusher
|
|
54
54
|
payload["path"] = path if path
|
55
55
|
payload["config"] = config if config.length > 0
|
56
56
|
ap payload.to_json
|
57
|
-
self.class.post('/jolokia', :body => payload.to_json)
|
57
|
+
self.class.post('/jolokia', :body => payload.to_json, :timeout => 5)
|
58
58
|
end
|
59
59
|
|
60
60
|
def version
|
@@ -62,9 +62,9 @@ module ZabbixPusher
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def processed_items
|
65
|
-
data = self.class.post('/jolokia', :body => @payload.to_json)
|
65
|
+
data = self.class.post('/jolokia', :body => @payload.to_json, :timeout => 5) rescue nil
|
66
66
|
result = Hash.new
|
67
|
-
data.each{|datum| result[result_key(datum)] = datum['value'] if datum['request']}
|
67
|
+
data.each{|datum| result[result_key(datum)] = datum['value'] if datum['request']} if data
|
68
68
|
result
|
69
69
|
end
|
70
70
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zabbix_pusher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.6
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Edmund Haselwanter
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-18 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- .gitignore
|
193
193
|
- Gemfile
|
194
194
|
- LICENSE
|
195
|
+
- README.md
|
195
196
|
- Rakefile
|
196
197
|
- bin/zabbix_pusher
|
197
198
|
- bin/zabbix_pusher_jmx
|