├── .gitignore
├── LICENSE
├── README.md
├── cacti
├── get_mongodb_status
├── get_mysql_status
├── get_nginx_status
└── templates
│ ├── cgt_cpu_16_cores.xml
│ ├── cgt_cpu_24_cores.xml
│ ├── cgt_cpu_2_cores.xml
│ ├── cgt_cpu_4_cores.xml
│ ├── cgt_cpu_6_cores.xml
│ ├── cgt_cpu_8_cores.xml
│ ├── cgt_http_request_devices.xml
│ ├── cgt_http_request_ip.xml
│ ├── cgt_http_request_size.xml
│ ├── cgt_linux_-_memory_usage.xml
│ ├── cgt_mongodb_active_clients_gt.xml
│ ├── cgt_mongodb_connections_gt.xml
│ ├── cgt_mongodb_network_traffic_gt.xml
│ ├── cgt_mongodb_op_commands_gt.xml
│ ├── cgt_nginx_clients_status_gt.xml
│ ├── cgt_nrpe_-_tcp_connections.xml
│ └── cgt_process_status_gt.xml
├── nagios
├── check_account
├── check_dbsync
├── check_fan
├── check_file_leak
├── check_ipmi
├── check_mail_queue
├── check_memory
├── check_mysql
├── check_nginx
├── check_port
├── check_process
├── check_raid
├── check_selinux
├── check_sysinfo
├── check_temperature
├── check_temperature_cpu
├── check_web
└── nrpereload
└── zabbix
├── bbu.info
├── check_ceph
├── check_cpu_cores_discovery
├── check_cpu_physical_cores_discovery
├── check_cpu_physical_id_discovery
├── check_cpu_temperature
├── check_disk_device
├── check_disk_devices_discovery
├── check_disk_devices_discovery.md
├── check_diskstats
├── check_diskstats_discovery
├── check_docker_container_discovery
├── check_docker_container_discovery.sudo
├── check_docker_stats
├── check_docker_stats.sudo
├── check_etcd
├── check_http
├── check_http_discovery
├── check_http_discovery.conf-example
├── check_iostat
├── check_ipmi
├── check_ipmi_discovery
├── check_ipmi_discovery_fan
├── check_ipmi_old
├── check_k8s_master
├── check_list.crontab
├── check_memcached
├── check_memcached.md
├── check_memcached_discovery
├── check_mongodb
├── check_mongodb.md
├── check_mysql
├── check_nginx_status
├── check_oracle
├── check_oracle_discovery
├── check_oracle_library
├── check_oracle_rac
├── check_ping
├── check_process
├── check_raid
├── check_raid_adapter_discovery
├── check_raid_bbu
├── check_raid_bbu_adapter_discovery
├── check_raid_bbu_key_discovery
├── check_redis
├── check_redis_discovery
├── check_selinux
├── check_tcp_connections
├── check_tokyotyrant
├── check_tokyotyrant_discovery
├── generate_http_discovery_list
├── hardware_data_collecter
├── notice_alert_get_info
├── notice_alert_sender
├── templates
├── Template App Apache HTTP.xml
├── Template App Ceph.xml
├── Template App Memcached.xml
├── Template App MongoDB.xml
├── Template App MySQL.xml
├── Template App Nginx.xml
├── Template App Redis.xml
├── Template KVM Processes.xml
├── Template Linux IPMI.xml
└── Template TCP Connections.xml
├── userinfo.py
└── zabbix-agent2.check.sudo
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
3 | # Byte-compiled / optimized / DLL files
4 | __pycache__/
5 | *.py[cod]
6 |
7 | # C extensions
8 | *.so
9 |
10 | # Distribution / packaging
11 | .Python
12 | env/
13 | build/
14 | develop-eggs/
15 | dist/
16 | downloads/
17 | eggs/
18 | .eggs/
19 | lib/
20 | lib64/
21 | parts/
22 | sdist/
23 | var/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *,cover
47 |
48 | # Translations
49 | *.mo
50 | *.pot
51 |
52 | # Django stuff:
53 | *.log
54 |
55 | # Sphinx documentation
56 | docs/_build/
57 |
58 | # PyBuilder
59 | target/
60 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # monitor
2 | cacti & Nagios & Zabbix monitor scripts
3 |
--------------------------------------------------------------------------------
/cacti/get_mongodb_status:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ----------------------------------------------
4 | # Created by Satetmood, 2015-09-17
5 | #
6 | # Statemood@gmail.com
7 | #
8 | # Project monitor
9 | # https://github.com/Statemood/monitor
10 | #
11 | # Check MongoDB Status for Cacti & Nagios
12 | # ----------------------------------------------
13 |
14 | # Default Port
15 | temp=`mktemp /dev/shm/XXXXXXXXXXXX`
16 | port=27017
17 | mongo=/usr/local/mongodb/bin/mongo
18 |
19 | usage="
20 | $(basename $0)
21 | -h, --help Display this message
22 | -H, --host Hostname or IP Address
23 | -P, --port Port of the MongoDB
24 | -i, --item Item
25 | "
26 |
27 | CleanTemp(){
28 | test -f $temp && rm -rf $temp
29 | }
30 |
31 | for args in "$@"
32 | do
33 | case $args in
34 | -H|--host)
35 | host="$2"
36 | shift 2
37 | ;;
38 | -P|--port)
39 | port="$2"
40 | shift 2
41 | ;;
42 | -i|--item)
43 | item="$2"
44 | shift 2
45 | ;;
46 | -h|--help)
47 | echo -e "$usage"
48 | exit 0
49 | ;;
50 | esac
51 | done
52 |
53 | GetStatus(){
54 | echo "db.adminCommand({serverStatus:1})" | $mongo --host $host --port $port > $temp
55 | }
56 |
57 | ProcData(){
58 | name="$1"
59 | cat $temp | awk -F[:,\"] '/'$name'/{value=substr($4,match($4,/[0-9]/));print $2":"value}' | head -1
60 | #"
61 | }
62 |
63 | GetStatus
64 |
65 | for g in `echo $item | tr -s "," " "`
66 | do
67 | case $g in
68 | activeClients)
69 | echo `grep -A 3 $g $temp | tail -3 | sed 's/^[ \t]*//' | sed 's/"//g' | sed 's/ : /:/g' | tr -s ",\n" " " `
70 | ;;
71 | connections)
72 | echo `grep -A 3 $g $temp | sed 's/"//g' | sed 's/ : /:/g' | tail -3 | head -2 | tr -s ",\n" " "`
73 | ;;
74 | network)
75 | echo `grep -A 3 $g $temp | head -4 | tail -3 | head -2 | sed 's/^[ \t]*//' | sed 's/"//g' | sed 's/ : /:/g' | tr -s ",\n" " "`
76 | ;;
77 | command|update|delete|insert|getmore|query|flush)
78 | res=`ProcData $g | tr -s "\n" " "`
79 | results="$results $res "
80 | ;;
81 | esac
82 | done
83 | echo $results
84 | CleanTemp
85 |
--------------------------------------------------------------------------------
/cacti/get_mysql_status:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2015.06.09 14:50
5 | # Updated by Statemood, 2015.06.10 18:00
6 | # Statemood@gmail.com
7 | #
8 | # Project monitor:
9 | # https://github.com/Statemood/monitor
10 | # ------------------------------------------
11 |
12 | mysql='/usr/local/mysql/bin/mysql'
13 | host=''
14 | port='3306'
15 | user='cacti'
16 | pass='KoBEK2sBsxc'
17 | temp=`mktemp /dev/shm/XXXXXXXXXXXXXXXX`
18 |
19 | DISP_COUNTS=0
20 | DISP_DETAIL=1
21 |
22 | Usage(){
23 | help_msg="
24 | \033[1m$(basename $0)\033[0m
25 | Get MySQL Status & Processlist info for Cacti.
26 |
27 | -H, --host Hostname or IP
28 | -P, --port MySQL port, default 3306
29 | -u, --user MySQL user
30 | -p, --password Password of the MySQL user
31 | -d, --details Display short names
32 | -i, --item Item data:
33 | IA, InnoDB_Activity
34 | IR, InnoDB_Row
35 | IP, InnoDB_Pending
36 | ML, MySQL_Log
37 | CM, Command
38 | CN, Connections_Network
39 | FT, Files_Tables
40 | HD, Handlers
41 | QC, Query_Cache
42 | ST, Select_Types
43 | SR, Sorts
44 | TL, Table_Locks
45 | SQ, Slow_Query
46 | "
47 | echo -e "$help_msg"
48 | }
49 |
50 | for args in "$@"
51 | do
52 | case "$args" in
53 | -H|--host)
54 | host="$2"
55 | shift 2
56 | ;;
57 | -P|--port)
58 | port="$2"
59 | shift 2
60 | ;;
61 | -u|--user)
62 | user="$2"
63 | shift 2
64 | ;;
65 | -p|--password)
66 | pass="$2"
67 | shift 2
68 | ;;
69 | -i|--item)
70 | item="$2"
71 | shift
72 | ;;
73 | -d|--details)
74 | DISP_DETAIL=0
75 | ;;
76 | -h|--help)
77 | Usage
78 | exit 0
79 | ;;
80 | -*)
81 | Usage
82 | exit 1
83 | ;;
84 | esac
85 | done
86 |
87 | Clean(){
88 | test -f "$temp" && rm -rf "$temp"
89 | }
90 |
91 | DBQuery(){
92 | $mysql -h $host -u $user -p$pass -e "$1" | sed 's/\t/ /g' > $temp
93 | }
94 |
95 | Print_Results(){
96 | for str in $Strings
97 | do
98 | if [ $DISP_COUNTS -le 9 ]
99 | then
100 | NUM=0$DISP_COUNTS
101 | else
102 | NUM=$DISP_COUNTS
103 | fi
104 |
105 | if [ $DISP_DETAIL = 0 ]
106 | then
107 | echo -e "${item}$NUM\t--> $str"
108 | else
109 | echo ${item}$NUM:`grep ^$str $temp | awk '{print $2}'`
110 | fi
111 | echo $((DISP_COUNTS++)) > /dev/null
112 | done
113 | }
114 |
115 | if [ "$item" = "PL" ]
116 | then
117 | DBQuery "show full processlist"
118 | else
119 | DBQuery "show status"
120 | fi
121 |
122 | case "$item" in
123 | CM|Command)
124 | Strings="Com_commit Com_flush Questions Queries Com_select
125 | Com_delete Com_insert Com_update Com_replace Com_load
126 | Com_delete_multi Com_insert_select
127 | Com_update_multi Com_replace_select" ;;
128 |
129 | CN|Connections_Network)
130 | Strings="Max_used_connections Aborted_clients Aborted_connects
131 | Threads_connected Threads_running Threads_created Threads_cached
132 | Connections Bytes_sent Bytes_received" ;;
133 |
134 | FT|Files_Tables)
135 | Strings="Open_tables Open_files Opened_files Opened_tables
136 | Created_tmp_disk_tables Created_tmp_files Created_tmp_tables" ;;
137 |
138 | HD|Handlers)
139 | Strings="Handler_write Handler_update Handler_commit Handler_delete
140 | Handler_external_lock Handler_read_first Handler_read_key
141 | Handler_read_next Handler_read_prev Handler_read_rnd
142 | Handler_read_rnd_next" ;;
143 |
144 | IA|InnoDB_Activity)
145 | Strings="Innodb_page_size Innodb_pages_created Innodb_buffer_pool_pages_data
146 | Innodb_pages_read Innodb_pages_written Innodb_buffer_pool_pages_flushed
147 | Innodb_buffer_pool_bytes_data Innodb_buffer_pool_pages_free
148 | Innodb_buffer_pool_pages_total Innodb_buffer_pool_wait_free";;
149 |
150 | IP|InnoDB_Pending)
151 | Strings="Innodb_data_pending_fsyncs Innodb_data_pending_reads Innodb_data_pending_writes" ;;
152 |
153 | IR|InnoDB_Row)
154 | Strings="Innodb_rows_deleted Innodb_rows_inserted Innodb_rows_read
155 | Innodb_rows_updated Innodb_row_lock_current_waits Innodb_row_lock_waits
156 | Innodb_row_lock_time Innodb_row_lock_time_avg Innodb_row_lock_time_max" ;;
157 |
158 | ML|MySQL_Log)
159 | Strings="Innodb_log_writes Innodb_log_waits Innodb_log_write_request
160 | Binlog_cache_use Binlog_cache_disk_use" ;;
161 |
162 | PL|Processlist)
163 | echo 123
164 | ;;
165 | QC|Query_Cache)
166 | Strings="Qcache_queries_in_cache Qcache_total_blocks Qcache_hits Qcache_not_cached
167 | Qcache_lowmem_prunes Qcache_free_blocks Qcache_free_memory Qcache_inserts" ;;
168 |
169 | ST|Select_Types)
170 | Strings="Select_full_join Select_full_range_join Select_range Select_range_check Select_scan" ;;
171 |
172 | SQ|Slow_Query)
173 | Strings="Slow_queries Slow_launch_threads" ;;
174 |
175 | SR|Sorts)
176 | Strings="Sort_rows Sort_range Sort_merge_passes Sort_scan" ;;
177 |
178 | TL|Table_Locks)
179 | Strings="Table_locks_immediate Table_locks_waited" ;;
180 |
181 | esac
182 |
183 | if [ $DISP_DETAIL = 0 ]
184 | then
185 | Print_Results
186 | else
187 | Print_Results | tr -s "\n" " "
188 | fi
189 | Clean
190 |
191 |
--------------------------------------------------------------------------------
/cacti/get_nginx_status:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ----------------------------------------------
4 | # Created by Satetmood, 2015-09-17
5 | #
6 | # Statemood@gmail.com
7 | #
8 | # Project monitor
9 | # https://github.com/Statemood/monitor
10 | # ----------------------------------------------
11 |
12 | for args in "$@"
13 | do
14 | case $args in
15 | --url)
16 | url="$2"
17 | shift 2
18 | ;;
19 | --active)
20 | curl -m 5 -s --retry 3 $url | sed '2,3d' | sed 's/ connections//' | sed 's/: /:/g' | tr -s "\n" " " | tr -s A-Z a-z
21 | ;;
22 | esac
23 | done
24 |
--------------------------------------------------------------------------------
/cacti/templates/cgt_cpu_2_cores.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | CPU 2 Cores
4 |
5 |
6 | |host_description| - CPU 2 Cores
7 |
8 | 1
9 |
10 | 120
11 |
12 | 510
13 |
14 | on
15 |
16 | on
17 |
18 | 2
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | on
27 |
28 | on
29 |
30 | 100
31 |
32 | 0
33 |
34 | 1000
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | hash_0800259825aaf7c0bdf1554c5b4b86680ac2c0
45 | FF0000
46 | FF
47 | 4
48 | 1
49 | 0
50 |
51 | hash_060025e9c43831e54eca8069317a2ce8c6f751
52 | Core 00:
53 |
54 | 1
55 |
56 |
57 | hash_0800259825aaf7c0bdf1554c5b4b86680ac2c0
58 | 0
59 | FF
60 | 9
61 | 4
62 | 0
63 |
64 | hash_060025e9c43831e54eca8069317a2ce8c6f751
65 | Current:
66 |
67 | 2
68 |
69 |
70 | hash_0800259825aaf7c0bdf1554c5b4b86680ac2c0
71 | 0
72 | FF
73 | 9
74 | 1
75 | 0
76 |
77 | hash_060025e9c43831e54eca8069317a2ce8c6f751
78 | Average:
79 |
80 | 3
81 |
82 |
83 | hash_0800259825aaf7c0bdf1554c5b4b86680ac2c0
84 | 0
85 | FF
86 | 9
87 | 3
88 | 0
89 |
90 | hash_060025e9c43831e54eca8069317a2ce8c6f751
91 | Maximum:
92 | on
93 | 4
94 |
95 |
96 | hash_0800259825aaf7c0bdf1554c5b4b86680ac2c0
97 | 0000FF
98 | FF
99 | 4
100 | 1
101 | 0
102 |
103 | hash_060025e9c43831e54eca8069317a2ce8c6f751
104 | Core 01:
105 |
106 | 5
107 |
108 |
109 | hash_0800259825aaf7c0bdf1554c5b4b86680ac2c0
110 | 0
111 | FF
112 | 9
113 | 4
114 | 0
115 |
116 | hash_060025e9c43831e54eca8069317a2ce8c6f751
117 | Current:
118 |
119 | 6
120 |
121 |
122 | hash_0800259825aaf7c0bdf1554c5b4b86680ac2c0
123 | 0
124 | FF
125 | 9
126 | 1
127 | 0
128 |
129 | hash_060025e9c43831e54eca8069317a2ce8c6f751
130 | Average:
131 |
132 | 7
133 |
134 |
135 | hash_0800259825aaf7c0bdf1554c5b4b86680ac2c0
136 | 0
137 | FF
138 | 9
139 | 3
140 | 0
141 |
142 | hash_060025e9c43831e54eca8069317a2ce8c6f751
143 | Maximum:
144 | on
145 | 8
146 |
147 |
148 |
149 |
150 | Data Source [cpu]
151 |
152 | task_item_id
153 | hash_000025104395067b046fca9291002c99c0df77|hash_0000250fbf91ead135bbc73d43b71db4a7e995|hash_0000259e438054f304c07c4a9d5812c90f52e7|hash_0000253fb0fa8fc08d6fa8ac19f49717a36a6c
154 |
155 |
156 | Data Source [cpu]
157 |
158 | task_item_id
159 | hash_000025f0329c7131241cef9792a73ee75c3773|hash_000025095b669dcbb714a450e0f0fd27d0caa4|hash_0000252cdd3e1cbef91413b7debcb83e2a7f57|hash_0000258853ef7d34974035c742559642a91afd
160 |
161 |
162 |
163 |
164 | Host MIB - CPU Utilization
165 |
166 |
167 | |host_description| - CPU Utilization
168 | hash_030025332111d8b54ac8ce939af87a7eac0c06
169 |
170 |
171 | 60
172 |
173 | on
174 | hash_150025c21df5178e5c955013591239eb0afd46|hash_1500250d9c0af8b8acdc7807943937b3208e29|hash_1500256fc2d038fb42950138b0ce3e9874cc60|hash_150025e36f3adb9f152adfa5dc50fd2b23337e
175 |
176 |
177 |
178 |
179 | cpu
180 |
181 | 0
182 |
183 | 100
184 |
185 | 1
186 |
187 | 120
188 |
189 | 0
190 |
191 |
192 |
193 |
194 | hash_07002531112c85ae4ff821d3b288336288818c
195 | on
196 |
197 |
198 |
199 | hash_07002530fb5d5bcf3d66bb5abe88596f357c26
200 | on
201 |
202 |
203 |
204 | hash_070025172b4b0eacee4948c6479f587b62e512
205 | on
206 |
207 |
208 |
209 |
210 |
211 | Get Script Server Data (Indexed)
212 | 6
213 |
214 |
215 |
216 | Index Type
217 |
218 |
219 |
220 | index_type
221 | in
222 | index_type
223 |
224 |
225 | Index Value
226 |
227 |
228 |
229 | index_value
230 | in
231 | index_value
232 |
233 |
234 | Output Type ID
235 |
236 |
237 |
238 | output_type
239 | in
240 | output_type
241 |
242 |
243 | Output Value
244 | on
245 |
246 |
247 |
248 | out
249 | output
250 |
251 |
252 |
253 |
254 | Daily (5 Minute Average)
255 | 0.5
256 | 1
257 | 600
258 | 86400
259 | 1|3
260 |
261 |
262 | Weekly (30 Minute Average)
263 | 0.5
264 | 6
265 | 700
266 | 604800
267 | 1|3
268 |
269 |
270 | Monthly (2 Hour Average)
271 | 0.5
272 | 24
273 | 775
274 | 2678400
275 | 1|3
276 |
277 |
278 | Yearly (1 Day Average)
279 | 0.5
280 | 288
281 | 797
282 | 33053184
283 | 1|3
284 |
285 |
286 | Normal
287 | %8.2lf %s
288 |
289 |
--------------------------------------------------------------------------------
/cacti/templates/cgt_http_request_size.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | HTTP Request Size
4 |
5 |
6 | |host_description| - HTTP Request Size
7 |
8 | 1
9 |
10 | 120
11 |
12 | 510
13 |
14 | on
15 |
16 |
17 |
18 | 4
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | on
27 |
28 | on
29 |
30 | 100
31 |
32 | 0
33 |
34 | 1000
35 |
36 |
37 |
38 |
39 |
40 | MB / in last minute
41 |
42 |
43 |
44 | hash_080025124ed20db267dd0d5fff74f150a8bc55
45 | 0000FF
46 | FF
47 | 4
48 | 1
49 | 0
50 |
51 | hash_060025e9c43831e54eca8069317a2ce8c6f751
52 | Requests in last minute(MB):
53 | on
54 | 1
55 |
56 |
57 | hash_080025124ed20db267dd0d5fff74f150a8bc55
58 | 0
59 | FF
60 | 9
61 | 4
62 | 0
63 |
64 | hash_060025e9c43831e54eca8069317a2ce8c6f751
65 | Current:
66 |
67 | 2
68 |
69 |
70 | hash_080025124ed20db267dd0d5fff74f150a8bc55
71 | 0
72 | FF
73 | 9
74 | 1
75 | 0
76 |
77 | hash_060025e9c43831e54eca8069317a2ce8c6f751
78 | Average:
79 |
80 | 3
81 |
82 |
83 | hash_080025124ed20db267dd0d5fff74f150a8bc55
84 | 0
85 | FF
86 | 9
87 | 3
88 | 0
89 |
90 | hash_060025e9c43831e54eca8069317a2ce8c6f751
91 | Maximum:
92 |
93 | 4
94 |
95 |
96 | hash_080025124ed20db267dd0d5fff74f150a8bc55
97 | 0
98 | FF
99 | 9
100 | 2
101 | 0
102 |
103 | hash_060025e9c43831e54eca8069317a2ce8c6f751
104 | Minimum:
105 |
106 | 5
107 |
108 |
109 |
110 |
111 | Data Source [size]
112 |
113 | task_item_id
114 | hash_00002530df670cbf7925213145934fcbfbf872|hash_000025a6ae206af4799a1770892639b274dda4|hash_000025aabf3afead3d24dc466a744dd10c5b7b|hash_000025e9c292a7df02ba9b6cdb95e0f04562c4|hash_0000254b5b8e18e4845e660e6da67df308abad
115 |
116 |
117 |
118 |
119 | HTTP Request Size
120 |
121 |
122 | |host_description| - HTTP Request Size
123 | hash_03002572532f52bdb68659bbd25987f60ce638
124 |
125 |
126 | 60
127 |
128 | on
129 | hash_150025c21df5178e5c955013591239eb0afd46|hash_1500250d9c0af8b8acdc7807943937b3208e29|hash_1500256fc2d038fb42950138b0ce3e9874cc60|hash_150025e36f3adb9f152adfa5dc50fd2b23337e
130 |
131 |
132 |
133 |
134 | size
135 |
136 | 0
137 |
138 | 0
139 |
140 | 1
141 |
142 | 120
143 |
144 | hash_07002535fb985dadbd2bb6bc7b032cfd1be88c
145 |
146 |
147 |
148 |
149 | hash_0700258f306d096b5aa691c3ae98f67786773a
150 | on
151 | 5666
152 |
153 |
154 | hash_070025f8ad400f8b8554f65adb000e4b25d29a
155 |
156 |
157 |
158 |
159 |
160 |
161 | HTTP Request Size
162 | 1
163 | /usr/local/nagios/libexec/check_nrpe -H <ip> -p <port> -c check_http_request
164 |
165 |
166 | IP Address
167 |
168 |
169 |
170 | hostname
171 | in
172 | ip
173 |
174 |
175 | NRPE Port
176 |
177 |
178 |
179 | port
180 | in
181 | port
182 |
183 |
184 | Size MB
185 | on
186 |
187 |
188 |
189 | out
190 | size
191 |
192 |
193 |
194 |
195 | Daily (5 Minute Average)
196 | 0.5
197 | 1
198 | 600
199 | 86400
200 | 1|3
201 |
202 |
203 | Weekly (30 Minute Average)
204 | 0.5
205 | 6
206 | 700
207 | 604800
208 | 1|3
209 |
210 |
211 | Monthly (2 Hour Average)
212 | 0.5
213 | 24
214 | 775
215 | 2678400
216 | 1|3
217 |
218 |
219 | Yearly (1 Day Average)
220 | 0.5
221 | 288
222 | 797
223 | 33053184
224 | 1|3
225 |
226 |
227 | Normal
228 | %8.2lf %s
229 |
230 |
--------------------------------------------------------------------------------
/cacti/templates/cgt_mongodb_connections_gt.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | MongoDB Connections GT
4 |
5 |
6 | |host_description| - MongoDB Connections
7 |
8 | 1
9 |
10 | 120
11 |
12 | 515
13 |
14 | on
15 |
16 | on
17 |
18 | 2
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | on
27 |
28 | on
29 |
30 | 100
31 |
32 | 0
33 |
34 | 1000
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | hash_080025da5150d7e1c9b349cb33b84f078a19a5
45 | FF00FF
46 | FF
47 | 4
48 | 1
49 | 0
50 |
51 | hash_060025e9c43831e54eca8069317a2ce8c6f751
52 | Available:
53 |
54 | 1
55 |
56 |
57 | hash_080025da5150d7e1c9b349cb33b84f078a19a5
58 | 0
59 | FF
60 | 9
61 | 4
62 | 0
63 |
64 | hash_060025e9c43831e54eca8069317a2ce8c6f751
65 | Current:
66 |
67 | 2
68 |
69 |
70 | hash_080025da5150d7e1c9b349cb33b84f078a19a5
71 | 0
72 | FF
73 | 9
74 | 1
75 | 0
76 |
77 | hash_060025e9c43831e54eca8069317a2ce8c6f751
78 | Average:
79 |
80 | 3
81 |
82 |
83 | hash_080025da5150d7e1c9b349cb33b84f078a19a5
84 | 0
85 | FF
86 | 9
87 | 3
88 | 0
89 |
90 | hash_060025e9c43831e54eca8069317a2ce8c6f751
91 | Maximum:
92 | on
93 | 4
94 |
95 |
96 | hash_080025f525b5e619356e06aa955dd232331a0c
97 | FF0000
98 | FF
99 | 4
100 | 1
101 | 0
102 |
103 | hash_060025e9c43831e54eca8069317a2ce8c6f751
104 | Connections:
105 |
106 | 5
107 |
108 |
109 | hash_080025f525b5e619356e06aa955dd232331a0c
110 | 0
111 | FF
112 | 9
113 | 4
114 | 0
115 |
116 | hash_060025e9c43831e54eca8069317a2ce8c6f751
117 | Current:
118 |
119 | 6
120 |
121 |
122 | hash_080025f525b5e619356e06aa955dd232331a0c
123 | 0
124 | FF
125 | 9
126 | 1
127 | 0
128 |
129 | hash_060025e9c43831e54eca8069317a2ce8c6f751
130 | Average:
131 |
132 | 7
133 |
134 |
135 | hash_080025f525b5e619356e06aa955dd232331a0c
136 | 0
137 | FF
138 | 9
139 | 3
140 | 0
141 |
142 | hash_060025e9c43831e54eca8069317a2ce8c6f751
143 | Maximum:
144 | on
145 | 8
146 |
147 |
148 |
149 |
150 | Data Source [MongoDB_Conn_Ava]
151 |
152 | task_item_id
153 | hash_000025fba809b6d9a46bdbd96bd9effdfe85a4|hash_0000259f0769146debf3d77c85b68a6c0c2758|hash_00002582e587667c204a8be7f4d0e636a3bbef|hash_000025df6aa602ab74450832e46c31a5ff5bcc
154 |
155 |
156 | Data Source [MongoDB_Conn_Cur]
157 |
158 | task_item_id
159 | hash_0000255c16676b2e75583fcf95fdfb4fcfd34e|hash_0000257f9ee5a2c607f3fec963b4ef3aab87cd|hash_000025fd622c35a669c31333dbeb7220ca7c64|hash_000025b1a49440014dd7cce6c611c523778d4d
160 |
161 |
162 |
163 |
164 | MongoDB Connections
165 |
166 |
167 | |host_description| - MongoDB Connections
168 | hash_0300255469afd640bf3ba0ddcf80065bca49fb
169 |
170 |
171 | 300
172 |
173 | on
174 | hash_150025c21df5178e5c955013591239eb0afd46|hash_1500250d9c0af8b8acdc7807943937b3208e29|hash_1500256fc2d038fb42950138b0ce3e9874cc60|hash_150025e36f3adb9f152adfa5dc50fd2b23337e|hash_150025283ea2bf1634d92ce081ec82a634f513
175 |
176 |
177 |
178 |
179 | MongoDB_Conn_Cur
180 |
181 | 0
182 |
183 | 65535
184 |
185 | 1
186 |
187 | 600
188 |
189 | hash_0700257fe63c5f1fdd7b37a79cf537cd9bc1d0
190 |
191 |
192 |
193 | MongoDB_Conn_Ava
194 |
195 | 0
196 |
197 | 65535
198 |
199 | 1
200 |
201 | 600
202 |
203 | hash_07002507ec4980d807d21a90a9adf04221f277
204 |
205 |
206 |
207 |
208 | hash_0700254084ce8f0b7064d53f750febe7958f4b
209 | on
210 | 27017
211 |
212 |
213 | hash_07002506f2e1d074f4ac6771390357aa66e772
214 |
215 |
216 |
217 |
218 |
219 |
220 | MongoDB Connections IM
221 | 1
222 | <path_cacti>/scripts/get_mongodb_status --host <hostname> --port <port2> --item connections
223 |
224 |
225 | hostname
226 |
227 |
228 |
229 | hostname
230 | in
231 | hostname
232 |
233 |
234 | port2
235 |
236 |
237 |
238 |
239 | in
240 | port2
241 |
242 |
243 | MongoDB Connectins Current
244 | on
245 |
246 |
247 |
248 | out
249 | current
250 |
251 |
252 | MongoDB Connectins Available
253 | on
254 |
255 |
256 |
257 | out
258 | available
259 |
260 |
261 |
262 |
263 | Daily (5 Minute Average)
264 | 0.5
265 | 1
266 | 600
267 | 86400
268 | 1|3
269 |
270 |
271 | Weekly (30 Minute Average)
272 | 0.5
273 | 6
274 | 700
275 | 604800
276 | 1|3
277 |
278 |
279 | Monthly (2 Hour Average)
280 | 0.5
281 | 24
282 | 775
283 | 2678400
284 | 1|3
285 |
286 |
287 | Yearly (1 Day Average)
288 | 0.5
289 | 288
290 | 797
291 | 33053184
292 | 1|3
293 |
294 |
295 | Hourly (1 Minute Average)
296 | 0.5
297 | 1
298 | 500
299 | 14400
300 | 1|3
301 |
302 |
303 | Normal
304 | %8.2lf %s
305 |
306 |
--------------------------------------------------------------------------------
/cacti/templates/cgt_mongodb_network_traffic_gt.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | MongoDB Network Traffic GT
4 |
5 |
6 | |host_description| - MongoDB Network Traffic
7 |
8 | 1
9 |
10 | 120
11 |
12 | 515
13 |
14 | on
15 |
16 | on
17 |
18 | 2
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | on
27 |
28 | on
29 |
30 | 100
31 |
32 | 0
33 |
34 | 1000
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | hash_0800255e9a42d4d818f3ebd8e84cfd93a78983
45 | FF00FF
46 | FF
47 | 4
48 | 1
49 | 0
50 |
51 | hash_060025e9c43831e54eca8069317a2ce8c6f751
52 | Traffic In:
53 |
54 | 1
55 |
56 |
57 | hash_0800255e9a42d4d818f3ebd8e84cfd93a78983
58 | 0
59 | FF
60 | 9
61 | 4
62 | 0
63 |
64 | hash_060025e9c43831e54eca8069317a2ce8c6f751
65 | Current:
66 |
67 | 2
68 |
69 |
70 | hash_0800255e9a42d4d818f3ebd8e84cfd93a78983
71 | 0
72 | FF
73 | 9
74 | 1
75 | 0
76 |
77 | hash_060025e9c43831e54eca8069317a2ce8c6f751
78 | Average:
79 |
80 | 3
81 |
82 |
83 | hash_0800255e9a42d4d818f3ebd8e84cfd93a78983
84 | 0
85 | FF
86 | 9
87 | 3
88 | 0
89 |
90 | hash_060025e9c43831e54eca8069317a2ce8c6f751
91 | Maximum:
92 | on
93 | 4
94 |
95 |
96 | hash_080025d4258bc3920684b961ad58a0bba08316
97 | FF0000
98 | FF
99 | 4
100 | 1
101 | 0
102 |
103 | hash_060025e9c43831e54eca8069317a2ce8c6f751
104 | Traffic Out:
105 |
106 | 5
107 |
108 |
109 | hash_080025d4258bc3920684b961ad58a0bba08316
110 | 0
111 | FF
112 | 9
113 | 4
114 | 0
115 |
116 | hash_060025e9c43831e54eca8069317a2ce8c6f751
117 | Current:
118 |
119 | 6
120 |
121 |
122 | hash_080025d4258bc3920684b961ad58a0bba08316
123 | 0
124 | FF
125 | 9
126 | 1
127 | 0
128 |
129 | hash_060025e9c43831e54eca8069317a2ce8c6f751
130 | Average:
131 |
132 | 7
133 |
134 |
135 | hash_080025d4258bc3920684b961ad58a0bba08316
136 | 0
137 | FF
138 | 9
139 | 3
140 | 0
141 |
142 | hash_060025e9c43831e54eca8069317a2ce8c6f751
143 | Maximum:
144 | on
145 | 8
146 |
147 |
148 |
149 |
150 | Data Source [MongoDB_Network_IN]
151 |
152 | task_item_id
153 | hash_0000255111be83909439d561a8bde8be2bc9cd|hash_0000250cb215711f648e09a2fd5f5f5d576c72|hash_0000251e097bc67b7add87e43b9ae9571f5042|hash_0000254888997420fbc3ce7f5728f2d7c6dfce
154 |
155 |
156 | Data Source [MongoDB_Network_OUT]
157 |
158 | task_item_id
159 | hash_000025b2cc6ee1beed400044a7673170c70a8d|hash_000025dbacd25b6e2056c511e85f3330003245|hash_00002588dc2f7b26bb74923562addc87d9956b|hash_0000255af8004b984e9845158b1ea61fc62e65
160 |
161 |
162 |
163 |
164 | MongoDB Network Traffic DT
165 |
166 |
167 | |host_description| - MongoDB Network Traffic
168 | hash_03002574012c16ebd8c35a5659b2a2aab2c423
169 |
170 |
171 | 300
172 |
173 | on
174 | hash_150025c21df5178e5c955013591239eb0afd46|hash_1500250d9c0af8b8acdc7807943937b3208e29|hash_1500256fc2d038fb42950138b0ce3e9874cc60|hash_150025e36f3adb9f152adfa5dc50fd2b23337e|hash_150025283ea2bf1634d92ce081ec82a634f513
175 |
176 |
177 |
178 |
179 | MongoDB_Network_IN
180 |
181 | 0
182 |
183 | 18446744073709551615
184 |
185 | 1
186 |
187 | 600
188 |
189 | hash_070025801a3e77aa55a88933ad092ba7a5933e
190 |
191 |
192 |
193 | MongoDB_Network_OUT
194 |
195 | 0
196 |
197 | 18446744073709551615
198 |
199 | 1
200 |
201 | 600
202 |
203 | hash_0700253059a87c6e76303bd895df55708e1b4e
204 |
205 |
206 |
207 |
208 | hash_070025680d964fc4f4ac91a14ccc5abf57ff62
209 |
210 |
211 |
212 |
213 | hash_07002506c009e1c16b16225db0d7721abadc76
214 | on
215 | 27017
216 |
217 |
218 |
219 |
220 | MongoDB Network Traffic IM
221 | 1
222 | <path_cacti>/scripts/get_mongodb_status --host <hostname> --port <port2> --item network
223 |
224 |
225 | hostname
226 |
227 |
228 |
229 | hostname
230 | in
231 | hostname
232 |
233 |
234 | port2
235 |
236 |
237 |
238 |
239 | in
240 | port2
241 |
242 |
243 | MongoDB Networks Traffic In
244 | on
245 |
246 |
247 |
248 | out
249 | bytesIn
250 |
251 |
252 | MongoDB Networks Traffic Out
253 | on
254 |
255 |
256 |
257 | out
258 | bytesOut
259 |
260 |
261 |
262 |
263 | Daily (5 Minute Average)
264 | 0.5
265 | 1
266 | 600
267 | 86400
268 | 1|3
269 |
270 |
271 | Weekly (30 Minute Average)
272 | 0.5
273 | 6
274 | 700
275 | 604800
276 | 1|3
277 |
278 |
279 | Monthly (2 Hour Average)
280 | 0.5
281 | 24
282 | 775
283 | 2678400
284 | 1|3
285 |
286 |
287 | Yearly (1 Day Average)
288 | 0.5
289 | 288
290 | 797
291 | 33053184
292 | 1|3
293 |
294 |
295 | Hourly (1 Minute Average)
296 | 0.5
297 | 1
298 | 500
299 | 14400
300 | 1|3
301 |
302 |
303 | Normal
304 | %8.2lf %s
305 |
306 |
--------------------------------------------------------------------------------
/cacti/templates/cgt_process_status_gt.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Process Status GT
4 |
5 |
6 | |host_description| - Process Status
7 |
8 | 1
9 |
10 | 120
11 |
12 | 500
13 |
14 | on
15 |
16 | on
17 |
18 | 2
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | on
27 |
28 | on
29 |
30 | 100
31 |
32 | 0
33 |
34 | 1000
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | hash_080025d80403e29b37edc31c63c48e88224499
45 | FF00FF
46 | FF
47 | 4
48 | 1
49 | 0
50 |
51 | hash_060025e9c43831e54eca8069317a2ce8c6f751
52 | CPU:
53 |
54 | 1
55 |
56 |
57 | hash_080025d80403e29b37edc31c63c48e88224499
58 | 0
59 | FF
60 | 9
61 | 4
62 | 0
63 |
64 | hash_060025e9c43831e54eca8069317a2ce8c6f751
65 | Current:
66 |
67 | 2
68 |
69 |
70 | hash_080025d80403e29b37edc31c63c48e88224499
71 | 0
72 | FF
73 | 9
74 | 1
75 | 0
76 |
77 | hash_060025e9c43831e54eca8069317a2ce8c6f751
78 | Average:
79 |
80 | 3
81 |
82 |
83 | hash_080025d80403e29b37edc31c63c48e88224499
84 | 0
85 | FF
86 | 9
87 | 3
88 | 0
89 |
90 | hash_060025e9c43831e54eca8069317a2ce8c6f751
91 | Maximum:
92 | on
93 | 4
94 |
95 |
96 | hash_080025bb317998270d101e07864f3cd3d386b1
97 | FF0000
98 | FF
99 | 4
100 | 1
101 | 0
102 |
103 | hash_060025e9c43831e54eca8069317a2ce8c6f751
104 | Memory:
105 |
106 | 5
107 |
108 |
109 | hash_080025bb317998270d101e07864f3cd3d386b1
110 | 0
111 | FF
112 | 9
113 | 4
114 | 0
115 |
116 | hash_060025e9c43831e54eca8069317a2ce8c6f751
117 | Current:
118 |
119 | 6
120 |
121 |
122 | hash_080025bb317998270d101e07864f3cd3d386b1
123 | 0
124 | FF
125 | 9
126 | 1
127 | 0
128 |
129 | hash_060025e9c43831e54eca8069317a2ce8c6f751
130 | Average:
131 |
132 | 7
133 |
134 |
135 | hash_080025bb317998270d101e07864f3cd3d386b1
136 | 0
137 | FF
138 | 9
139 | 3
140 | 0
141 |
142 | hash_060025e9c43831e54eca8069317a2ce8c6f751
143 | Maximum:
144 | on
145 | 8
146 |
147 |
148 |
149 |
150 | Data Source [CU]
151 |
152 | task_item_id
153 | hash_0000250d50251144e259b3857972dfcacafe45|hash_000025f22aec9ef7cde65f57ed347a45c1f1af|hash_0000258cdd8748e6788320d928126acf13eb4a|hash_0000258777f69307e4096888359ad7e918f0ca
154 |
155 |
156 | Data Source [MU]
157 |
158 | task_item_id
159 | hash_000025e589ae88e184670fe974ed435d2d3c54|hash_000025379ab975d5f066578f336ff87dbbd9e4|hash_000025de539193cac07783aab1f72431291a46|hash_000025aa57e424d7f8e8ff53c5e7d79b58638a
160 |
161 |
162 |
163 |
164 | Process Status DT
165 |
166 |
167 | |host_description| - Process Status
168 | hash_030025495e9f30da3e7f660937954dcf573e54
169 |
170 |
171 | 300
172 |
173 | on
174 | hash_150025c21df5178e5c955013591239eb0afd46|hash_1500250d9c0af8b8acdc7807943937b3208e29|hash_1500256fc2d038fb42950138b0ce3e9874cc60|hash_150025e36f3adb9f152adfa5dc50fd2b23337e|hash_150025283ea2bf1634d92ce081ec82a634f513
175 |
176 |
177 |
178 |
179 | CU
180 |
181 | U
182 |
183 | U
184 |
185 | 1
186 |
187 | 600
188 |
189 | hash_0700259096f058d330faa85260880f71664241
190 |
191 |
192 |
193 | MU
194 |
195 | U
196 |
197 | U
198 |
199 | 1
200 |
201 | 600
202 |
203 | hash_0700253ec15c566a58237ca7c155dafacf3889
204 |
205 |
206 |
207 |
208 | hash_0700254daccab579272ceb8975d24dbe6f96d9
209 | on
210 |
211 |
212 |
213 | hash_0700252bbcddb6e20c4b5c176c4a20c6eb32ab
214 | on
215 |
216 |
217 |
218 | hash_070025c158d236a4bc7e216d6c61075b3c7e52
219 |
220 |
221 |
222 |
223 |
224 |
225 | Process Status IM
226 | 1
227 | /usr/local/nagios/libexec/check_nrpe -H <hostname> -p <port2> -c <process>
228 |
229 |
230 | hostname
231 |
232 |
233 |
234 | hostname
235 | in
236 | hostname
237 |
238 |
239 | Port of NRPE
240 |
241 |
242 |
243 |
244 | in
245 | port2
246 |
247 |
248 | Process Name
249 |
250 |
251 |
252 |
253 | in
254 | process
255 |
256 |
257 | CPU Usage
258 | on
259 |
260 |
261 |
262 | out
263 | CU
264 |
265 |
266 | Memory Usage
267 | on
268 |
269 |
270 |
271 | out
272 | MU
273 |
274 |
275 |
276 |
277 | Daily (5 Minute Average)
278 | 0.5
279 | 1
280 | 600
281 | 86400
282 | 1|3
283 |
284 |
285 | Weekly (30 Minute Average)
286 | 0.5
287 | 6
288 | 700
289 | 604800
290 | 1|3
291 |
292 |
293 | Monthly (2 Hour Average)
294 | 0.5
295 | 24
296 | 775
297 | 2678400
298 | 1|3
299 |
300 |
301 | Yearly (1 Day Average)
302 | 0.5
303 | 288
304 | 797
305 | 33053184
306 | 1|3
307 |
308 |
309 | Hourly (1 Minute Average)
310 | 0.5
311 | 1
312 | 500
313 | 14400
314 | 1|3
315 |
316 |
317 | Normal
318 | %8.2lf %s
319 |
320 |
--------------------------------------------------------------------------------
/nagios/check_account:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # check_account users 30
5 | #
6 | # Created by Statemood, 2013.08.11 19:50
7 | # Updated by Statemood, 2013.09.28 10.35
8 | # Statemood@gmail.com
9 | #
10 | # Project monitor:
11 | # https://github.com/Statemood/monitor
12 | # ------------------------------------------
13 |
14 | monfile="/etc/passwd"
15 | exceptsh=':/sbin/nologin$|:/bin/false$|:/bin/sync$|:/sbin/shutdown$|:/sbin/halt$'
16 | key="$2"
17 | ok=0
18 | warning=1
19 | critical=2
20 | unkonwn=3
21 |
22 | case "$1" in
23 | users)
24 | usercount=`cat $monfile | wc -l`
25 | if [ "$usercount" = "$key" ]
26 | then
27 | echo "OK - Total $usercount user accounts"
28 | exit 0
29 | else
30 | echo "CRITICAL - Total $usercount user accounts"
31 | exit 2
32 | fi
33 | ;;
34 | shell)
35 | shellcount=`egrep -v "$exceptsh" $monfile | wc -l`
36 | if [ "$shellcount" = "$key" ]
37 | then
38 | echo "OK - Total $shellcount users has a valid Shell"
39 | exit 0
40 | else
41 | echo "CRITICAL - Total $shellcount users has a valid Shell"
42 | exit 2
43 | fi
44 | ;;
45 | guid)
46 | guidcount=`awk -F ':' '{print $3,$4}' $monfile | egrep '^0 | 0$' | wc -l`
47 | if [ "$guidcount" = "$key" ]
48 | then
49 | echo "OK - Total $guidcount users's UID/GID is 0"
50 | exit 0
51 | else
52 | echo "CRITICAL - Total $guidcount users's UID/GID is 0"
53 | exit 2
54 | fi
55 | ;;
56 | sudo)
57 | sudocount=`grep -v '^#' /etc/sudoers | egrep 'ALL=|NOPASSWD' | wc -l`
58 | if [ "$sudocount" = "$key" ]
59 | then
60 | echo "OK - Total $sudocount users have permission to access sudo"
61 | exit 0
62 | else
63 | echo "CRITICAL - Total $sudocount users have permission to access sudo"
64 | exit 2
65 | fi
66 | ;;
67 | esac
68 |
--------------------------------------------------------------------------------
/nagios/check_dbsync:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # Created by Statemood, 2013.10.30 13:00
6 | # Updated by Statemood, 2013.10.30 14:00
7 | # Statemood@gmail.com
8 | #
9 | # Project mgutils:
10 | # https://github.com/Statemood/nagios-plugs
11 | # ------------------------------------------
12 |
13 | name="$1"
14 | item="$2"
15 |
16 | sl='127.0.0.1'
17 | exe='/usr/local/nagios/libexec/check_mongodb'
18 |
19 | proc(){
20 | ps aux | grep mongod | awk -F '/mongod ' '{print $2}' | grep "$name"
21 | }
22 |
23 | info(){
24 | $exe -H $1 -A $2 -P $3 -W 30 -C 50 | awk -F ': ' '{print $2}'
25 | }
26 |
27 | mp=27017
28 | ip=`proc | awk -F 'source=' '{print $2}' | awk -F ':' '{print $1}'`
29 | sp=`proc | awk -F 'port=' '{print $2}' | awk '{print $1}'`
30 |
31 | m=`info $ip $item $mp`
32 | s=`info $sl $item $sp`
33 |
34 | if [ $m = $s ] || [ `expr $m - $s` -lt 3 ]
35 | then
36 | echo "OK - MongoDB SLAVE $name $item is OK(m=$m, s=$s)"
37 | exit 0
38 | else
39 | echo "CRITICAL - MongoDB SLAVE $name $item is ERROR(m=$m, s=$s)"
40 | exit 2
41 | fi
42 |
--------------------------------------------------------------------------------
/nagios/check_fan:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2013.12.17 14:20
5 | # Updated by Statemood, 2013.12.17 15:00
6 | # Statemood@gmail.com
7 | #
8 | # Project:
9 | # https://github.com/Statemood/
10 | # ------------------------------------------
11 |
12 | warn="$1"
13 | crit="$2"
14 |
--------------------------------------------------------------------------------
/nagios/check_file_leak:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2013.08.22 10:00
5 | # Updated by Statemood, 2013.08.22 10:50
6 | # Statemood@gmail.com
7 | #
8 | # Project:
9 | # https://github.com/Statemood/
10 | # ------------------------------------------
11 |
12 | # 检查指定目录内是否存在可下载却不能下载的文件
13 | # Type:
14 | # .gz, .tgz, .tar, .bak
15 | # check_file_leak /data/www/web-root-dir ignore-name "\.tgz|\.gz|\.tar|\.rar|\.zip|\.xz|\.lz"
16 |
17 | checkdir="$1"
18 | excluded="$2"
19 | filetype="$3"
20 |
21 | tempfile=`mktemp /dev/shm/XXXXXXXXXXXXXXXX`
22 |
23 | EXIT_OKAY=0
24 | EXIT_WARN=1
25 | EXIT_CRIT=2
26 | EXIT_UNWN=3
27 |
28 | if [ ! -d "$checkdir" ]
29 | then
30 | echo -e "$checkdir not found"
31 | exit $EXIT_CRIT
32 | fi
33 |
34 | find "$checkdir" | egrep "$filetype" | egrep -v "$excluded" > $tempfile
35 |
36 | if [ -f "$tempfile" ]
37 | then
38 | count=`wc -l $tempfile | awk '{print $1}'`
39 | if [ "$count" = "0" ]
40 | then
41 | echo -e "OK - No downloadable files found in dir $checkdir"
42 | rm -rf $tempfile
43 | exit $EXIT_OKAY
44 | fi
45 |
46 | if [ "$count" = "1" ]
47 | then
48 | echo -e "WARNING - $count downloadable file found in dir $checkdir: $(basename `cat $tempfile`)"
49 | rm -rf $tempfile
50 | exit $EXIT_WARN
51 | fi
52 |
53 | if [ "$count" -gt 1 ]
54 | then
55 | echo -e "CRITICAL - $count downloadable files found in dir $checkdir"
56 | rm -rf $tempfile
57 | exit $EXIT_CRIT
58 | fi
59 |
60 | rm -rf $tempfile
61 | else
62 | echo -e "UNKNOWN - Internal Error detected program terminated"
63 | exit $EXIT_UNWN
64 | fi
65 |
66 |
--------------------------------------------------------------------------------
/nagios/check_ipmi:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2014.07.03 15:30
5 | # Updated by Statemood, 2014.07.04 12:00
6 | # Statemood@gmail.com
7 | #
8 | # Project nagios-plugs:
9 | # https://github.com/Statemood
10 | # ------------------------------------------
11 |
12 | IPMI=/dev/shm/temp/ipmi.info
13 |
14 | msg(){
15 | case $1 in
16 | 0)
17 | echo -e "OK - IPMI: $2";;
18 | 1)
19 | echo -e "WARNING - IPMI: $2";;
20 | 2)
21 | echo -e "CRITICAL - IPMI: $2";;
22 | 3)
23 | echo -e "UNKNOWN - IPMI: $2";;
24 | esac
25 | exit $1
26 | }
27 |
28 | for argv in "$@"
29 | do
30 | case $argv in
31 | -w|-min)
32 | VALU_WARN="$2"
33 | shift 2
34 | ;;
35 | -c|-max)
36 | VALU_CRIT="$2"
37 | shift 2
38 | ;;
39 | -i|--item)
40 | case $2 in
41 | amps)
42 | CUR_AMPS=`grep 'Amps' $IPMI | awk '{print $3}' | egrep -v 'na'`
43 | MSG_AMPS="Current Power AMPS is ${CUR_AMPS}A"
44 | [[ $CUR_AMPS > $VALU_CRIT ]] && msg 2 "$MSG_AMPS"
45 | [[ $CUR_AMPS > $VALU_WARN ]] && msg 1 "$MSG_AMPS"
46 | [[ $CUR_AMPS < $VALU_WARN ]] && msg 0 "$MSG_AMPS"
47 | ;;
48 | ambtmp)
49 | RAW_AMTP=`grep 'Ambient Temp' $IPMI | awk '{print $4}' | egrep -v 'na|disable' | awk -F '.' '{print $1}' | sort`
50 | case $3 in
51 | a) CUR_AMTP=`echo $RAW_AMTP | awk '{print $1}'`;;
52 | b) CUR_AMTP=`echo $RAW_AMTP | awk '{print $2}'`;;
53 | esac
54 | MSG_AMTP="Current Ambient Temperature is $CUR_AMTP°C"
55 | [[ $CUR_AMTP -gt $VALU_CRIT ]] && msg 2 "$MSG_AMTP"
56 | if [ $CUR_AMTP -gt $VALU_WARN ]
57 | then
58 | msg 1 "$MSG_AMTP"
59 | else
60 | msg 0 "$MSG_AMTP"
61 | fi
62 | ;;
63 | sysfan)
64 | RAW_SFAN=`grep 'FAN MOD' $IPMI | awk '{print $6}'`
65 | case "$3" in
66 | A)
67 | FAN_NAME="A"
68 | LOW_SFAN=`echo $RAW_SFAN | tr -s " " "\n" | head -6 | sort -n | head -1`
69 | LOW_LINE=`echo $RAW_SFAN | tr -s " " "\n" | head -6 | grep -n $LOW_SFAN | awk -F ':' '{print $1}' | sort -n | head -1`
70 | CUR_SFAN=`echo $RAW_SFAN | tr -s " " "\n" | head -6 | tr -s "\n" " "`
71 | ;;
72 | B)
73 | FAN_NAME="B"
74 | LOW_SFAN=`echo $RAW_SFAN | tr -s " " "\n" | tail -6 | sort -n | head -1`
75 | LOW_LINE=`echo $RAW_SFAN | tr -s " " "\n" | tail -6 | grep -n $LOW_SFAN | awk -F ':' '{print $1}' | sort -n | head -1`
76 | CUR_SFAN=`echo $RAW_SFAN | tr -s " " "\n" | tail -6 | tr -s "\n" " "`
77 | ;;
78 | esac
79 | MSG_SFAN="Current System FAN RPM(1${FAN_NAME}-6${FAN_NAME}) is at: $CUR_SFAN"
80 | if [ $LOW_SFAN -lt $VALU_CRIT ]
81 | then
82 | msg 2 "FAN $LOW_LINE$FAN_NAME RPM is $LOW_SFAN. $MSG_SFAN"
83 | else
84 | msg 0 "$MSG_SFAN"
85 | fi
86 | ;;
87 | planartmp)
88 | CUR_PLTP=`grep 'Planar Temp' $IPMI | awk '{print $4}'`
89 | MSG_PLTP="Current Planar Temperature is $CUR_PLTP°C"
90 | if [ $CUR_PLTP -gt $VALU_CRIT ]
91 | then
92 | msg 2 "$MSG_PLTP"
93 | elif [ $CUR_PLTP -gt $VALU_WARN ]
94 | then
95 | msg 1 "$MSG_PLTP"
96 | elif [ $CUR_PLTP -lt $VALU_WARN ]
97 | then
98 | msg 0 "$MSG_PLTP"
99 | else
100 | msg 3 "Cannot fetch data"
101 | fi
102 | ;;
103 | voltage)
104 | CUR_VOLT=`grep 'Voltage' $IPMI | awk '{print $3}' | egrep -v 'na|disable' | awk -F '.' '{print $1}'`
105 | MSG_VOLT="Current Power voltage is ${CUR_VOLT}V"
106 | if [ $CUR_VOLT -lt $VALU_WARN ] || [ $CUR_VOLT -gt $VALU_CRIT ]
107 | then
108 | msg 2 "$MSG_VOLT"
109 | else
110 | msg 0 "$MSG_VOLT"
111 | fi
112 | ;;
113 | watts)
114 | CUR_WATT=`grep 'System Level' $IPMI | awk '{print $4}' | awk -F '.' '{print $1}'`
115 | MSG_WATT="Current Power is ${CUR_WATT}W"
116 | if [ $CUR_WATT -gt $VALU_CRIT ]
117 | then
118 | msg 2 "$MSG_WATT"
119 | elif [ $CUR_WATT -gt $VALU_WARN ]
120 | then
121 | msg 1 "$MSG_WATT"
122 | else
123 | msg 0 "$MSG_WATT"
124 | fi
125 | ;;
126 | esac
127 | ;;
128 | esac
129 | done
130 |
--------------------------------------------------------------------------------
/nagios/check_mail_queue:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2013.08.27 10:00
5 | # Updated by Statemood, 2013.08.27 10:30
6 | # Statemood@gmail.com
7 | #
8 | # Project:
9 | # https://github.com/Statemood/
10 | # ------------------------------------------
11 |
12 | VALUE_WARN="$1"
13 | VALUE_CRIT="$2"
14 | emptymesge="Mail queue is empty"
15 | queuecount=`mailq | grep '^[0-9A-Z]' | grep -v "$emptymesge" | wc -l`
16 |
17 | if [ -z "$1" ]
18 | then
19 | echo -e "$(basename $0) Required arguments"
20 | echo -e "$(basename $0) wanging-value critical-value"
21 | exit 3
22 | fi
23 |
24 | echo -en "Postfix Mail Queue: "
25 | if [ "$queuecount" -gt "$VALUE_WARN" ]
26 | then
27 | echo -en "WARNING"
28 | EXIT_STATUS=1
29 | elif [ "$queuecount" -gt "$VALUE_CRIT" ]
30 | then
31 | echo -en "CRITICAL"
32 | EXIT_STATUS=2
33 | else
34 | echo -en "OK"
35 | EXIT_STATUS=0
36 | fi
37 | if [ "$queuecount" = "0" ]
38 | then
39 | queuecount="$emptymesge"
40 | fi
41 | echo -e " - Queue = $queuecount"
42 | exit $EXIT_STATUS
43 |
--------------------------------------------------------------------------------
/nagios/check_memory:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # Created by Statemood, 2013.12.09 13:30
6 | # Updated by Statemood, 2013.12.09 14:00
7 | # Statemood@gmail.com
8 | #
9 | # Project mgutils:
10 | # https://github.com/Statemood/nagios-plugs
11 | # ------------------------------------------
12 |
13 | warn="$1"
14 | crit="$2"
15 |
16 | m_total=`free -m | grep 'Mem' | awk '{print $2}'`
17 | m_used=`free -m | grep 'che:' | awk '{print $3}'`
18 | m_free=`free -m | grep 'che:' | awk '{print $4}'`
19 | m_cache=`free -m | grep 'Mem' | awk '{print $7}'`
20 |
21 | g_total=`echo "scale=2;$m_total / 1024" | bc`
22 | g_used=`echo "scale=2;$m_used / 1024" | bc`
23 | g_free=`echo "scale=2;$m_free / 1024" | bc`
24 | g_cache=`echo "scale=2;$m_cache / 1024" | bc`
25 |
26 |
27 | value_w=`echo "scale=2;$m_total * 0.01 * $warn" | bc | awk -F '.' '{print $1}'`
28 | value_c=`echo "scale=2;$m_total * 0.01 * $crit" | bc | awk -F '.' '{print $1}'`
29 |
30 | Standrd_msg(){
31 | echo "Memory usage: Total: ${g_total}GB, Used: ${g_used}GB, Cached: ${g_cache}GB, Free: ${g_free}GB"
32 | }
33 |
34 | if [ "$m_used" -ge "$value_c" ]
35 | then
36 | echo "CRITICAL - `Standrd_msg`"
37 | exit 2
38 | fi
39 |
40 | if [ "$m_used" -ge "$value_w" ]
41 | then
42 | echo "WARNING - `Standrd_msg`"
43 | exit 1
44 | else
45 | echo "OK - `Standrd_msg`"
46 | exit 0
47 | fi
48 | # Created by Statemood, 2013.09.02 14:00
49 | # Statemood@gmail.com
50 | #
51 | # Project:
52 | # https://github.com/Statemood/
53 | # ------------------------------------------
54 |
55 | # check_memory mem 85 95
56 | # check_memory swap 60 70
57 |
58 | tempdir=/dev/shm/temp
59 |
60 |
61 |
62 | case $1 in
63 | mem)
64 |
65 |
66 | swap)
67 |
68 | esac
69 |
--------------------------------------------------------------------------------
/nagios/check_mysql:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2013.08.18 12:35
5 | # Updated by Statemood, 2013.08.15 13:30
6 | # Statemood@gmail.com
7 | #
8 | # Project:
9 | # https://github.com/Statemood/
10 | # ------------------------------------------
11 |
12 | cmd='/usr/local/mysql/bin/mysql'
13 | hostip=''
14 | user=''
15 | pswd=''
16 | temp=`mktemp /dev/shm/XXXXXXXXXXXXXXXXXXXX`
17 |
18 | DBQuery(){
19 | $cmd -h $hostip -u $user -p$pswd -e "$1" 2> /dev/null
20 | }
21 |
22 | DBQuery "show global status" > $temp
23 | DBQuery "show variables" >> $temp
24 |
25 | t=`grep '^Uptime' $temp | head -1 | awk '{print $2}'`
26 | uptime=`date -d "@$t" +'%d days %T'`
27 | queries=`grep '^Queries' $temp | awk '{print $2}'`
28 | max_user_conn=`grep '^max_user_conn' $temp | awk '{print $2}'`
29 | max_connection=`grep '^max_connection' $temp | awk '{print $2}'`
30 | connect_used=`echo "scale=2;$max_user_conn / $max_connection" | bc`
31 | echo $connect_used | grep -q '^.' && connect_used=0$connect_used
32 |
33 | tmp_table=`grep Created_tmp_tables $temp | awk '{print $2}'`
34 | tmp_table_disk=`grep Created_tmp_disk_tables $temp | awk '{print $2}'`
35 | tmp_table_cret=`echo "scale=2;$tmp_table / $tmp_table_disk" | bc`
36 | echo $tmp_table_cret | grep -q '^.' && tmp_table_cret=0$tmp_table_cret
37 |
38 | open_tables=`grep 'Open_tables' $temp | awk '{print $2}'`
39 | opened_tables=`grep 'Opened_tables' $temp | awk '{print $2}'`
40 | open_tables_c=`grep 'table_open_cache' $temp | awk '{print $2}'`
41 |
42 |
43 | threads=`grep 'Threads_created' $temp | awk '{print $2}'`
44 |
45 |
46 | case $1 in
47 | status)
48 | echo "OK - $uptime. $threads threads. Connections used $connect_used%(<85%,). Created tmp tables $tmp_table, on disk $tmp_table_cret%(<25%). "
49 | ;;
50 | esac
51 |
52 | rm -rf $temp
53 |
--------------------------------------------------------------------------------
/nagios/check_nginx:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # Created by Statemood, 2013.12.19 14:30
6 | # Updated by Statemood, 2013.12.19 17:00
7 | # Statemood@gmail.com
8 | #
9 | # Project mgutils:
10 | # https://github.com/Statemood/nagios-plugs
11 | # ------------------------------------------
12 |
13 | item="$1"
14 | warn="$2"
15 | crit="$3"
16 | host="$4"
17 | link="$5"
18 | minac="50"
19 | temp=/dev/shm/temp/nagios
20 | stat=`mktemp $temp/XXXXXXXXXX`
21 | test -d $temp || mkdir $temp
22 | cd $temp
23 |
24 | usage(){
25 | echo -e "Usage: $0 item warn-value crit-value host link"
26 | exit $1
27 | }
28 |
29 | test "X$item" = "X" && usags
30 | test "$#" -lt 5 && usage
31 |
32 | get_stats(){
33 | curl --connect-timeout 5 --retry 1 -s $host/$link > $stat
34 |
35 | nhash=`echo $host | md5sum | awk '{print $1}'`
36 | newac=`head -1 $stat | awk '{print $3}'`
37 | newwa=`tail -1 $stat | awk '{print $6}'`
38 | otime=`cat $nhash | awk '{print $1}'`
39 | otime=$(echo `date +%s` - $otime | bc)
40 | oldac=`cat $nhash | awk '{print $2}'`
41 | oldwa=`cat $nhash | awk '{print $3}'`
42 |
43 | warn_ac=`echo "$newac * 0.01 * $warn + $oldac" | bc | awk -F '.' '{print $1}'`
44 | crit_ac=`echo "$newac * 0.01 * $crit + $oldac" | bc | awk -F '.' '{print $1}'`
45 |
46 | warn_wa=`echo "$newac * 0.01 * $warn + $newwa" | bc | awk -F '.' '{print $1}'`
47 | crit_wa=`echo "$newac * 0.01 * $crit + $newwa" | bc | awk -F '.' '{print $1}'`
48 |
49 | echo "`date +%s` $newac $newwa" > $nhash
50 | test -f "$stat" && rm -rf $stat
51 | }
52 |
53 |
54 | case $item in
55 | ac)
56 | get_stats
57 | ac_msg="Nginx Current Active Connections of $host: $newac, Last Check at `date -d @$otime +%-M` minutes ago: $oldac"
58 | if [ $newac -ge $crit_ac ] && [ $newac -ge $minac ]
59 | then
60 | echo -e "CRITICAL - $ac_msg"
61 | exit 2
62 | elif [ $newac -ge $warn_ac ] && [ $newac -ge $minac ]
63 | then
64 | echo -e "WARNING - $ac_msg"
65 | exit 1
66 | else
67 | echo -e "OK - $ac_msg"
68 | exit 0
69 | fi
70 | ;;
71 | esac
72 |
--------------------------------------------------------------------------------
/nagios/check_port:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2013.08.22 10:00
5 | # Updated by Statemood, 2013.08.22 10:50
6 | # Statemood@gmail.com
7 | #
8 | # Project:
9 | # https://github.com/Statemood/
10 | # ------------------------------------------
11 |
12 |
13 |
--------------------------------------------------------------------------------
/nagios/check_process:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # Created by Statemood, 2014.07.17 16:15
6 | # Updated by Statemood, 2015.06.04 17:38
7 | # Statemood@gmail.com
8 | #
9 | # Project monitor
10 | # https://github.com/Statemood/monitor
11 | # ------------------------------------------
12 |
13 | PROCESS="$1"
14 | PROC_H="`echo $PROCESS | cut -c 1`"
15 | PROC_T="`echo $PROCESS | cut -c 2-32`"
16 |
17 | OK="0"
18 | WARNING="1"
19 | CRITICAL="2"
20 | UNKNOWN="3"
21 |
22 | get_info(){
23 | proc_info=`ps aux | grep "$PROCESS" | egrep -v "grep |$(basename $0)"`
24 | proc_pid=`echo $proc_info | awk '{print $2}'`
25 | run_user=`echo $proc_info | awk '{print $1}'`
26 | run_date=`echo $proc_info | awk '{print $9}'`
27 | proc_date=`date -d "$run_date" +'%F %T'`
28 | usage_cpu="`echo $proc_info | awk '{print $3}'`%"
29 | usage_mem="`echo $proc_info | awk '{print $4}'`%"
30 | cpu_time="`echo $proc_info | awk '{print $10}'`"
31 | }
32 |
33 | ps aux | grep -q "[$PROC_H]$PROC_T"
34 | if [ $? = 0 ]
35 | then
36 | get_info
37 | echo -e "OK - Process $PROCESS is running with Pid $proc_pid by $run_user since $proc_date. CT: $cpu_time, CU: $usage_cpu, MU: $usage_mem"
38 | exit 0
39 | elif [ $? = 1 ]
40 | then
41 | echo -e "CRITICAL - Process $PROCESS is not running"
42 | exit 1
43 | else
44 | echo -e "UNKNOWN - Process $PROCESS: Status unknown"
45 | exit 3
46 | fi
47 |
48 |
--------------------------------------------------------------------------------
/nagios/check_raid:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2013.08.30 13:00
5 | # Updated by Statemood, 2013.09.02 16.15
6 | # Statemood@gmail.com
7 | #
8 | # Project:
9 | # https://github.com/Statemood/
10 | # ------------------------------------------
11 |
12 | opts="$1"
13 | disk="$2"
14 | warn="$3"
15 | crit="$4"
16 | line="15"
17 | logf=/dev/shm/temp/MegaSAS.log
18 | key_pfc="Predictive Failure"
19 | key_lpf="Last Predictive Failure Event Seq Number"
20 | key_str="Device Id|Media Error Count: |Other Error Count: |PD Type: |^Coerced Size:|Drive Temperature|Firmware state"
21 |
22 | get_raid_info(){
23 | raid_level=`grep 'RAID Level' $logf | awk -F 'Primary-' '{print $2}' | awk -F ',' '{print $1}'`
24 | raid_diskn=`grep 'Device Id' $logf | awk -F ': ' '{print $2}' | wc -l`
25 | raid_tsize=`grep 'Size ' $logf | awk -F ': ' '{print $2}' | head -1`
26 | raid_psize=`grep '^Coerced Size' $logf | uniq | head -1 | awk -F ': ' '{print $2}' | awk '{print $1}'`
27 |
28 | span_count=`grep 'Number Of Drives' $logf | awk -F ':' '{print $2}' | head -1`
29 | dept_count=`grep 'Span Depth' $logf | awk -F ':' '{print $2}' | head -1`
30 |
31 | if [ "$opts" = "raid" ]
32 | then
33 | raid_level="$disk"
34 | fi
35 |
36 | if [ -z "$raid_psize" ]
37 | then
38 | raid_psize=`grep 'Mirror Data' $logf | awk -F ': ' '{print $2}'`
39 | fi
40 | }
41 |
42 | get_di(){
43 | egrep "$key_lpf|$key_pfc|$key_str" $logf | grep -A $line "^Device Id: $disk"
44 | }
45 |
46 | get_disk_info(){
47 | get_raid_info
48 | diskid=`get_di | grep "^Device Id" | awk -F ': ' '{print $2}' | head -1`
49 | errmda=`get_di | grep "^Media Error" | awk -F ': ' '{print $2}' | head -1`
50 | erroth=`get_di | grep "^Other Error" | awk -F ': ' '{print $2}' | head -1`
51 | predfc=`get_di | grep "^Predictive F" | awk -F ': ' '{print $2}' | head -1`
52 | predsn=`get_di | grep "^Last Predict" | awk -F ': ' '{print $2}' | head -1`
53 | pdtype=`get_di | grep "^PD Type:" | awk -F ': ' '{print $2}' | head -1`
54 | pdsize=`get_di | grep "^Coerced Size" | awk -F ': ' '{print $2}' | awk -F ' ' '{print $1,$2}' | head -1`
55 | temper=`get_di | grep "Temperature" | awk -F ':' '{print $2}' | awk -F 'C' '{print $1}' | head -1`
56 | status=`get_di | grep "^Firmware sta" | awk -F ': ' '{print $2}' | awk -F ',' '{print $1}' | head -1`
57 | fail_pfc=`get_di | grep "^$key_pfc" | awk -F ': ' '{print $2}' | head -1`
58 | fail_lpf=`get_di | grep "^$key_lpf" | awk -F ': ' '{print $2}' | head -1`
59 | }
60 |
61 | Print_msg(){
62 | msg="- Disk $diskid $2"
63 | if [ "$1" -gt "$crit" ]
64 | then
65 | echo -e "CRITICAL $msg"
66 | exit 2
67 | elif [ "$1" -ge "$warn" ]
68 | then
69 | echo -e "WARNING $msg"
70 | exit 1
71 | elif [ "$1" -lt "$warn" ]
72 | then
73 | echo -e "OK $msg"
74 | exit 0
75 | else
76 | echo -e "UNKNOWN - Could not fetch information from server"
77 | exit 3
78 | fi
79 | }
80 | get_disk_info
81 |
82 | case $1 in
83 | raid)
84 | get_raid_info
85 | echo -e "RAID Level:$raid_level, Devices:$raid_diskn, Disk Size:$raid_psize, Total Size:$raid_tsize"
86 | ;;
87 | disk)
88 | msg="- Disk $diskid Status:$status(Type:$pdtype, Size:$pdsize)"
89 | if [ "$status" = "Online" ]
90 | then
91 | echo -e "OK $msg"
92 | exit 0
93 | elif [ "$status" = "Offline" ]
94 | then
95 | echo -e "CRITICAL $msg"
96 | exit 2
97 | else
98 | echo -e "UNKNOWN - Could not fetch information from server"
99 | exit 3
100 | fi
101 | ;;
102 | temp)
103 | Print_msg "$temper" "Temperature is $temper°C"
104 | ;;
105 | err_media)
106 | Print_msg "$errmda" "Media Error Count: $errmda"
107 | ;;
108 | err_other)
109 | Print_msg "$erroth" "Other Error Count: $erroth"
110 | ;;
111 | fail_lpf)
112 | Print_msg "$fail_lpf" "$key_lpf: $fail_lpf"
113 | ;;
114 | fail_pfc)
115 | Print_msg "$fail_pfc" "$key_pfc count: $fail_pfc"
116 | ;;
117 | esac
118 |
--------------------------------------------------------------------------------
/nagios/check_selinux:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # Created by Statemood, 2013.10.31 16:00
6 | # Updated by Statemood, 2013.10.31 16:05
7 | # Statemood@gmail.com
8 | #
9 | # Project mgutils:
10 | # https://github.com/Statemood/nagios-plugs
11 | # ------------------------------------------
12 |
13 | status=`sestatus | grep 'SELinux status:' | awk '{print $3}'`
14 | mode=`sestatus | grep 'Current mode:' | awk '{print $3}'`
15 |
16 | if [ "$status" = "enabled" ]
17 | then
18 | echo "OK - SELinux is Enabled, mode=$mode"
19 | exit 0
20 | elif [ "$status" = "disabled" ]
21 | then
22 | echo "CRITICAL - SELinux is Disabled, mode=$mode"
23 | exit 2
24 | else
25 | echo "UNKNOWN - SELinux status is unknown"
26 | exit 3
27 | fi
28 |
--------------------------------------------------------------------------------
/nagios/check_sysinfo:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # Created by Statemood, 2013.10.31 16:00
6 | # Updated by Statemood, 2013.10.31 16:05
7 | # Statemood@gmail.com
8 | #
9 | # Project mgutils:
10 | # https://github.com/Statemood/nagios-plugs
11 | # ------------------------------------------
12 |
13 | SNMP_INFO(){
14 | snmpwalk -v 2c -c idy_cti_mgr 127.0.0.1 $1
15 | }
16 |
17 | get_uptime(){
18 | s=`SNMP_INFO hrSystem | egrep 'hrSystemUptime|hrSystemDate'`
19 | uptime="`echo $s | grep 'Uptime' | awk -F ') ' '{print $2}'`"
20 | sydate="`echo $s | grep 'Date' | awk -F 'STRING: ' '{print $2}'`"
21 | }
22 |
23 |
24 |
--------------------------------------------------------------------------------
/nagios/check_temperature:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2013.08.27 12:00
5 | # Updated by Statemood, 2013.12.17 13:45
6 | # Statemood@gmail.com
7 | #
8 | # Project:
9 | # https://github.com/Statemood/
10 | # ------------------------------------------
11 | # item CPU warn crit
12 | # check_temperature cpu 0 70 80
13 |
14 | opts="$1"
15 | name="$2"
16 | warn="$3"
17 | crit="$4"
18 |
19 | ipminfo=/dev/shm/temp/ipmi-sensor.info
20 |
21 | temp_cpu(){
22 | cpucores=`grep 'cpu cores' /proc/cpuinfo | uniq | awk -F ': ' '{print $2}'`
23 | cpucount=`grep 'processor' /proc/cpuinfo | wc -l`
24 | cpucount=`expr $cpucount / $cpucores`
25 |
26 | sensors | grep -A $cpucores "^Physical id $name" | sed -e 's/Physical id/CPU/' -e 's/ +//' | \
27 | awk '{print $1,$2,$3}' | sed -e 's/Core.[0-9]\+:/,/' | tr -s "\n" " " | \
28 | sed 's/ ,/, Cores:/' | sed 's/ ,/,/g'
29 | }
30 | temp_cpu_var(){
31 | ct=`temp_cpu`
32 | temphigh=`echo $ct | awk -F '(' '{print $1}' | awk -F ':' '{print $2}' | awk -F '.' '{print $1}'`
33 | tempcore=`echo $ct | awk -F 'Cores: ' '{print $2}'`
34 | }
35 |
36 | case $opts in
37 | cpu)
38 | temp_cpu_var
39 | msg="CPU $name temperature is $temphigh°C, Cores 0-`expr $cpucores - 1`: $tempcore"
40 | if [ "$temphigh" -gt "$crit" ]
41 | then
42 | echo -e "CRITICAL - $msg"
43 | exit 2
44 | elif [ "$temphigh" -gt "$warn" ]
45 | then
46 | echo -e "WARNING - $msg"
47 | exit 1
48 | else
49 | echo -e "OK - $msg"
50 | exit 0
51 | fi
52 | ;;
53 |
54 | ambient)
55 | ambitemp=`grep "Ambient Temp" $ipminfo | awk '$4 != "na"' | awk '{print $4}' | awk -F '.' '{print $1}'`
56 | msg="Ambient temperature is $ambitemp°C"
57 |
58 | if [ "$ambitemp" -gt "$crit" ]
59 | then
60 | echo -e "CRITICAL - $msg"
61 | exit 2
62 | elif [ "$ambitemp" -gt "$warn" ]
63 | then
64 | echo -e "WARNING - $msg"
65 | exit 1
66 | else
67 | echo -e "OK - $msg"
68 | exit 0
69 | fi
70 | ;;
71 | esac
72 |
--------------------------------------------------------------------------------
/nagios/check_temperature_cpu:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2013.08.27 12:00
5 | # Updated by Statemood, 2013.08.27 15:00
6 | # Statemood@gmail.com
7 | #
8 | # Project:
9 | # https://github.com/Statemood/
10 | # ------------------------------------------
11 | # CPU core warn crit
12 | # check_temperature_cpu 0 4 70 80
13 |
14 | VALUE_NAME="$1"
15 | VALUE_CORE="$2"
16 | VALUE_WARN="$3"
17 | VALUE_CRIT="$4"
18 |
19 | temp_cpu_print(){
20 | printline=`expr $VALUE_CORE + 3`
21 | sensors | sed -n "/coretemp-isa-000${VALUE_NAME}/,${printline}p" | sed -n "3,${printline}p" | \
22 | sed -e 's/Physical id/CPU/' -e 's/\+//' | awk '{print $3}' | tr -s "\n" "," | sed -e 's/,$//'
23 | }
24 |
25 | cputemp=`temp_cpu_print | awk -F ',' '{print $1}'`
26 | tempnum=`echo $cputemp | awk -F '.' '{print $1}'`
27 | tempcre=`temp_cpu_print | sed "s/^$cputemp,//"`
28 |
29 | if [ -z "$cputemp" ]
30 | then
31 | echo -e "UNKNOWN - CPU names error"
32 | exit 3
33 | fi
34 |
35 | if [ "$tempnum" -gt "$VALUE_CRIT" ]
36 | then
37 | echo -e "CRITICAL - CPU $VALUE_NAME temperature is $cputemp, Cores 0-`expr $VALUE_CORE - 1` = $tempcre"
38 | exit 2
39 | elif [ "$tempnum" -gt "$VALUE_WARN" ]
40 | then
41 | echo -e "WARNING - CPU $VALUE_NAME temperature is $cputemp, Cores 0-`expr $VALUE_CORE - 1` = $tempcre"
42 | exit 1
43 | else
44 | echo -e "OK - CPU $VALUE_NAME temperature is $cputemp, Cores 0-`expr $VALUE_CORE - 1` = $tempcre"
45 | exit 0
46 | fi
47 |
--------------------------------------------------------------------------------
/nagios/check_web:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # Created by Statemood, 2013.08.11 19:50
6 | # Updated by Statemood, 2013.09.28 10.35
7 | # Statemood@gmail.com
8 | #
9 | # Project mgutils:
10 | # https://github.com/Statemood/nagios-plugs
11 | # ------------------------------------------
12 |
13 |
14 |
--------------------------------------------------------------------------------
/nagios/nrpereload:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # Created by Statemood, 2013.10.31 16:15
6 | # Updated by Statemood, 2013.10.31 16:20
7 | # Statemood@gmail.com
8 | #
9 | # Project mgutils:
10 | # https://github.com/Statemood/nagios-plugs
11 | # ------------------------------------------
12 |
13 | killall -9 nrpe
14 | /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
15 |
--------------------------------------------------------------------------------
/zabbix/bbu.info:
--------------------------------------------------------------------------------
1 |
2 | BBU status for Adapter: 0
3 |
4 | BatteryType: BBU
5 | Voltage: 4010 mV
6 | Current: 0 mA
7 | Temperature: 25 C
8 | Battery State: Optimal
9 | BBU Firmware Status:
10 |
11 | Charging Status : None
12 | Voltage : OK
13 | Temperature : OK
14 | Learn Cycle Requested : No
15 | Learn Cycle Active : No
16 | Learn Cycle Status : OK
17 | Learn Cycle Timeout : No
18 | I2c Errors Detected : No
19 | Battery Pack Missing : No
20 | Battery Replacement required : No
21 | Remaining Capacity Low : No
22 | Periodic Learn Required : No
23 | Transparent Learn : No
24 | No space to cache offload : No
25 | Pack is about to fail & should be replaced : No
26 | Cache Offload premium feature required : No
27 | Module microcode update required : No
28 |
29 |
30 | GasGuageStatus:
31 | Fully Discharged : No
32 | Fully Charged : No
33 | Discharging : Yes
34 | Initialized : Yes
35 | Remaining Time Alarm : No
36 | Discharge Terminated : No
37 | Over Temperature : No
38 | Charging Terminated : No
39 | Over Charged : No
40 | Relative State of Charge: 89 %
41 | Charger Status: Complete
42 | Remaining Capacity: 193 mAh
43 | Full Charge Capacity: 218 mAh
44 | isSOHGood: No
45 | Battery backup charge time : 0 hours
46 |
47 | BBU Capacity Info for Adapter: 0
48 |
49 | Relative State of Charge: 89 %
50 | Absolute State of charge: 11 %
51 | Remaining Capacity: 193 mAh
52 | Full Charge Capacity: 218 mAh
53 | Run time to empty: Battery is not being charged.
54 | Average time to empty: Battery is not being charged.
55 | Estimated Time to full recharge: Battery is not being charged.
56 | Cycle Count: 31
57 | Max Error = 0 %
58 | Remaining Capacity Alarm = 170 mAh
59 | Remining Time Alarm = 10 Min
60 |
61 | BBU Design Info for Adapter: 0
62 |
63 | Date of Manufacture: 04/24, 2009
64 | Design Capacity: 1700 mAh
65 | Design Voltage: 3700 mV
66 | Specification Info: 33
67 | Serial Number: 4950
68 | Pack Stat Configuration: 0x0008
69 | Manufacture Name: SANYO
70 | Firmware Version :
71 | Device Name: DLNU209
72 | Device Chemistry: LION
73 | Battery FRU: N/A
74 | Transparent Learn = 0
75 | App Data = 0
76 |
77 | BBU Properties for Adapter: 0
78 |
79 | Auto Learn Period: 90 Days
80 | Next Learn time: Sun Feb 12 09:56:33 2017
81 | Learn Delay Interval:0 Hours
82 | Auto-Learn Mode: Enabled
83 |
84 | Exit Code: 0x00
85 |
--------------------------------------------------------------------------------
/zabbix/check_ceph:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Project Monitor
5 | # https://github.com/Statemood/monitor
6 | #
7 | # Lin Ru Lin.Ru@msn.com
8 | # ------------------------------------------
9 |
10 | osd_stats (){ ceph osd stat | awk "{print \$$1}" ; }
11 | osd_pools (){ ceph status | grep 'pools: ' | awk "{print \$$1}" ; }
12 | osd_usage_data (){ ceph -s | grep 'usage:' | awk -F "$1" "{print \$$2}" ; }
13 | osd_usage_used (){ osd_usage_data , 1 | awk -F ':' '{print $2}' ; }
14 | osd_usage_avail (){ osd_usage_data / 1 | awk -F ',' '{print $2}' ; }
15 | osd_usage_total (){ osd_usage_data / 2 ; }
16 | osd_usage_objects(){ ceph -s | grep 'objects' | awk "{print \$$1}" ; }
17 | osd_usage_objsize(){ osd_usage_objects '4,$5' ; }
18 |
19 | osd_usage(){
20 | s="`$1 | awk '{print $2}'`"
21 | n="`$1 | awk '{print $1}'`"
22 |
23 | case $s in
24 | MB) echo "$(($n * 1024 * 1024))" ;;
25 | GB) echo "$(($n * 1024 * 1024 * 1024))" ;;
26 | TB) echo "$(($n * 1024 * 1024 * 1024 * 1024))" ;;
27 | esac
28 | }
29 | ceph_health(){
30 | hs="`ceph -s | grep 'health:' | awk -F ': ' '{print $2}'`"
31 |
32 | case $hs in
33 | HEALTH_OK) echo 0 ;;
34 | HEALTH_WARN) echo 1 ;;
35 | HEALTH_ERR) echo 2 ;;
36 | esac
37 | }
38 | io_client(){
39 | # $1, 1 = Read bps 2 = Write bps 3 = Read IOPS 4 = Write IOPS
40 | ceph -s | grep -A 1 "io:" | tail -1 | awk -F ':' '{print $2}' | awk -F ',' "{print \$$1}"
41 | }
42 |
43 | io_msg(){
44 | n=` io_client $1 | awk '{print $1}'`
45 | s="`io_client $1 | awk '{print $2}' | awk -F '/' '{print $1}'`"
46 |
47 | case $s in
48 | op|B) res="$n" ;;
49 | kB) res=`echo "$(($n * 1024))"` ;;
50 | mB) res=`echo "$(($n * 1024 * 1024))"` ;;
51 | esac
52 |
53 | test -z "$res" && echo 0 || echo $res
54 | }
55 |
56 | obj_number(){
57 | obj_str="`osd_usage_objects 2`"
58 | obj_num=`echo $obj_str | awk -F '[kmg]' '{print $1}'`
59 |
60 | echo "$(($obj_num * 1000))"
61 | }
62 |
63 | case $1 in
64 | osd_total) osd_stats 1 ;;
65 | osd_up) osd_stats 3 ;;
66 | osd_in) osd_stats 5 ;;
67 | pools) osd_pools 2 ;;
68 | pgs) osd_pools 4 ;;
69 | io_r) io_msg 1 ;; # Read B/s
70 | io_w) io_msg 2 ;; # Write B/s
71 | ops_r) io_msg 3 ;; # OPS Read per sec
72 | ops_w) io_msg 4 ;; # OPS Write per sec
73 | health) ceph_health ;;
74 | used) osd_usage osd_usage_used ;;
75 | avail) osd_usage osd_usage_avail ;;
76 | total) osd_usage osd_usage_total ;;
77 | obj_num) obj_number ;;
78 | obj_size) osd_usage osd_usage_objsize ;;
79 | esac
80 |
--------------------------------------------------------------------------------
/zabbix/check_cpu_cores_discovery:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # https://github.com/Statemood/monitor
6 | # ------------------------------------------
7 |
8 | gen_data(){
9 | for core in `grep "^processor.*" /proc/cpuinfo | awk '{print $3}'`
10 | do
11 | echo "${core}"
12 | done
13 | }
14 | data=(`gen_data`)
15 |
16 | len=${#data[@]}
17 |
18 | printf "{\n"
19 | printf '\t'"\"data\":["
20 | for ((i=0;i<$len;i++))
21 | do
22 | printf '\n\t\t{'
23 | printf "\"{#COREID}\":\"${data[$i]}\"}"
24 | if [ $i -lt $[$len-1] ]
25 | then
26 | printf ','
27 | fi
28 | done
29 |
30 | printf "\n\t]\n"
31 | printf "}\n"
--------------------------------------------------------------------------------
/zabbix/check_cpu_physical_cores_discovery:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # https://github.com/Statemood/monitor
6 | # ------------------------------------------
7 |
8 | gen_data(){
9 | for cpu in `grep '^physical id' /proc/cpuinfo | sort | uniq | awk -F ': ' '{print $2}'`
10 | do
11 | for core in `sensors -A | sed -e '/./{H;$!d;}' -e "x;/coretemp-isa-000$cpu/b" -e d | grep '^Core [0-9].' | awk -F ':' '{print $1}' | awk '{print $2}'`
12 | do
13 | echo "${cpu}_${core}"
14 | done
15 | done
16 | }
17 | data=(`gen_data`)
18 |
19 | len=${#data[@]}
20 |
21 | printf "{\n"
22 | printf '\t'"\"data\":["
23 | for ((i=0;i<$len;i++))
24 | do
25 | printf '\n\t\t{'
26 | printf "\"{#PCOREID}\":\"${data[$i]}\"}"
27 | if [ $i -lt $[$len-1] ]
28 | then
29 | printf ','
30 | fi
31 | done
32 |
33 | printf "\n\t]\n"
34 | printf "}\n"
--------------------------------------------------------------------------------
/zabbix/check_cpu_physical_id_discovery:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding=utf-8
3 |
4 | import os
5 | import json
6 |
7 | cpu_count = os.popen("grep '^physical id' /proc/cpuinfo | sort | uniq | awk -F ': ' '{print $2}'")
8 | cpus = []
9 | for cpu in cpu_count.readlines():
10 | r = os.path.basename(cpu.strip())
11 | cpus += [{'{#CPUID}':r}]
12 |
13 | print json.dumps({'data':cpus},sort_keys=True,indent=4,separators=(',',':'))
--------------------------------------------------------------------------------
/zabbix/check_cpu_temperature:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # https://github.com/Statemood/monitor
6 | # ------------------------------------------
7 |
8 | # CPU temperature
9 | #
10 | # $0 --cpu 0 --core 1 --temperature
11 |
12 | temp_data(){
13 | sensors -A |\
14 | sed -e '/./{H;$!d;}' -e "x;/coretemp-isa-000$cpu/b" -e d |\
15 | grep "^Core $core:" |\
16 | awk '{print $3}' |\
17 | awk -F '[+.]' '{print $2}' |\
18 | sort -n |\
19 | tail -1
20 | }
21 |
22 | cpu="`echo $1 | sed 's/_/ /' | awk '{print $1}'`"
23 | core="`echo $1 | sed 's/_/ /' | awk '{print $2}'`"
24 |
25 | temp_data
--------------------------------------------------------------------------------
/zabbix/check_disk_device:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # https://github.com/Statemood/monitor
6 | # ------------------------------------------
7 |
8 | # line of the disk info filtered by '^Solt Number: X'
9 | disk_line=50
10 |
11 | # DISK DETAILS: filter
12 | DiskInfo(){
13 | sudo /opt/megaraid/megacli -PDList -aALL -NoLog |\
14 | grep -A $disk_line "^Slot Number: $slot_number" |\
15 | grep "^$key" |\
16 | awk -F ':' '{print $2}' |\
17 | sed 's/^ //'
18 | }
19 |
20 | for arg in "$@"
21 | do
22 | case $arg in
23 | slot)
24 | slot_number="$2"
25 | shift 2
26 | ;;
27 | item)
28 | case $2 in
29 | connected_port)
30 | key="Connected Port Number"
31 | DiskInfo | awk -F '(' '{print $1}'
32 | exit
33 | ;;
34 | temperature)
35 | key="Drive Temperature"
36 | DiskInfo | awk -F 'C' '{print $1}'
37 | exit
38 | ;;
39 | firmware_state)
40 | key="Firmware state"
41 | DiskInfo | awk -F ',' '{print $1}'
42 | exit
43 | ;;
44 | inquiry_data)
45 | key="Inquiry Data"
46 | DiskInfo | tr -s " " "," | sed 's/,$//' | sed 's/,/ /g'
47 | exit
48 | ;;
49 | raw_size)
50 | key="Raw Size"
51 | DiskInfo | awk '{print $1}'
52 | exit
53 | ;;
54 | last_predictive_failure) key="Last Predictive Failure Event Seq Number" ;;
55 | predictive_failure) key="Predictive Failure Count" ;;
56 | device_id) key="Device Id" ;;
57 | media_error) key="Media Error Count" ;;
58 | other_error) key="Other Error Count" ;;
59 | media_type) key="Media Type" ;;
60 | pd_type) key="PD Type" ;;
61 | shield_counter) key="Shield Counter" ;;
62 | slot_number) key="Slot Number" ;;
63 | speed_device) key="Device Speed" ;;
64 | speed_link) key="Link Speed" ;;
65 | wwn) key="WWN" ;;
66 | esac
67 |
68 | DiskInfo
69 | ;;
70 | esac
71 | done
--------------------------------------------------------------------------------
/zabbix/check_disk_devices_discovery:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding=utf-8
3 |
4 | import os
5 | import json
6 |
7 | t = os.popen("sudo /opt/megaraid/megacli -PDList -aALL -NoLog | grep '^Slot Number' | awk -F ': ' '{print $2}' | sort -n")
8 |
9 | disks = []
10 | for disk in t.readlines():
11 | r = os.path.basename(disk.strip())
12 | disks += [{'{#PDISK}':r}]
13 | print json.dumps({'data':disks},sort_keys=True,indent=4,separators=(',',':'))
--------------------------------------------------------------------------------
/zabbix/check_disk_devices_discovery.md:
--------------------------------------------------------------------------------
1 | #RAID info discovery
2 |
3 |
4 | 需要 root 通过 crontab 来更新 raid & disk 信息
5 |
6 | > * * * * * root /usr/local/bin/megacli -PDList –a0 -NoLog > /dev/shm/disk.info
7 | > * * * * * root /usr/local/bin/megacli -adpallinfo -a0 -NoLog > /dev/shm/raid.info
--------------------------------------------------------------------------------
/zabbix/check_diskstats:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # https://github.com/Statemood/monitor
6 | # ------------------------------------------
7 |
8 | # Data read from /proc/diskstats
9 |
10 | # Description:
11 | # The /proc/diskstats file displays the I/O statistics
12 | # of block devices. Each line contains the following 14 fields:
13 | # 1 - major number
14 | # 2 - minor mumber
15 | # 3 - device name
16 | # 4 - reads completed successfully
17 | # 5 - reads merged
18 | # 6 - sectors read
19 | # 7 - time spent reading (ms)
20 | # 8 - writes completed
21 | # 9 - writes merged
22 | # 10 - sectors written
23 | # 11 - time spent writing (ms)
24 | # 12 - I/Os currently in progress
25 | # 13 - time spent doing I/Os (ms)
26 | # 14 - weighted time spent doing I/Os (ms)
27 | # For more details refer to https://www.kernel.org/doc/Documentation/iostats.txt
28 |
29 | for arg in "$@"
30 | do
31 | case $arg in
32 | --disk)
33 | disk="$2"
34 | shift 2
35 | ;;
36 | --key)
37 | case $2 in
38 | reads_completed) num=4 ;;
39 | reads_merged) num=5 ;;
40 | sectors_read) num=6 ;;
41 | time_spent_reading) num=7 ;;
42 | writes_completed) num=8 ;;
43 | writes_merged) num=9 ;;
44 | sectors_written) num=10 ;;
45 | time_spent_writing) num=11 ;;
46 | io_currently_progress) num=12 ;;
47 | time_spent_io) num=13 ;;
48 | weighted_time_spent_io) num=14 ;;
49 | esac
50 | ;;
51 | esac
52 | done
53 |
54 | grep "[hs]d[a-z]" /proc/diskstats | grep "$disk " | awk "{print \$$num}"
--------------------------------------------------------------------------------
/zabbix/check_diskstats_discovery:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding=utf-8
3 |
4 | # ------------------------------------------
5 | # Project Monitor
6 | # https://github.com/Statemood/monitor
7 | #
8 | # Lin.Ru@msn.com
9 | # ------------------------------------------
10 |
11 | import os
12 | import json
13 |
14 | t = os.popen("grep '[hsv]d[a-z]' /proc/diskstats | awk '{print $3}'")
15 |
16 | disks = []
17 | for disk in t.readlines():
18 | r = os.path.basename(disk.strip())
19 | disks += [{'{#DISKDEV}':r}]
20 | print json.dumps({'data':disks},sort_keys=True,indent=4,separators=(',',':'))
--------------------------------------------------------------------------------
/zabbix/check_docker_container_discovery:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | # ------------------------------------------
4 | # Project Monitor
5 | # https://github.com/Statemood/monitor
6 | #
7 | # Lin.Ru@msn.com
8 | # ------------------------------------------
9 |
10 | #coding=utf-8
11 |
12 | import os
13 | import json
14 |
15 | t = os.popen("sudo docker ps -a --format={{.Names}}")
16 |
17 | o = []
18 | for c in t.readlines():
19 | o += [{'{#CONTAINER}': os.path.basename(c.strip())}]
20 |
21 | print json.dumps({'data':o},sort_keys=True,indent=4,separators=(',',': '))
--------------------------------------------------------------------------------
/zabbix/check_docker_container_discovery.sudo:
--------------------------------------------------------------------------------
1 | # File: /etc/sudoers.d/docker-container-list
2 |
3 | Cmnd_Alias DOCKERCONTAINERLIST = /usr/bin/docker ps -aq
4 |
5 | zabbix ALL=(root) NOPASSWD: DOCKERCONTAINERLIST
--------------------------------------------------------------------------------
/zabbix/check_docker_stats:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 | # --------------------------------------------------
3 | # Project Monitor
4 | # https://github.com/Statemood/monitor
5 | #
6 | # Created by Lin Ru Lin.Ru@msn.com
7 | # Updated by Xingyou Chen
8 | # --------------------------------------------------
9 |
10 | id="$1"
11 | arg="$2"
12 |
13 | if [ "$#" -lt 2 ]
14 | then
15 | echo "Missing arguments"
16 | exit 1
17 | fi
18 | cmd="sudo docker stats --no-stream"
19 | arg1="--format {{.Container}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}"
20 | arg2="\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}"
21 |
22 | stats=($($cmd $id $arg1$arg2))
23 |
24 | raw() {
25 | # KB,MB,GB are used under net IO and block IO
26 | KiB=1024
27 | KB=1000
28 | MB=$(($KB * 1000))
29 | GB=$(($MB * 1000))
30 | MiB=$(($KiB * 1024))
31 | GiB=$(($MiB * 1024))
32 | cnt=$(echo $1 | tr -cd "[0-9.]")
33 |
34 | case $1 in
35 | *"GiB") bc <<< "$cnt * $GiB" ;;
36 | *"GB") bc <<< "$cnt * $GB" ;;
37 | *"MiB") bc <<< "$cnt * $MiB" ;;
38 | *"MB") bc <<< "$cnt * $MB" ;;
39 | *"KiB") bc <<< "$cnt * $KiB" ;;
40 | *"kB") bc <<< "$cnt * $KB" ;;
41 | *"B") echo $cnt ;;
42 | *"%") echo $cnt ;;
43 | *) echo $1 ;;
44 | esac
45 | }
46 |
47 | get(){
48 | sudo docker inspect $id | jq .[0]$1 | sed 's/"//g'
49 | }
50 |
51 | case $arg in
52 | name) echo "${stats[1]}" ;;
53 | net_i) raw "${stats[7]}" ;;
54 | net_o) raw "${stats[9]}" ;;
55 | block_i) raw "${stats[10]}" ;;
56 | block_o) raw "${stats[12]}" ;;
57 | mem_usage) raw "${stats[3]}" ;;
58 | mem_limit) raw "${stats[5]}" ;;
59 | mem_percent) raw "${stats[6]}" ;;
60 | cpu_percent) raw "${stats[2]}" ;;
61 | error) get ".State.Error" ;;
62 | startedat) get ".State.StartedAt" ;;
63 | restartcount) get ".RestartCount" ;;
64 | driver) get ".Driver" ;;
65 | privileged) get ".Privileged" ;;
66 | user) get ".Config.User" ;;
67 | image) get ".Image" ;;
68 | ip) get ".NetworkSettings.IPAddress" ;;
69 | cpu_limit) echo $(echo "scale=3;`get '.HostConfig.CpuQuota'` / 1000 / 1000" | bc) ;;
70 | status) r=`get ".State.Status"`
71 | test "$r" = "running" && echo 0 || echo 1 ;;
72 | esac
--------------------------------------------------------------------------------
/zabbix/check_docker_stats.sudo:
--------------------------------------------------------------------------------
1 | # File: /etc/sudoers.d/docker-stats
2 |
3 | Cmnd_Alias DOCKERSTAT = /usr/bin/docker stats --no-stream [a-f0-9]*
4 |
5 | Cmnd_Alias DOCKERINFO = /usr/bin/docker inspect [a-f0-9]*
6 |
7 | Cmnd_Alias DOCKERLIST = /usr/bin/docker ps -aq
8 |
9 | zabbix ALL=(root) NOPASSWD: DOCKERSTAT, DOCKERINFO, DOCKERLIST
--------------------------------------------------------------------------------
/zabbix/check_etcd:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Project Monitor
5 | # https://github.com/Statemood/monitor
6 | #
7 | # Lin Ru Lin.Ru@msn.com
8 | # ------------------------------------------
9 |
10 | msg(){
11 | echo $1
12 | exit $1
13 | }
14 |
15 | ip="`hostname -i`"
16 | ssl="/etc/kubernetes/ssl"
17 | ca="$ssl/ca.pem"
18 | cert="$ssl/etcd-`hostname -s`.pem"
19 | key="$ssl/etcd-`hostname -s`.key"
20 |
21 | etcdctl --endpoints=https://$ip:2379 \
22 | --ca-file=$ca \
23 | --cert-file=$cert \
24 | --key-file=$key cluster-health | \
25 | grep 'is healthy' | \
26 | grep "$ip" -q
27 |
28 | test $? = 0 && msg 0 || msg 1
--------------------------------------------------------------------------------
/zabbix/check_http:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # Usage:
4 | # check_http --host 11 --port 33 --item --action <0 or 1> --url
5 |
6 | curl=/usr/local/curl/bin/curl
7 | logdir="/tmp/monitors"
8 |
9 | test -x $curl || curl=curl
10 | test -d "$logdir" || mkdir "$logdir"
11 |
12 | es_host=""
13 | port=80
14 |
15 | es_index="logstash-`date -d '483 minutes ago' +%Y.%m.%d`,logstash-`date -d '480 minutes ago' +%Y.%m.%d`"
16 |
17 | if [ "$1" = "count" ]
18 | then
19 | case $2 in
20 | rules)
21 | dc_rule="$(dirname $(dirname $0))/etc/http-discovery.list"
22 | egrep -v "^#|^$" $dc_rule | wc -l
23 | ;;
24 | services)
25 | $(dirname $0)/check_http_discovery | grep '^{"{#HTTP' | wc -l
26 | ;;
27 | esac
28 | exit 0
29 | fi
30 |
31 | if [ "$#" -lt 5 ]
32 | then
33 | echo 100001
34 | exit 1
35 | fi
36 |
37 | args="$@"
38 | for arg in "$@"
39 | do
40 | case $arg in
41 | --host)
42 | host="$2"
43 | shift 2
44 | ;;
45 | --port)
46 | port="$2"
47 | shift 2
48 | ;;
49 | --item)
50 | item="$2"
51 | shift 2
52 | ;;
53 | --action)
54 | action="$2"
55 | shift 2
56 | ;;
57 | --url)
58 | url="$2"
59 | shift 2
60 | ;;
61 | --value)
62 | value="$2"
63 | shift 2
64 | ;;
65 | --uuid)
66 | uuid="$2"
67 | shift 2
68 | ;;
69 | --keyword)
70 | keyword="$2"
71 | shift 2
72 | ;;
73 | esac
74 | done
75 |
76 | logfile="/tmp/monitors/$uuid.log"
77 | if [ "$item" = "time_total" ]
78 | then
79 | # 防止time_total类型检测覆盖http_code检测
80 | logfile=/dev/null
81 | fi
82 |
83 | echo "$args" > $logfile
84 |
85 | test $port = 443 && protocol=https || protocol=http
86 |
87 | if [ "$action" = 0 ]
88 | then
89 | return_code=`$curl $protocol://$host:${port}${url} --max-time 4 --trace-time -v -s -o /dev/null -w %{$item} 2>> $logfile`
90 | test -z "$return_code" && echo 0 || echo $return_code
91 | elif [ "$action" = 2 ]
92 | then
93 | content=`curl -s --max-time 4 --trace-time -v $protocol://$host:${port}${url} 2>> $logfile`
94 |
95 | regex=`base64 -d <<< $keyword 2> /dev/null`
96 | if [ $? -ne 0 ]
97 | then
98 | echo "解码正则[$keyword]错误,请修复后重试!" >> $logfile
99 | echo 500
100 | exit 0
101 | fi
102 |
103 | if grep -Pq "$regex" <<< $content 2> /dev/null
104 | then
105 | echo $value
106 | else
107 | echo "正则[$regex]未匹配,返回值:" >> $logfile
108 | echo "$content" >> $logfile
109 | echo 500
110 | fi
111 |
112 | exit 0
113 | elif [ "$action" = 3 ]
114 | then
115 | $(dirname $0)/check_business.php "$host" "$port" "$url" "$keyword" "$uuid" "$value"
116 | else
117 | if [ "$item" = "http_code" ]
118 | then
119 | query='{"size":3,"query":{"bool":{"filter":[{"range":{"@timestamp":{"gte":"now-3m","lte":"now-2m"}}},{"term":{"server_name.keyword":"'$host'"}},{"wildcard":{"request_url.keyword":"'$url'"}}],"must_not":{"term":{"status.keyword":"'$value'"}}}},"sort":[{"status.keyword":"desc"}]}'
120 | #
121 | result=`curl -s --max-time 4 --trace-time -v -XGET "$es_host/$es_index/_search?pretty" -d "$query" 2>> $logfile`
122 |
123 | # 请求错误
124 | if ! grep -Pq '"total"\s*:\s*\d+' <<< $result
125 | then
126 | # 每天八点之后的数据会保存到新的索引,没有新数据时查询会报错
127 | if grep -q "index_not_found_exception" <<< $result && [ "`date -d '480 minutes ago' +%H`" = "00" ]
128 | then
129 | echo $value
130 | exit 0
131 | fi
132 |
133 | echo "返回值:" >> $logfile
134 | echo "$result" >> $logfile
135 |
136 | echo 999
137 | exit 0
138 | fi
139 |
140 | # 没有找到“status"表示没有错误,否则返回找到的状态码或错误码
141 | status=$(grep -Po '"status"\s*:\s*"\d+"' <<< $result)
142 | if [ -z "$status" ]
143 | then
144 | echo $value
145 | else
146 | echo "返回值:" >> $logfile
147 | echo "$result" >> $logfile
148 |
149 | grep -Po -m 1 '\d+' <<< "$status" || echo 998
150 | fi
151 | exit 0
152 | fi
153 |
154 | if [ "$item" = "time_total" ]
155 | then
156 | query='{"size":1,"query":{"bool":{"filter":[{"range":{"@timestamp":{"gte":"now-3m","lte":"now-2m"}}},{"term":{"server_name.keyword":"'$host'"}},{"wildcard":{"request_url.keyword":"'$url'"}}]}},"sort":[{"request_time.keyword":"desc"}]}'
157 | result=`curl -s --max-time 4 -XGET "$es_host/$es_index/_search?filter_path=hits.total,hits.hits._source.request_time" -d "$query"`
158 |
159 | # 请求错误
160 | if ! grep -q "total" <<< $result
161 | then
162 | echo 0
163 | exit 0
164 | fi
165 |
166 | time=`grep -Po '"request_time"\s*:\s*"[\d.]+"' <<< $result`
167 | grep -Po '[\d.]+' <<< $time || echo 0
168 | exit 0
169 | fi
170 | fi
171 |
--------------------------------------------------------------------------------
/zabbix/check_http_discovery:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # --------------------------------------------------
4 | # Project monitor:
5 | # https://github.com/Statemood/monitor
6 | #
7 | #
8 | # --------------------------------------------------
9 |
10 | tag=1
11 | count=1
12 | number=1
13 | temp=`mktemp /tmp/XXXXXXXXXXXX`
14 | config="$(dirname $(dirname $0))/etc/http-discovery.list"
15 |
16 | # Generate http discovery list ($config)
17 | $(dirname $0)/generate_http_discovery_list
18 |
19 | if [ ! -f "$config" ]
20 | then
21 | echo "Error: config file not found"
22 | exit 1
23 | fi
24 |
25 | PrintDiscoveryList(){
26 | for i in $list
27 | do
28 | n=1
29 | if [ $tag = 0 ]
30 | then
31 | host="$ip_head.$i"
32 | else
33 | test "$host" = "0" && host="$ip_head.$i" && n=0
34 | fi
35 |
36 | server="$ip_range0-$i"
37 | items_0="{\"{#HTTP.SERVICE}\": \"$service\", \"{#HTTP.SERVER}\": \"$server\", "
38 | items_1="\"{#HTTP.HOST}\": \"$host\", \"{#HTTP.IP}\": \"$ip_head.$i\", "
39 | items_2="\"{#HTTP.PORT}\": $port, \"{#HTTP.CODE}\": $code, \"{#HTTP.URI}\": \"$uri\", "
40 | items_3="\"{#HTTP.ID}\": \"$id\"}"
41 |
42 | echo "$items_0$items_1$items_2$items_3" >> $temp
43 |
44 | test $n = 0 && host=0
45 | done
46 | }
47 |
48 | grep -v "^#" $config | sed '/^$/d' |\
49 | while read line
50 | do
51 | service="`echo $line | awk -F ':' '{print $1}'`"
52 | host="`echo $line | awk -F ':' '{print $2}'`"
53 | ip="`echo $line | awk -F ':' '{print $3}'`"
54 | port="`echo $line | awk -F ':' '{print $4}'`"
55 | code="`echo $line | awk -F ':' '{print $5}'`"
56 | uri="`echo $line | awk -F ':' '{print $6}'`"
57 | id="`echo $line | awk -F ':' '{print $7}'`"
58 |
59 | test -z "$host" && host=0
60 | test -z "$ip" && ip=0 && tag=0
61 | test -z "$port" && port=80
62 | test -z "$code" && code=200
63 | test -z "$uri" && uri="/"
64 |
65 | test "$ip" = "$host" && test "$ip" = 0 && continue
66 |
67 | ip_head="`echo $ip | awk -F '.' '{print $1,$2,$3}' | sed 's/ /./g'`"
68 | ip_tail="`echo $ip | awk -F '.' '{print $4}'`"
69 |
70 | # for 192.168.1.10-20, 22-25
71 | test $ip = 0 && ip="$host"
72 | echo "$ip" | grep "\-" | grep -q ","
73 | if [ $? = 0 ]
74 | then
75 | for ipa in `echo $ip_tail | sed 's/,/ /g'`
76 | do
77 | for s in $ipa
78 | do
79 | ip_range1="`echo $s | awk -F '-' '{print $1}'`"
80 | ip_range2="`echo $s | awk -F '-' '{print $2}'`"
81 |
82 | test -z "$ip_range2" && ip_range2=$ip_range1
83 |
84 | for ((list=$ip_range1; list<=$ip_range2; list++))
85 | do
86 | PrintDiscoveryList
87 | done
88 | done
89 | done
90 |
91 | continue
92 | fi
93 |
94 | # for 192.168.1.10-20
95 | echo "$ip" | grep -q "\-"
96 | if [ $? = 0 ]
97 | then
98 | # transfer 10-20 to 10 and 20
99 | ip_range0="`echo $ip | awk -F '.' '{print $3}'`"
100 | ip_range1="`echo $ip | awk -F '.' '{print $4}' | awk -F '-' '{print $1}'`"
101 | ip_range2="`echo $ip | awk -F '.' '{print $4}' | awk -F '-' '{print $2}'`"
102 |
103 | test -z "$ip_range2" && ip_range2=$ip_range1
104 |
105 | for ((list=$ip_range1; list<=$ip_range2; list++))
106 | do
107 | PrintDiscoveryList
108 | done
109 | continue
110 | fi
111 |
112 | # for 192.168.1.10,20,30
113 | echo "$ip" | grep -q ','
114 | if [ $? = 0 ]
115 | then
116 | for list in `echo $ip | awk -F '.' '{print $4}' | sed 's/,/ /g'`
117 | do
118 | PrintDiscoveryList
119 | done
120 | fi
121 | done
122 |
123 | total=`wc -l $temp | awk '{print $1}'`
124 | printf '{\n\t'"\"data\":["
125 | while read line
126 | do
127 | if [ $count = $total ]
128 | then
129 | echo "$line"
130 | #echo "{\"{#TOTAL.ITEMS}\": $total}"
131 | else
132 | echo "$line,"
133 | echo $((count++)) > /dev/null
134 | fi
135 | done < $temp
136 |
137 | printf "\n\t]\n}\n"
138 |
139 | test -f "$temp" && rm -rf "$temp"
140 |
--------------------------------------------------------------------------------
/zabbix/check_http_discovery.conf-example:
--------------------------------------------------------------------------------
1 | # service name:host:ip:port:http_code:url
2 | #
3 | # service name
4 | # Host domain, default(empty) use ip
5 | # IP ip address, default is empty
6 | # PORT default is 80
7 | # http_code default is 200
8 | # url default is '/'
9 |
10 | # 192.168.1.150, 151, 152, 153
11 | API Service:192.168.1.150-153::::
12 | :www.abc.com:192.168.1.100:8080:403:/not-index.html
13 |
--------------------------------------------------------------------------------
/zabbix/check_iostat:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # https://github.com/Statemood/monitor
6 | # ------------------------------------------
7 |
8 | data(){
9 | iostat -p -x -k | grep "^$disk " | awk "{print \$$num}"
10 | }
11 |
12 | for arg in "$@"
13 | do
14 | case $arg in
15 | --disk)
16 | disk="$2"
17 | shift 2
18 | ;;
19 | --item)
20 | case $2 in
21 | rrqms) num=2 ;;
22 | wrqms) num=3 ;;
23 | rs) num=4 ;;
24 | ws) num=5 ;;
25 | rkbs) # Set units to B for Zabbix
26 | num=6
27 | echo "scale=2;`data` * 1024" | bc
28 | exit
29 | ;;
30 |
31 | wkbs) # Set units to B for Zabbix
32 | num=7
33 | echo "scale=2;`data` * 1024" | bc
34 | exit
35 | ;;
36 | avgrq) num=8 ;;
37 | avgqu) num=9 ;;
38 | await) num=10 ;;
39 | rawait) num=11 ;;
40 | wawait) num=12 ;;
41 | svctm) num=13 ;;
42 | util) num=14 ;;
43 | tps) iostat -d | grep "^$disk" | awk '{print $2}' && exit ;;
44 | esac
45 | ;;
46 | esac
47 | done
48 |
49 | data
--------------------------------------------------------------------------------
/zabbix/check_ipmi:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2014.07.03 15:30
5 | # Updated by Statemood, 2014.07.04 12:00
6 | # Statemood@gmail.com
7 | #
8 | # Project nagios-plugins:
9 | # https://github.com/Statemood
10 | # ------------------------------------------
11 |
12 | key="`echo $1 | tr '_' ' '`"
13 | ipmi_info="/dev/shm/ipmi.info"
14 |
15 | grep -i "$key" $ipmi_info | awk -F '|' '{print $2}' | awk '{print $1}'
16 |
--------------------------------------------------------------------------------
/zabbix/check_ipmi_discovery:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # https://github.com/Statemood/monitor
6 | # ------------------------------------------
7 |
8 | # modprobe ipmi_msghandler
9 | # modprobe ipmi_devintf
10 | # modprobe ipmi_si
11 |
12 | ipmi_info=/dev/shm/ipmi.info
13 |
14 | data=(`awk -F '|' '{print $1}' $ipmi_info |\
15 | egrep -v "^Temp " |\
16 | tr -s " " "_" |\
17 | sed 's/_$//' |\
18 | sort`)
19 |
20 | len=${#data[@]}
21 |
22 | printf "{\n"
23 | printf '\t'"\"data\":["
24 | for ((i=0;i<$len;i++))
25 | do
26 | printf '\n\t\t{'
27 | printf "\"{#IPMI_KEY}\":\"${data[$i]}\"}"
28 | if [ $i -lt $[$len-1] ]
29 | then
30 | printf ','
31 | fi
32 | done
33 |
34 | printf "\n\t]\n"
35 | printf "}\n"
36 |
--------------------------------------------------------------------------------
/zabbix/check_ipmi_discovery_fan:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # https://github.com/Statemood/monitor
6 | # ------------------------------------------
7 |
8 | # modprobe ipmi_msghandler
9 | # modprobe ipmi_devintf
10 | # modprobe ipmi_si
11 |
12 | ipmi_info=/dev/shm/ipmi.info
13 |
14 | data=(`awk -F '|' '{print $1,",",$2,",",$3}' $ipmi_info |\
15 | egrep "^FAN |^Fan " |\
16 | egrep -i "ok|rpm" |\
17 | grep -v '0x00' |\
18 | awk -F ',' '{print $1}' |\
19 | tr -s " " "_" |\
20 | sed 's/_$//' |\
21 | sort`)
22 |
23 | len=${#data[@]}
24 |
25 | printf "{\n"
26 | printf '\t'"\"data\":["
27 | for ((i=0;i<$len;i++))
28 | do
29 | printf '\n\t\t{'
30 | printf "\"{#IPMI_KEY}\":\"${data[$i]}\"}"
31 | if [ $i -lt $[$len-1] ]
32 | then
33 | printf ','
34 | fi
35 | done
36 |
37 | printf "\n\t]\n"
38 | printf "}\n"
--------------------------------------------------------------------------------
/zabbix/check_ipmi_old:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Created by Statemood, 2014.07.03 15:30
5 | # Updated by Statemood, 2014.07.04 12:00
6 | # Statemood@gmail.com
7 | #
8 | # Project nagios-plugins:
9 | # https://github.com/Statemood
10 | # ------------------------------------------
11 |
12 | argv="$1"
13 | IPMI="/dev/shm/ipmi.info"
14 |
15 | case $argv in
16 | ambtmp)
17 | grep 'Ambient Temp' $IPMI | awk '{print $4}' | egrep -v 'na|disable' | awk -F '.' '{print $1}'
18 | ;;
19 |
20 | fan*)
21 | fanid=`echo $argv | awk -F 'fan' '{print $2}'`
22 | grep "FAN MOD $fanid" $IPMI | awk '{print $6}' | awk -F '.' '{print $1}'
23 | ;;
24 |
25 | amps)
26 | grep 'Amps' $IPMI | awk '{print $3}' | egrep -v 'na'
27 | ;;
28 |
29 | voltage)
30 | grep 'Voltage' $IPMI | awk '{print $3}' | egrep -v 'na|disable' | awk -F '.' '{print $1}'
31 | ;;
32 |
33 | watts)
34 | grep 'Watts' $IPMI | awk '{print $4}' | awk -F '.' '{print $1}'
35 | ;;
36 | esac
37 |
--------------------------------------------------------------------------------
/zabbix/check_k8s_master:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | # Project Monitor
5 | # https://github.com/Statemood/monitor
6 | #
7 | # Lin Ru Lin.Ru@msn.com
8 | # ------------------------------------------
9 |
10 | host="`hostname -i`"
11 | port="6443"
12 | api="https://$host:$port"
13 | ssl="/etc/kubernetes/ssl"
14 | ca="$ssl/ca.pem"
15 | pem="$ssl/kubelet-`hostname -s`.pem"
16 | key="$ssl/kubelet-`hostname -s`.key"
17 |
18 | http_code="`curl -sq -m 5 -o /dev/null $api -w %{http_code} --cacert $ca --cert $pem --key $key`"
19 |
20 | msg(){
21 | echo $1
22 | exit $1
23 | }
24 |
25 | test $http_code = 200 && msg 0 || msg 1
26 |
--------------------------------------------------------------------------------
/zabbix/check_list.crontab:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | ## Set crontab, every 2 minutes
4 |
5 | d=/dev/shm
6 |
7 | # Get RAID data
8 | /opt/megaraid/megacli -PDList -aALL -NoLog > $d/disk.info
9 | /opt/megaraid/megacli -AdpAllInfo -aALL -NoLog > $d/raid.info
10 |
11 | # Disable if no bbu found.
12 | #/opt/megaraid/megacli -AdpBbuCmd -aAll -NoLog > $d/bbu.info
13 |
14 | # Get IMPI data
15 | /usr/bin/ipmitool sdr > $d/ipmi.info
--------------------------------------------------------------------------------
/zabbix/check_memcached:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python
2 |
3 | #coding=utf8
4 |
5 | import os
6 | import sys
7 |
8 | host = sys.argv[1]
9 | port = sys.argv[2]
10 | key = sys.argv[3]
11 |
12 | conn = host + ':' + port
13 |
14 | class GetMemStatus():
15 | def __init__(self):
16 | self.val = {}
17 |
18 | def check(self):
19 | try:
20 | import memcache
21 | self.mc = memcache.Client([conn], debug=0)
22 | except:
23 | raise Exception, 'Please install the memcache plugin'
24 |
25 | def extract(self, key):
26 | stats = self.mc.get_stats()
27 | try:
28 | if key in stats[0][1]:
29 | self.val[key] = stats[0][1][key]
30 | return self.val[key]
31 | except:
32 | raise Exception, 'Error: not found key in stats'
33 |
34 | def main():
35 | a = GetMemStatus()
36 | a.check()
37 | print a.extract(key)
38 |
39 | if __name__ == "__main__":
40 | main()
41 |
--------------------------------------------------------------------------------
/zabbix/check_memcached.md:
--------------------------------------------------------------------------------
1 | # check_memcached
2 |
3 | ## Get stats from memcached for Zabbix
4 |
5 |
6 | check_memcached host-or-ip port key
7 |
8 | ***
9 |
10 | Based on [zabbix monitor redis memcached with python script](http://www.0550go.com/monitor/zabbix/zabbix-monitor-redis-memcached-with-python-script.html)
11 |
--------------------------------------------------------------------------------
/zabbix/check_memcached_discovery:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import json
4 |
5 | t=os.popen("""netstat -natp|awk -F: '/memcached/&&/LISTEN/{print $2}'|awk '{print $1}' | sed '/^$/d'""")
6 |
7 | ports = []
8 | for port in t.readlines():
9 | r = os.path.basename(port.strip())
10 | ports += [{'{#MEMCACHEDPORT}':r}]
11 | print json.dumps({'data':ports},sort_keys=True,indent=4,separators=(',',':'))
12 |
--------------------------------------------------------------------------------
/zabbix/check_mongodb:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # --------------------------------------------------
4 | # https://github.com/Statemood/monitor
5 | #
6 | # --------------------------------------------------
7 |
8 | #
9 |
10 | mongo_exec=mongo
11 | mongo_opts=""
12 |
13 | allowed_keys="opcounters"
14 | ignored_keys="^MongoDB shell|^connecting to|^bye"
15 | preproc_keys="NumberLong"
16 |
17 | value=`echo "db.serverStatus().$1" | $mongo_exec $mongo_opts | egrep -v "$ignored_keys"`
18 |
19 | case $1 in
20 | localTime)
21 | echo $value | awk -F '"' '{print $2}' | tr -s TZ " "
22 | exit 0
23 | ;;
24 | mem*)
25 | test "$1" = "mem.bits" && echo $value || echo "$value * 1024" | bc
26 | exit 0
27 | ;;
28 | esac
29 |
30 | echo $value | egrep -iq "$preproc_keys"
31 |
32 | test $? = 0 && echo $value | awk -F '[()]' '{print $2}' || echo $value
33 |
--------------------------------------------------------------------------------
/zabbix/check_mongodb.md:
--------------------------------------------------------------------------------
1 | # check_mongodb - Get MongoDB Status for Zabbix
2 |
3 | 从 MongoDB db.serverStatus() 获取信息
4 |
5 | [serverStatus](https://docs.mongodb.com/manual/reference/command/serverStatus/)
6 |
7 | ***
8 |
9 | ## Zabbix Items Key
10 |
11 | * check.mongodb[asserts.regular]
12 | * check.mongodb[asserts.rollovers]
13 | * check.mongodb[asserts.user]
14 | * check.mongodb[asserts.msg]
15 | * check.mongodb[connections.available]
16 | * check.mongodb[connections.current]
17 | * check.mongodb[mem.bits]
18 | * check.mongodb[mem.mapped]
19 | * check.mongodb[mem.mappedWithJournal]
20 | * check.mongodb[mem.resident]
21 | * check.mongodb[mem.virtual]
22 | * check.mongodb[network.bytesIn]
23 | * check.mongodb[network.bytesOut]
24 | * check.mongodb[opcounters.command]
25 | * check.mongodb[opcounters.delete]
26 | * check.mongodb[opcounters.getmore]
27 | * check.mongodb[opcounters.insert]
28 | * check.mongodb[opcounters.query]
29 | * check.mongodb[opcounters.update]
30 | * check.mongodb[extra_info.page_faults]
31 | * check.mongodb[localTime]
32 | * check.mongodb[process]
33 | * check.mongodb[uptime]
34 | * check.mongodb[version]
35 |
36 | 参数会被直接添加在 db.serverStatus() 之后以获取相关值,如 db.serverStatus().mem.bits
37 |
--------------------------------------------------------------------------------
/zabbix/check_mysql:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # --------------------------------------------------
4 | # Project monitor:
5 | # https://github.com/Statemood/monitor
6 | #
7 | # --------------------------------------------------
8 |
9 | #
10 | # check_mysql -h host --port port -u user -p password -i item
11 |
12 | port=3306
13 | user="zabbix"
14 | exec="/usr/local/bin/mysql"
15 |
16 | result(){
17 | opts="-s --connect-timeout 5 -h $host -u $user --port $port -p$password "
18 | $exec $opts -e "show status like '$item';" 2> /dev/null | awk '{print $2}' | tail -1
19 | }
20 |
21 | for arg in "$@"
22 | do
23 | case $arg in
24 | -h|--host)
25 | host="$2"
26 | shift 2
27 | ;;
28 | --port)
29 | port=$2
30 | shift 2
31 | ;;
32 | -u|--user)
33 | user="$2"
34 | shift 2
35 | ;;
36 | -p|--password)
37 | password="$2"
38 | shift 2
39 | ;;
40 | -i|--item)
41 | item="$2"
42 | ;;
43 | esac
44 | done
45 |
46 | result=`result`
47 |
48 | test -z "$result" && echo 1 || echo $result
49 |
--------------------------------------------------------------------------------
/zabbix/check_nginx_status:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # https://github.com/Statemood/monitor
6 | # ------------------------------------------
7 |
8 | # $0 --url URL --item xxx
9 |
10 | port=80
11 | host="localhost"
12 |
13 | request(){
14 | curl -s http://$host:$port$url
15 | }
16 |
17 | for arg in "$@"
18 | do
19 | case $arg in
20 | -h|--host)
21 | host="$2"
22 | shift 2
23 | ;;
24 | -p|--port)
25 | port="$2"
26 | shift 2
27 | ;;
28 | -u|--url)
29 | url="$2"
30 | shift 2
31 | ;;
32 | -i|--item)
33 | item="$2"
34 | shift 2
35 | ;;
36 | esac
37 | done
38 |
39 | case $item in
40 | reading) request | tail -1 | awk '{print $2}' ;;
41 | writing) request | tail -1 | awk '{print $4}' ;;
42 | waiting) request | tail -1 | awk '{print $6}' ;;
43 | active) request | head -1 | awk '{print $3}' ;;
44 | connections) request | tail -2 | head -1 | awk '{print $1}' ;;
45 | handled) request | tail -2 | head -1 | awk '{print $2}' ;;
46 | requests) request | tail -2 | head -1 | awk '{print $3}' ;;
47 | esac
48 |
--------------------------------------------------------------------------------
/zabbix/check_oracle:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | library="$(dirname $0)/check_oracle_library"
4 | test -f $library && . $library || exit 1
5 |
6 | case $item in
7 | discovery_disk_groups)
8 | Command "select distinct name from gv\$asm_diskgroup" | egrep -v '^$|^--|^NAME|^no rows selected'
9 | ok=0
10 | ;;
11 |
12 | discovery_instances)
13 | Command "select instance_name from gv\$instance" | egrep -v '^$|^--|^INSTANCE_NAME|^no rows selected'
14 | ok=0
15 | ;;
16 |
17 | discovery_table_spaces)
18 | Command "select name ts from gv\$tablespace" | egrep -v '^$|^--|^TS|^[0-9]+ rows selected'
19 | ok=0
20 | ;;
21 |
22 | alive)
23 | sql="select 1 from dual" ;;
24 |
25 | archive_log_switch)
26 | sql="select count(*) from gv\$log_history where first_time >= (sysdate - 1 / 24)" ;;
27 |
28 | db_block_gets)
29 | sql="select sum (value) from gv\$sysstat where name = 'db block gets'" ;;
30 |
31 | db_block_changes)
32 | sql="select sum (value) from gv\$sysstat where name = 'db block changes'" ;;
33 |
34 | db_consistent_gets)
35 | sql="select sum (value) from gv\$sysstat where name = 'consistent gets'" ;;
36 |
37 | db_physical_reads)
38 | sql="select sum (value) from gv\$sysstat where name = 'physical reads'" ;;
39 |
40 | db_hit_ratio)
41 | sql="select ( sum (case name when 'consistent gets' then value else 0 end) + sum (case name when 'db block gets' then value else 0 end) - sum (case name when 'physical reads' then value else 0 end)) / ( sum (case name when 'consistent gets' then value else 0 end) + sum (case name when 'db block gets' then value else 0 end)) * 100 from gv\$sysstat" ;;
42 |
43 | db_version)
44 | sql="select banner from gv\$version where banner like '%Oracle Database%'"
45 | GetData && exit
46 | ;;
47 | hit_ratio_body)
48 | sql="select gethitratio * 100 from gv\$librarycache where namespace = 'BODY'" ;;
49 |
50 | hit_ratio_sql_area)
51 | sql="select gethitratio * 100 from gv\$librarycache where namespace = 'SQL AREA'" ;;
52 |
53 | hit_ratio_trigger)
54 | sql="select gethitratio * 100 from gv\$librarycache where namespace = 'TRIGGER'" ;;
55 |
56 | hit_ratio_table_proc)
57 | sql="select gethitratio * 100 from gv\$librarycache where namespace = 'TABLE/PROCEDURE'" ;;
58 |
59 | miss_latch)
60 | sql="select sum (misses) from gv\$latch" ;;
61 |
62 | pga_aggregate_target)
63 | sql="select value from gv\$pgastat where name = 'aggregate PGA target parameter'" ;;
64 |
65 | pga)
66 | sql="select value from gv\$pgastat where name = 'total PGA inuse'" ;;
67 |
68 | phio_data_file_reads)
69 | sql="select sum (value) from gv\$sysstat where name = 'physical reads direct'" ;;
70 |
71 | phio_data_file_writes)
72 | sql="select sum (value) from gv\$sysstat where name = 'physical writes direct'" ;;
73 |
74 | phio_redo_writes)
75 | sql="select sum (value) from gv\$sysstat where name = 'redo writes'" ;;
76 |
77 | pin_hit_ratio_body)
78 | sql="select pins / (pins + reloads) * 100 from gv\$librarycache where namespace = 'BODY'" ;;
79 |
80 | pin_hit_ratio_sql_area)
81 | sql="select pins / (pins + reloads) * 100 from gv\$librarycache where namespace = 'SQL AREA'" ;;
82 |
83 | pin_hit_ratio_trigger)
84 | sql="select pins / (pins + reloads) * 100 from gv\$librarycache where namespace = 'TRIGGER'" ;;
85 |
86 | pin_hit_ratio_table_proc)
87 | sql="select pins / (pins + reloads) * 100 from gv\$librarycache where namespace = 'TABLE/PROCEDURE'" ;;
88 |
89 | #pool_dict_cache maybe empty, check and insert zero instead
90 | pool_dict_cache)
91 | sql="select bytes from gv\$sgastat where pool = 'shared pool' and name = 'dictionary cache'" ;;
92 |
93 | pool_free_mem)
94 | sql="select bytes from gv\$sgastat where pool = 'shared pool' and name = 'free memory'" ;;
95 |
96 | # pool_lib_cache maybe empty, check and insert zero instead
97 | pool_lib_cache)
98 | sql="select bytes from gv\$sgastat where pool = 'shared pool' and name = 'library cache'" ;;
99 |
100 | #pool_sql_area maybe empty, check and insert zero instead
101 | pool_sql_area)
102 | sql="select bytes from gv\$sgastat where pool = 'shared pool' and name = 'sql area'" ;;
103 |
104 | pool_misc)
105 | sql="select sum (bytes) from gv\$sgastat where pool = 'shared pool' and name not in ('library cache', 'dictionary cache', 'free memory', 'sql area')" ;;
106 |
107 | max_procs)
108 | sql="select value from gv\$parameter where name = 'processes'" ;;
109 |
110 | proc_num)
111 | sql="select count (*) from gv\$process" ;;
112 |
113 | max_session)
114 | sql="select value from gv\$parameter where name = 'sessions'" ;;
115 |
116 | session)
117 | sql="select count (*) from gv\$session" ;;
118 |
119 | session_system)
120 | sql="select count (*) from gv\$session where type = 'BACKGROUND'" ;;
121 |
122 | session_active)
123 | sql="select count (*) from gv\$session where type != 'BACKGROUND' and status = 'ACTIVE'" ;;
124 |
125 | session_inactive)
126 | sql="select count (*) from gv\$session where type != 'BACKGROUND' and status = 'INACTIVE'" ;;
127 |
128 | sga_buffer_cache)
129 | sql="select sum (bytes) from gv\$sgastat where name in ('db_block_buffers', 'buffer_cache')" ;;
130 |
131 | sga_fixed)
132 | sql="select sum (bytes) from gv\$sgastat where name = 'fixed_sga'" ;;
133 |
134 | sga_java_pool)
135 | sql="select sum (bytes) from gv\$sgastat where pool = 'java pool'" ;;
136 |
137 | sga_large_pool)
138 | sql="select sum (bytes) from gv\$sgastat where pool = 'large pool'" ;;
139 |
140 | sga_shared_pool)
141 | sql="select sum (bytes) from gv\$sgastat where pool = 'shared pool'" ;;
142 |
143 | sga_log_buffer)
144 | sql="select sum (bytes) from gv\$sgastat where name = 'log_buffer'" ;;
145 |
146 | uptime)
147 | sql="select to_char ( (sysdate - startup_time) *24*60 , 'FM99999999999999990') from gv\$instance" ;;
148 |
149 | waits_directpath_read)
150 | sql="select total_waits from gv\$system_event where event = 'direct path read'" ;;
151 |
152 | waits_file_io)
153 | sql="select nvl (sum (total_waits), 0) from gv\$system_event where event in ('file identify', 'file open')" ;;
154 |
155 | waits_control_file_io)
156 | sql="select sum (total_waits) from gv\$system_event where event in ('control file sequential read' , 'control file single write' , 'control file parallel write')" ;;
157 |
158 | waits_log_write)
159 | sql="select sum (total_waits) from gv\$system_event where event in ('log file single write', 'log file parallel write')" ;;
160 |
161 | waits_log_sync)
162 | sql="select sum(total_waits) from gv\$system_event where event = 'log file sync'" ;;
163 |
164 | waits_multi_block_read)
165 | sql="select sum (total_waits) from gv\$system_event where event = 'db file scattered read'" ;;
166 |
167 | waits_single_block_read)
168 | sql="select sum (total_waits) from gv\$system_event where event = 'db file sequential read'" ;;
169 |
170 | #waits_sqlnet maybe empty, check and insert zero instead
171 | waits_sql_net)
172 | sql="select count(*) from (select rootid from (select level lvl, connect_by_root (inst_id || '.' || sid) rootid, seconds_in_wait from gv\$session start with blocking_session is null connect by nocycle prior inst_id = blocking_instance and prior sid = blocking_session) where lvl > 1 group by rootid having sum(seconds_in_wait) > 300)" ;;
173 | esac
174 |
175 | test -z "$item" && exit
176 |
177 | GetData | awk '{print $1}'
--------------------------------------------------------------------------------
/zabbix/check_oracle_discovery:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | item="$1"
4 | key="$2"
5 |
6 | library="$(dirname $0)/check_oracle_library"
7 | test -f $library && . $library || exit 1
8 |
9 | data=(`$check_oracle $item`)
10 |
11 | len=${#data[@]}
12 |
13 | printf "{\n"
14 | printf '\t'"\"data\":["
15 | for ((i=0;i<$len;i++))
16 | do
17 | printf '\n\t\t{'
18 | printf "\"{#$key}\":\"${data[$i]}\"}"
19 | if [ $i -lt $[$len-1] ]
20 | then
21 | printf ','
22 | fi
23 | done
24 |
25 | printf "\n\t]\n"
26 | printf "}\n"
--------------------------------------------------------------------------------
/zabbix/check_oracle_library:
--------------------------------------------------------------------------------
1 | item="$1"
2 | db_username="zabbix"
3 | db_password="zabbix#Mon*2021"
4 | oracle_env="/etc/zabbix/oracle_env"
5 | check_oracle="$(dirname $0)/check_oracle"
6 |
7 | test $USER != zabbix && exit 1
8 | test -f $oracle_env && . $oracle_env || exit 1
9 |
10 | Command(){
11 | sqlplus -s "$db_username/$db_password" < bbu.info
8 |
9 | bbu=$1
10 | tag=$2
11 |
12 | GetData(){
13 | sudo /opt/megaraid/megacli -AdpBbuCmd -a$bbu -NoLog | grep "$key" | awk -F ': ' '{print $2}'
14 | }
15 |
16 | case $tag in
17 | ALM) key="Auto-Learn Mode" ;;
18 | ALP) key="Auto Learn Period" ;;
19 | ASC) key="Absolute State of charge" ;;
20 | BCT) key="Battery backup charge time" ;;
21 | BPM) key="Battery Pack Missing" ;;
22 | BRR) key="Battery Replacement required" ;;
23 | BTS) key="Battery State" ;;
24 | BTT) key="BatteryType" ;;
25 | CGS) key="Charging Status" ;;
26 | CGT) key="Charging Terminated" ;;
27 | COP) key="Cache Offload premium feature required" ;;
28 | CUR) key="^Current:" ;;
29 | CYT) key="Cycle Count" ;;
30 | DCG) key="Discharging" ;;
31 | DCT) key="Discharge Terminated" ;;
32 | DGC) key="Design Capacity" ;;
33 | DGV) key="Design Voltage" ;;
34 | DOM) key="Date of Manufacture" ;;
35 | DVC) key="Device Chemistry" ;;
36 | DVN) key="Device Name" ;;
37 | FCC) key="Full Charge Capacity" ;;
38 | FCG) key="Fully Charged" ;;
39 | FDC) key="Fully Discharged" ;;
40 | I2C) key="I2c Errors Detected" ;;
41 | INT) key="Initialized" ;;
42 | LCA) key="Learn Cycle Active" ;;
43 | LCR) key="Learn Cycle Requested" ;;
44 | LCS) key="Learn Cycle Status" ;;
45 | LCT) key="Learn Cycle Timeout" ;;
46 | LDI) key="Learn Delay Interval" ;;
47 | MFN) key="Manufacture Name" ;;
48 | MMU) key="Module microcode update required" ;;
49 | MXE) key="Max Error" ;;
50 | NLT) key="Next Learn time" ;;
51 | NSC) key="No space to cache offload" ;;
52 | OVC) key="Over Charged" ;;
53 | OVT) key="Over Temperature" ;;
54 | PFR) key="Pack is about to fail & should be replaced" ;;
55 | PLR) key="Periodic Learn Required" ;;
56 | RCA) key="Remaining Capacity Alarm" ;;
57 | RCL) key="Remaining Capacity Low" ;;
58 | RCP) key="Remaining Capacity " ;;
59 | RSC) key="Relative State of Charge" ;;
60 | RTA) key="Remaining Time Alarm" ;;
61 | SNB) key="Serial Number" ;;
62 | SOH) key="isSOHGood" ;;
63 | SPI) key="Specification Info" ;;
64 | TPT) key="^Temperature:" ;;
65 | TSL) key="^Transparent Learn" ;;
66 | VOL) key="^Voltage:" ;;
67 | esac
68 |
69 | GetData
--------------------------------------------------------------------------------
/zabbix/check_raid_bbu_adapter_discovery:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding=utf-8
3 |
4 | import os
5 | import json
6 |
7 | t = os.popen("""sudo /opt/megaraid/megacli -AdpAllInfo -aALL -NoLog |\
8 | grep '^Adapter ' | awk -F '#' '{print $2}' |\
9 | while read id; do sudo /opt/megaraid/megacli -AdpBbuCmd -GetBbuStatus -a$id -NoLog |\
10 | grep -q '^BBU status for Adapter'; test $? = 0 && echo $id; done
11 | """)
12 |
13 | items = []
14 | for item in t.readlines():
15 | r = os.path.basename(item.strip())
16 | items += [{'{#BBU.ADAPTER}':r}]
17 | print json.dumps({'data':items},sort_keys=True,indent=4,separators=(',',':'))
--------------------------------------------------------------------------------
/zabbix/check_raid_bbu_key_discovery:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding=utf-8
3 |
4 | """# BTS Battery State
5 | # BTT BatteryType
6 | # CUR Current
7 | # TPT Temperature
8 | # VOL Voltage
9 | # BPM Battery Pack Missing
10 | # BRR Battery Replacement required
11 | # COP Cache Offload premium feature required
12 | # I2C I2c Errors Detected
13 | # LCR Learn Cycle Requested
14 | # LCA Learn Cycle Active
15 | # LCS Learn Cycle Status
16 | # LCT Learn Cycle Timeout
17 | # MMU Module microcode update required
18 | # NSC No space to cache offload
19 | # PFR Pack is about to fail & should be replaced
20 | # PLR Periodic Learn Required
21 | # RCL Remaining Capacity Low
22 | # TSL Transparent Learn
23 | # CGT Charging Terminated
24 | # DCG Discharging
25 | # DCT Discharge Terminated
26 | # FCG Fully Charged
27 | # FDC Fully Discharged
28 | # INT Initialized
29 | # OVC Over Charged
30 | # OVT Over Temperature
31 | # RCA Remaining Capacity Alarm
32 | # RTA Remaining Time Alarm
33 | # CGS Charging Status
34 | # RSC Relative State of Charge
35 | # ASC Absolute State of charge
36 | # RCP Remaining Capacity
37 | # FCC Full Charge Capacity
38 | # SOH isSOHGood
39 | # BCT Battery backup charge time
40 | # CYT Cycle Count
41 | # MXE Max Error
42 | # DOM Date of Manufacture
43 | # DGC Design Capacity
44 | # DGV Design Voltage
45 | # SPI Specification Info
46 | # SNB Serial Number
47 | # MFN Manufacture Name
48 | # DVN Device Name
49 | # DVC Device Chemistry
50 | # ALP Auto Learn Period
51 | # NLT Next Learn time
52 | # LDI Learn Delay Interval
53 | # ALM Auto-Learn Mode"""
54 |
55 | import sys
56 | import os
57 | import json
58 |
59 | bbuid = sys.argv[0]
60 |
61 | def jsondata():
62 | items = []
63 | for item in __doc__.split("\n"):
64 | items += [{'{#BBU.KEY}':item[2:5], '{#BBU.TAG}':item[8:]}]
65 |
66 | print json.dumps({'data':items},sort_keys=True,indent=4,separators=(',',':'))
67 |
68 | if __name__ == "__main__":
69 | jsondata()
--------------------------------------------------------------------------------
/zabbix/check_redis:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # --------------------------------------------------
4 | # Project monitor:
5 | # https://github.com/Statemood/monitor
6 | #
7 | #
8 | # --------------------------------------------------
9 |
10 | redis_port=6379
11 | redis_exec=redis-cli
12 |
13 | Usage(){
14 | helpmsg="
15 | \033[1m$(basename $0)\033[0m
16 | -h, --host Hostname or IP Address
17 | -p, --port Redis port
18 | -i, --item 'PING' and all of the redis 'info' stats
19 | --help Display this message
20 | "
21 | echo -e "$helpmsg"
22 | exit
23 | }
24 |
25 | redisCmd(){
26 | $redis_exec -h $host -p $redis_port
27 | }
28 |
29 | GetData(){
30 | echo "info" | redisCmd | grep "^$item:" | awk -F ':' '{print $2}'
31 | }
32 |
33 | for arg in "$@"
34 | do
35 | case $arg in
36 | -h|--host)
37 | test -z "$2" && Usage
38 | host="$2"
39 | shift 2
40 | ;;
41 | -p|--port)
42 | test -z "$2" && Usage
43 | redis_port="$2"
44 | shift 2
45 | ;;
46 | -i|--item)
47 | item="$2"
48 | test -z "$2" && Usage
49 |
50 | if [ "$item" = "PING" ]
51 | then
52 | echo "PING" | redisCmd | grep -q "PONG"
53 | test $? = 0 && echo 0 || echo 1
54 | elif [ "$item" = "db0" ]
55 | then
56 | GetData | awk -F ',' '{print $1}' | awk -F '=' '{print $2}'
57 | else
58 | GetData
59 | fi
60 | ;;
61 | -*|--help)
62 | Usage
63 | ;;
64 | esac
65 | done
66 |
--------------------------------------------------------------------------------
/zabbix/check_redis_discovery:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import json
4 |
5 | t=os.popen("""sudo /bin/netstat -natp|awk -F: '/redis/&&/LISTEN/{print $2}'|awk '{print $1}' | sed '/^$/d'""")
6 |
7 | ports = []
8 | for port in t.readlines():
9 | r = os.path.basename(port.strip())
10 | ports += [{'{#REDISPORT}':r}]
11 | print json.dumps({'data':ports},sort_keys=True,indent=4,separators=(',',':'))
--------------------------------------------------------------------------------
/zabbix/check_selinux:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # --------------------------------------------------
4 | # Project monitor:
5 | # https://github.com/Statemood/monitor
6 | #
7 | # Created by Statemood, 2016-11-07
8 | #
9 | # --------------------------------------------------
10 |
11 | case "$1" in
12 | status)
13 | sestatus | grep '^SELinux status' | awk -F ':' '{print $2}' | awk '{print $1}'
14 | ;;
15 | current)
16 | mode=`sestatus | grep '^Current mode' | awk '{print $3}'`
17 | test -z "$mode" && mode=disabled
18 | echo $mode
19 | ;;
20 | config)
21 | grep '^SELINUX=' /etc/selinux/config | awk -F '=' '{print $2}'
22 | ;;
23 | esac
--------------------------------------------------------------------------------
/zabbix/check_tcp_connections:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 |
3 | # --------------------------------------------------
4 | # Project Monitor
5 | # https://github.com/Statemood/monitor
6 | #
7 | # Created by Lin Ru Lin.Ru@msn.com
8 | # --------------------------------------------------
9 |
10 | #
11 |
12 | key="$1"
13 | allowed="CLOSE_WAIT|ESTABLISHED|FIN_WAIT_1|FIN_WAIT_2|LAST_ACK|LISTEN|TIME_WAIT|SYN_RECV"
14 |
15 | Counter(){
16 | number=`netstat -an |\
17 | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' |\
18 | grep "^$key" |\
19 | awk '{print $2}'`
20 |
21 | test -z "$number" && number=0
22 | echo $number
23 | }
24 |
25 | echo $key | egrep -q "$allowed"
26 |
27 | test $? = 0 && Counter || echo "Allowed: `echo $allowed | tr -s '|' ' '`"
--------------------------------------------------------------------------------
/zabbix/check_tokyotyrant:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # https://github.com/Statemood/monitor
6 | # ------------------------------------------
7 |
8 | # --host 127.0.0.1 --port 1978 --cmd count|rw
9 |
10 | item="$1"
11 | host="127.0.0.1"
12 | port="1978"
13 |
14 | data(){
15 | tcrmgr inform -st -port $port $host
16 | }
17 |
18 | data | grep "^$item" | head -1 | awk '{print $2}'
19 |
--------------------------------------------------------------------------------
/zabbix/check_tokyotyrant_discovery:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding=utf-8
3 |
4 | import os
5 | import json
6 |
7 | t = os.popen("""tcrmgr inform -st 127.0.0.1 | awk '/[0-9]+/' | grep -v '\.' | awk '{print $1}'""")
8 |
9 | items = []
10 | for item in t.readlines():
11 | r = os.path.basename(item.strip())
12 | items += [{'{#TCRITEM}':r}]
13 | print json.dumps({'data':items},sort_keys=True,indent=4,separators=(',',':'))
14 |
--------------------------------------------------------------------------------
/zabbix/generate_http_discovery_list:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python2
2 |
3 | # --------------------------------------------------
4 | # https://github.com/Statemood/monitor
5 | #
6 | # Project AMC
7 | # https://github.com/Statemood/amc
8 | # --------------------------------------------------
9 |
10 | # Data from AMC, monitors
11 |
12 | import os
13 | import time
14 | import datetime
15 | import pymongo
16 |
17 | db_host = "localhost"
18 | db_port = 27017
19 |
20 | dc_list = os.path.dirname(os.path.abspath(__file__)) + '/../etc/http-discovery.list'
21 | f = open(dc_list, 'w')
22 | conn = pymongo.MongoClient(db_host, db_port)
23 | db = conn.amc
24 | results = db.monitors.find({}, {"_id": 0})
25 | c_time = time.time()
26 |
27 | conn.close()
28 |
29 | f.write("# Created by " + __file__ + " "
30 | + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(c_time)) + "\n\n" )
31 |
32 | for i in results:
33 | if i['host'].find(':') == -1:
34 | iv = i['host']
35 | i['host'] = ':' + iv
36 |
37 | d = "%(name)s:%(host)s:%(port)s:%(http_code)s:%(url)s:%(id)s\n" %i
38 | f.write(d)
39 | f.close()
40 |
--------------------------------------------------------------------------------
/zabbix/hardware_data_collecter:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # ------------------------------------------
4 | #
5 | # https://github.com/Statemood/monitor
6 | # ------------------------------------------
7 |
8 | temp=/dev/shm
9 | mega=/usr/local/bin/megacli
10 | ipmi=/usr/bin/ipmitool
11 |
12 | ignorekey="Not Readable|no reading|0x[a-z0-9]+"
13 |
14 | disk_info=$temp/disk.info
15 | raid_info=$temp/raid.info
16 | ipmi_info=$temp/ipmi.info
17 | bbu_info=$temp/bbu.info
18 |
19 | $mega -PDList -a0 -NoLog > $disk_info
20 | $mega -adpallinfo -a0 -NoLog > $raid_info
21 | $mega -AdpBbuCmd -aAll -NoLog | sed 's/^ //g' > $bbu_info
22 | $ipmi sdr | egrep -v "$ignorekey" > $ipmi_info
23 |
--------------------------------------------------------------------------------
/zabbix/notice_alert_get_info:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python2
2 |
3 | # --------------------------------------------------
4 | # Project monitor
5 | # https://github.com/Statemood/monitor
6 | #
7 | # A part of the project AMC
8 | # https://github.com/Statemood/amc
9 | # --------------------------------------------------
10 |
11 | # Data from AMC, monitors
12 |
13 | import sys
14 | import ldap
15 | import pymongo
16 | from userinfo import LDAPSearch as ldap_search
17 |
18 | db_host = "localhost"
19 | db_port = 27017
20 | rule_id = sys.argv[1]
21 | conn = pymongo.MongoClient(db_host, db_port)
22 | db = conn.amc
23 | us = ldap_search()
24 | user_attrib = ['cn', 'mobile', 'mail', 'uid']
25 | watching = db.watching.find({"rule": rule_id}, {"_id": 0})
26 |
27 | conn.close()
28 |
29 | for w in watching:
30 | notice = w.get('notice')
31 | user_filter = 'uid=' + w.get('uid')
32 | user_info = us.usr_search(filter = user_filter, attrib=user_attrib)
33 |
34 | for u in user_info:
35 | user_cn = str(u).split("'cn'")[1].split("'")[1]
36 | user_mail = str(u).split("'mail'")[1].split("'")[1]
37 | user_mobile = str(u).split("'mobile'")[1].split("'")[1]
38 |
39 | print notice, user_cn, user_mail, user_mobile
40 |
--------------------------------------------------------------------------------
/zabbix/notice_alert_sender:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # --------------------------------------------------
4 | # Project monitor
5 | # https://github.com/Statemood/monitor
6 | #
7 | # A part of the project AMC
8 | # https://github.com/Statemood/amc
9 | # --------------------------------------------------
10 |
11 | sms_api=""
12 | sms_key=""
13 |
14 | if [ "$#" != 6 ]
15 | then
16 | echo "Required argument"
17 | exit 1
18 | fi
19 |
20 | for arg in "$@"
21 | do
22 | case "$arg" in
23 | -i|--id)
24 | alert_id="$2"
25 | shift 2
26 | ;;
27 | -s|--subject)
28 | subject="$2"
29 | shift 2
30 | ;;
31 | -c|--content)
32 | content="$2"
33 | shift 2
34 | ;;
35 | esac
36 | done
37 |
38 | send_sms(){
39 | curl -X POST $sms_api -d "mobile=$mobile&content=$content&key=$sms_key"
40 | }
41 |
42 | send_mail(){
43 | echo $(dirname $0)/mail.py "$mail" "$subject" "$content"
44 | }
45 |
46 | $(dirname $0)/notice_alert_get_info $alert_id |\
47 | while read notice name mail mobile
48 | do
49 | case $notice in
50 | 0) send_mail ;;
51 | 1) send_sms ;;
52 | 2) send_sms; send_mail ;;
53 | esac
54 | done
55 |
--------------------------------------------------------------------------------
/zabbix/templates/Template App Apache HTTP.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 3.2
4 | 2016-12-06T03:17:23Z
5 |
6 |
7 | Templates
8 |
9 |
10 |
11 |
12 | Template App Apache HTTP
13 | Template App Apache HTTP
14 |
15 |
16 |
17 | Templates
18 |
19 |
20 |
21 |
22 | Processes
23 |
24 |
25 |
26 | -
27 | Process httpd Count
28 | 0
29 |
30 | 0
31 |
32 | check.process[httpd,count]
33 | 60
34 | 90
35 | 365
36 | 0
37 | 3
38 |
39 |
40 | 0
41 |
42 |
43 | 0
44 | 0
45 |
46 | 0
47 |
48 | 1
49 |
50 |
51 |
52 | 0
53 | 0
54 |
55 |
56 |
57 |
58 |
59 |
60 | 0
61 |
62 |
63 | Processes
64 |
65 |
66 |
67 |
68 |
69 | -
70 | Process httpd CPU Usage
71 | 0
72 |
73 | 0
74 |
75 | check.process[httpd,cpu]
76 | 60
77 | 90
78 | 365
79 | 0
80 | 0
81 |
82 | %
83 | 0
84 |
85 |
86 | 0
87 | 0
88 |
89 | 0
90 |
91 | 1
92 |
93 |
94 |
95 | 0
96 | 0
97 |
98 |
99 |
100 |
101 |
102 |
103 | 0
104 |
105 |
106 | Processes
107 |
108 |
109 |
110 |
111 |
112 | -
113 | Process httpd Memory Usage
114 | 0
115 |
116 | 0
117 |
118 | check.process[httpd,memory]
119 | 60
120 | 90
121 | 365
122 | 0
123 | 0
124 |
125 | %
126 | 0
127 |
128 |
129 | 0
130 | 0
131 |
132 | 0
133 |
134 | 1
135 |
136 |
137 |
138 | 0
139 | 0
140 |
141 |
142 |
143 |
144 |
145 |
146 | 0
147 |
148 |
149 | Processes
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 | Process httpd Usage
163 | 2
164 | 1
165 |
166 |
167 | 1
168 | 500
169 | 100
170 | 0
171 | 0
172 | 1
173 | 1
174 | 0
175 | 0
176 | 0
177 |
178 |
179 | 0
180 | 0
181 |
182 | check.process[httpd,count]
183 | Template App Apache HTTP
184 |
185 | 3
186 |
187 |
188 |
189 | 0
190 | 500
191 | 100
192 | 1
193 | 0
194 | 1
195 | 1
196 | 0
197 | 0
198 | 0
199 |
200 |
201 | 0
202 | 0
203 |
204 | Process httpd Usage
205 | Template App Apache HTTP
206 |
207 | 3
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 | Process httpd Usage
218 | 900
219 | 200
220 | 0.0000
221 | 100.0000
222 | 1
223 | 1
224 | 0
225 | 1
226 | 0
227 | 0.0000
228 | 0.0000
229 | 0
230 | 0
231 | 0
232 | 0
233 |
234 |
235 | 0
236 | 0
237 | 1A7C11
238 | 0
239 | 2
240 | 0
241 | -
242 | Template App Apache HTTP
243 | check.process[httpd,cpu]
244 |
245 |
246 |
247 | 1
248 | 0
249 | 0000CC
250 | 0
251 | 2
252 | 0
253 | -
254 | Template App Apache HTTP
255 | check.process[httpd,memory]
256 |
257 |
258 |
259 |
260 |
261 |
262 |
--------------------------------------------------------------------------------
/zabbix/templates/Template App Nginx.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 3.2
4 | 2016-12-06T03:16:29Z
5 |
6 |
7 | Templates
8 |
9 |
10 |
11 |
12 | Template App Nginx
13 | Template App Nginx
14 |
15 |
16 |
17 | Templates
18 |
19 |
20 |
21 |
22 | Processes
23 |
24 |
25 |
26 | -
27 | Process Nginx Count
28 | 0
29 |
30 | 0
31 |
32 | check.process[nginx,count]
33 | 60
34 | 90
35 | 365
36 | 0
37 | 3
38 |
39 |
40 | 0
41 |
42 |
43 | 0
44 | 0
45 |
46 | 0
47 |
48 | 1
49 |
50 |
51 |
52 | 0
53 | 0
54 |
55 |
56 |
57 |
58 |
59 |
60 | 0
61 |
62 |
63 | Processes
64 |
65 |
66 |
67 |
68 |
69 | -
70 | Process Nginx CPU Usage
71 | 0
72 |
73 | 0
74 |
75 | check.process[nginx,cpu]
76 | 60
77 | 90
78 | 365
79 | 0
80 | 0
81 |
82 | %
83 | 0
84 |
85 |
86 | 0
87 | 0
88 |
89 | 0
90 |
91 | 1
92 |
93 |
94 |
95 | 0
96 | 0
97 |
98 |
99 |
100 |
101 |
102 |
103 | 0
104 |
105 |
106 | Processes
107 |
108 |
109 |
110 |
111 |
112 | -
113 | Process Nginx Memory Usage
114 | 0
115 |
116 | 0
117 |
118 | check.process[nginx,memory]
119 | 60
120 | 90
121 | 365
122 | 0
123 | 0
124 |
125 | %
126 | 0
127 |
128 |
129 | 0
130 | 0
131 |
132 | 0
133 |
134 | 1
135 |
136 |
137 |
138 | 0
139 | 0
140 |
141 |
142 |
143 |
144 |
145 |
146 | 0
147 |
148 |
149 | Processes
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 | Process Nginx Screen
163 | 2
164 | 1
165 |
166 |
167 | 1
168 | 500
169 | 100
170 | 0
171 | 0
172 | 1
173 | 1
174 | 0
175 | 0
176 | 0
177 |
178 |
179 | 0
180 | 0
181 |
182 | check.process[nginx,count]
183 | Template App Nginx
184 |
185 | 3
186 |
187 |
188 |
189 | 0
190 | 500
191 | 100
192 | 1
193 | 0
194 | 1
195 | 1
196 | 0
197 | 0
198 | 0
199 |
200 |
201 | 0
202 | 0
203 |
204 | Process Nginx Usage
205 | Template App Nginx
206 |
207 | 3
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 | Process Nginx Usage
218 | 900
219 | 200
220 | 0.0000
221 | 100.0000
222 | 1
223 | 1
224 | 0
225 | 1
226 | 0
227 | 0.0000
228 | 0.0000
229 | 0
230 | 0
231 | 0
232 | 0
233 |
234 |
235 | 0
236 | 0
237 | 1A7C11
238 | 0
239 | 2
240 | 0
241 | -
242 | Template App Nginx
243 | check.process[nginx,cpu]
244 |
245 |
246 |
247 | 1
248 | 0
249 | 0000CC
250 | 0
251 | 2
252 | 0
253 | -
254 | Template App Nginx
255 | check.process[nginx,memory]
256 |
257 |
258 |
259 |
260 |
261 |
262 |
--------------------------------------------------------------------------------
/zabbix/templates/Template KVM Processes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 3.2
4 | 2016-12-06T03:15:29Z
5 |
6 |
7 | KVM
8 |
9 |
10 |
11 |
12 | Template KVM Processes
13 | Template KVM Processes
14 |
15 |
16 |
17 | KVM
18 |
19 |
20 |
21 |
22 | Processes
23 |
24 |
25 |
26 | -
27 | Process QEMU Count
28 | 0
29 |
30 | 0
31 |
32 | check.process[qemu-kvm,count]
33 | 60
34 | 90
35 | 365
36 | 0
37 | 3
38 |
39 |
40 | 0
41 |
42 |
43 | 0
44 | 0
45 |
46 | 0
47 |
48 | 1
49 |
50 |
51 |
52 | 0
53 | 0
54 |
55 |
56 |
57 |
58 |
59 |
60 | 0
61 |
62 |
63 | Processes
64 |
65 |
66 |
67 |
68 |
69 | -
70 | Process QEMU CPU Usage
71 | 0
72 |
73 | 0
74 |
75 | check.process[qemu-kvm,cpu]
76 | 60
77 | 90
78 | 365
79 | 0
80 | 0
81 |
82 | %
83 | 0
84 |
85 |
86 | 0
87 | 0
88 |
89 | 0
90 |
91 | 1
92 |
93 |
94 |
95 | 0
96 | 0
97 |
98 |
99 |
100 |
101 |
102 |
103 | 0
104 |
105 |
106 | Processes
107 |
108 |
109 |
110 |
111 |
112 | -
113 | Process QEMU Memory Usage
114 | 0
115 |
116 | 0
117 |
118 | check.process[qemu-kvm,memory]
119 | 60
120 | 90
121 | 365
122 | 0
123 | 0
124 |
125 | %
126 | 0
127 |
128 |
129 | 0
130 | 0
131 |
132 | 0
133 |
134 | 1
135 |
136 |
137 |
138 | 0
139 | 0
140 |
141 |
142 |
143 |
144 |
145 |
146 | 0
147 |
148 |
149 | Processes
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 | Process QEMU CPU & Memory Usage
166 | 900
167 | 200
168 | 0.0000
169 | 100.0000
170 | 1
171 | 1
172 | 0
173 | 1
174 | 0
175 | 0.0000
176 | 0.0000
177 | 0
178 | 0
179 | 0
180 | 0
181 |
182 |
183 | 0
184 | 0
185 | 1A7C11
186 | 0
187 | 2
188 | 0
189 | -
190 | Template KVM Processes
191 | check.process[qemu-kvm,cpu]
192 |
193 |
194 |
195 | 1
196 | 0
197 | 0000DD
198 | 0
199 | 2
200 | 0
201 | -
202 | Template KVM Processes
203 | check.process[qemu-kvm,memory]
204 |
205 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/zabbix/userinfo.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python2
2 |
3 | # --------------------------------------------------
4 | # Project monitor
5 | # https://github.com/Statemood/monitor
6 | #
7 | # A part of the project AMC
8 | # https://github.com/Statemood/amc
9 | # --------------------------------------------------
10 |
11 | import sys
12 | import ldap
13 |
14 | LDAP_HOST = 'auth.abc.com'
15 | LDAP_PORT = 389
16 | LDAP_BASE_DN = 'dc=auth,dc=abc,dc=com'
17 |
18 | class LDAPSearch:
19 | def __init__(self):
20 | self.ldapconn = ldap.open(LDAP_HOST)
21 | self.ldapconn.simple_bind()
22 | self.ldap_base_dn = LDAP_BASE_DN
23 |
24 | def usr_search(self, filter=None, attrib=None):
25 | s = self.ldapconn.search_s(self.ldap_base_dn, ldap.SCOPE_SUBTREE, filter, attrib)
26 |
27 | return s
28 |
--------------------------------------------------------------------------------
/zabbix/zabbix-agent2.check.sudo:
--------------------------------------------------------------------------------
1 | # File: /etc/sudoers.d/zabbix-check.sudo
2 |
3 | Cmnd_Alias DOCKERCONTAINERLIST = /usr/bin/docker ps -aq
4 |
5 | Cmnd_Alias RAID_MEGACLI = /opt/megaraid/megacli -AdpAllInfo*, /opt/megaraid/megacli -AdpBbuCmd*, /opt/megaraid/megacli -PDList*
6 |
7 | zabbix ALL=(root) NOPASSWD: DOCKERCONTAINERLIST, RAID_MEGACLI
--------------------------------------------------------------------------------