ngxin added zabbix template + script + config
This commit is contained in:
parent
ebf9fbacdc
commit
475489e680
607
nginx/mdm-nginx-active.xml
Normal file
607
nginx/mdm-nginx-active.xml
Normal file
@ -0,0 +1,607 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<zabbix_export>
|
||||
<version>3.4</version>
|
||||
<date>2021-06-14T11:47:45Z</date>
|
||||
<groups>
|
||||
<group>
|
||||
<name>MDM</name>
|
||||
</group>
|
||||
<group>
|
||||
<name>MyTemplates</name>
|
||||
</group>
|
||||
</groups>
|
||||
<templates>
|
||||
<template>
|
||||
<template>mdm_nginx_agent active</template>
|
||||
<name>mdm_nginx_agent active</name>
|
||||
<description/>
|
||||
<groups>
|
||||
<group>
|
||||
<name>MDM</name>
|
||||
</group>
|
||||
<group>
|
||||
<name>MyTemplates</name>
|
||||
</group>
|
||||
</groups>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Nginx</name>
|
||||
</application>
|
||||
</applications>
|
||||
<items>
|
||||
<item>
|
||||
<name>Nginx: connections accepted per sec</name>
|
||||
<type>7</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>nginx[accepts,{$NGINX_STATS_URL}]</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>0</value_type>
|
||||
<allowed_hosts/>
|
||||
<units>c/sec</units>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Nginx</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing>
|
||||
<step>
|
||||
<type>10</type>
|
||||
<params/>
|
||||
</step>
|
||||
</preprocessing>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>Nginx: connects active</name>
|
||||
<type>7</type>
|
||||
<snmp_community>public</snmp_community>
|
||||
<snmp_oid>interfaces.ifTable.ifEntry.ifInOctets.1</snmp_oid>
|
||||
<key>nginx[active,{$NGINX_STATS_URL}]</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>3</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Nginx</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>Nginx: connections handled per sec</name>
|
||||
<type>7</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>nginx[handled,{$NGINX_STATS_URL}]</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>0</value_type>
|
||||
<allowed_hosts/>
|
||||
<units>c/sec</units>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Nginx</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing>
|
||||
<step>
|
||||
<type>10</type>
|
||||
<params/>
|
||||
</step>
|
||||
</preprocessing>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>Nginx: connections reading</name>
|
||||
<type>7</type>
|
||||
<snmp_community>public</snmp_community>
|
||||
<snmp_oid>interfaces.ifTable.ifEntry.ifInOctets.1</snmp_oid>
|
||||
<key>nginx[reading,{$NGINX_STATS_URL}]</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>3</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Nginx</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>Nginx: requests per sec</name>
|
||||
<type>7</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>nginx[requests,{$NGINX_STATS_URL}]</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>0</value_type>
|
||||
<allowed_hosts/>
|
||||
<units>r/sec</units>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Nginx</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing>
|
||||
<step>
|
||||
<type>10</type>
|
||||
<params/>
|
||||
</step>
|
||||
</preprocessing>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>Nginx: connections waiting</name>
|
||||
<type>7</type>
|
||||
<snmp_community>public</snmp_community>
|
||||
<snmp_oid>interfaces.ifTable.ifEntry.ifInOctets.1</snmp_oid>
|
||||
<key>nginx[waiting,{$NGINX_STATS_URL}]</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>3</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Nginx</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>Nginx: connections writing</name>
|
||||
<type>7</type>
|
||||
<snmp_community>public</snmp_community>
|
||||
<snmp_oid>interfaces.ifTable.ifEntry.ifInOctets.1</snmp_oid>
|
||||
<key>nginx[writing,{$NGINX_STATS_URL}]</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>3</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Nginx</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
<item>
|
||||
<name>Nginx: Number of processes $1</name>
|
||||
<type>7</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>proc.num[nginx]</key>
|
||||
<delay>1m</delay>
|
||||
<history>1w</history>
|
||||
<trends>365d</trends>
|
||||
<status>0</status>
|
||||
<value_type>3</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Nginx</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<preprocessing/>
|
||||
<jmx_endpoint/>
|
||||
<master_item/>
|
||||
</item>
|
||||
</items>
|
||||
<discovery_rules/>
|
||||
<httptests/>
|
||||
<macros/>
|
||||
<templates/>
|
||||
<screens/>
|
||||
</template>
|
||||
</templates>
|
||||
<triggers>
|
||||
<trigger>
|
||||
<expression>{mdm_nginx_agent active:nginx[active,{$NGINX_STATS_URL}].last(0)}>{$NGINX_CON_NUM}</expression>
|
||||
<recovery_mode>0</recovery_mode>
|
||||
<recovery_expression/>
|
||||
<name>Nginx: many active connections on {HOST.NAME}</name>
|
||||
<correlation_mode>0</correlation_mode>
|
||||
<correlation_tag/>
|
||||
<url/>
|
||||
<status>0</status>
|
||||
<priority>2</priority>
|
||||
<description/>
|
||||
<type>0</type>
|
||||
<manual_close>0</manual_close>
|
||||
<dependencies/>
|
||||
<tags/>
|
||||
</trigger>
|
||||
<trigger>
|
||||
<expression>{mdm_nginx_agent active:nginx[requests,{$NGINX_STATS_URL}].avg(240)}>{$NGINX_REQ_NUM}</expression>
|
||||
<recovery_mode>0</recovery_mode>
|
||||
<recovery_expression/>
|
||||
<name>Nginx: many requests on {HOST.NAME}</name>
|
||||
<correlation_mode>0</correlation_mode>
|
||||
<correlation_tag/>
|
||||
<url/>
|
||||
<status>0</status>
|
||||
<priority>2</priority>
|
||||
<description/>
|
||||
<type>0</type>
|
||||
<manual_close>0</manual_close>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<name>Nginx: too many requests on {HOST.NAME}</name>
|
||||
<expression>{mdm_nginx_agent active:nginx[requests,{$NGINX_STATS_URL}].avg(240)}>{$NGINX_REQ_NUM}*1.5</expression>
|
||||
<recovery_expression/>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<tags/>
|
||||
</trigger>
|
||||
<trigger>
|
||||
<expression>{mdm_nginx_agent active:nginx[requests,{$NGINX_STATS_URL}].last(0)}>{$NGINX_REQ_NUM}</expression>
|
||||
<recovery_mode>0</recovery_mode>
|
||||
<recovery_expression/>
|
||||
<name>Nginx: many requests on {HOSTNAME}</name>
|
||||
<correlation_mode>0</correlation_mode>
|
||||
<correlation_tag/>
|
||||
<url/>
|
||||
<status>0</status>
|
||||
<priority>2</priority>
|
||||
<description/>
|
||||
<type>0</type>
|
||||
<manual_close>0</manual_close>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<name>Nginx: too many requests on {HOSTNAME}</name>
|
||||
<expression>{mdm_nginx_agent active:nginx[requests,{$NGINX_STATS_URL}].last(0)}>{$NGINX_REQ_NUM}*1.3</expression>
|
||||
<recovery_expression/>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<tags/>
|
||||
</trigger>
|
||||
<trigger>
|
||||
<expression>{mdm_nginx_agent active:proc.num[nginx].last(0)}<1</expression>
|
||||
<recovery_mode>0</recovery_mode>
|
||||
<recovery_expression/>
|
||||
<name>Nginx: nginx is not running on {HOST.NAME}</name>
|
||||
<correlation_mode>0</correlation_mode>
|
||||
<correlation_tag/>
|
||||
<url/>
|
||||
<status>0</status>
|
||||
<priority>5</priority>
|
||||
<description/>
|
||||
<type>0</type>
|
||||
<manual_close>0</manual_close>
|
||||
<dependencies/>
|
||||
<tags/>
|
||||
</trigger>
|
||||
<trigger>
|
||||
<expression>{mdm_nginx_agent active:nginx[requests,{$NGINX_STATS_URL}].avg(240)}>{$NGINX_REQ_NUM}*1.5</expression>
|
||||
<recovery_mode>0</recovery_mode>
|
||||
<recovery_expression/>
|
||||
<name>Nginx: too many requests on {HOST.NAME}</name>
|
||||
<correlation_mode>0</correlation_mode>
|
||||
<correlation_tag/>
|
||||
<url/>
|
||||
<status>0</status>
|
||||
<priority>3</priority>
|
||||
<description/>
|
||||
<type>0</type>
|
||||
<manual_close>0</manual_close>
|
||||
<dependencies/>
|
||||
<tags/>
|
||||
</trigger>
|
||||
<trigger>
|
||||
<expression>{mdm_nginx_agent active:nginx[requests,{$NGINX_STATS_URL}].last(0)}>{$NGINX_REQ_NUM}*1.3</expression>
|
||||
<recovery_mode>0</recovery_mode>
|
||||
<recovery_expression/>
|
||||
<name>Nginx: too many requests on {HOSTNAME}</name>
|
||||
<correlation_mode>0</correlation_mode>
|
||||
<correlation_tag/>
|
||||
<url/>
|
||||
<status>0</status>
|
||||
<priority>3</priority>
|
||||
<description/>
|
||||
<type>0</type>
|
||||
<manual_close>0</manual_close>
|
||||
<dependencies/>
|
||||
<tags/>
|
||||
</trigger>
|
||||
</triggers>
|
||||
<graphs>
|
||||
<graph>
|
||||
<name>Nginx: Connections</name>
|
||||
<width>600</width>
|
||||
<height>200</height>
|
||||
<yaxismin>0.0000</yaxismin>
|
||||
<yaxismax>100.0000</yaxismax>
|
||||
<show_work_period>0</show_work_period>
|
||||
<show_triggers>1</show_triggers>
|
||||
<type>0</type>
|
||||
<show_legend>1</show_legend>
|
||||
<show_3d>0</show_3d>
|
||||
<percent_left>0.0000</percent_left>
|
||||
<percent_right>0.0000</percent_right>
|
||||
<ymin_type_1>0</ymin_type_1>
|
||||
<ymax_type_1>0</ymax_type_1>
|
||||
<ymin_item_1>0</ymin_item_1>
|
||||
<ymax_item_1>0</ymax_item_1>
|
||||
<graph_items>
|
||||
<graph_item>
|
||||
<sortorder>0</sortorder>
|
||||
<drawtype>4</drawtype>
|
||||
<color>3333FF</color>
|
||||
<yaxisside>1</yaxisside>
|
||||
<calc_fnc>2</calc_fnc>
|
||||
<type>0</type>
|
||||
<item>
|
||||
<host>mdm_nginx_agent active</host>
|
||||
<key>nginx[active,{$NGINX_STATS_URL}]</key>
|
||||
</item>
|
||||
</graph_item>
|
||||
<graph_item>
|
||||
<sortorder>1</sortorder>
|
||||
<drawtype>0</drawtype>
|
||||
<color>FF6666</color>
|
||||
<yaxisside>1</yaxisside>
|
||||
<calc_fnc>2</calc_fnc>
|
||||
<type>0</type>
|
||||
<item>
|
||||
<host>mdm_nginx_agent active</host>
|
||||
<key>nginx[writing,{$NGINX_STATS_URL}]</key>
|
||||
</item>
|
||||
</graph_item>
|
||||
<graph_item>
|
||||
<sortorder>2</sortorder>
|
||||
<drawtype>0</drawtype>
|
||||
<color>EEEE00</color>
|
||||
<yaxisside>1</yaxisside>
|
||||
<calc_fnc>2</calc_fnc>
|
||||
<type>0</type>
|
||||
<item>
|
||||
<host>mdm_nginx_agent active</host>
|
||||
<key>nginx[reading,{$NGINX_STATS_URL}]</key>
|
||||
</item>
|
||||
</graph_item>
|
||||
<graph_item>
|
||||
<sortorder>3</sortorder>
|
||||
<drawtype>0</drawtype>
|
||||
<color>00CC00</color>
|
||||
<yaxisside>1</yaxisside>
|
||||
<calc_fnc>2</calc_fnc>
|
||||
<type>0</type>
|
||||
<item>
|
||||
<host>mdm_nginx_agent active</host>
|
||||
<key>nginx[waiting,{$NGINX_STATS_URL}]</key>
|
||||
</item>
|
||||
</graph_item>
|
||||
</graph_items>
|
||||
</graph>
|
||||
<graph>
|
||||
<name>Nginx: Requests</name>
|
||||
<width>600</width>
|
||||
<height>200</height>
|
||||
<yaxismin>0.0000</yaxismin>
|
||||
<yaxismax>100.0000</yaxismax>
|
||||
<show_work_period>0</show_work_period>
|
||||
<show_triggers>1</show_triggers>
|
||||
<type>0</type>
|
||||
<show_legend>1</show_legend>
|
||||
<show_3d>0</show_3d>
|
||||
<percent_left>0.0000</percent_left>
|
||||
<percent_right>0.0000</percent_right>
|
||||
<ymin_type_1>0</ymin_type_1>
|
||||
<ymax_type_1>0</ymax_type_1>
|
||||
<ymin_item_1>0</ymin_item_1>
|
||||
<ymax_item_1>0</ymax_item_1>
|
||||
<graph_items>
|
||||
<graph_item>
|
||||
<sortorder>1</sortorder>
|
||||
<drawtype>5</drawtype>
|
||||
<color>FF3333</color>
|
||||
<yaxisside>1</yaxisside>
|
||||
<calc_fnc>2</calc_fnc>
|
||||
<type>0</type>
|
||||
<item>
|
||||
<host>mdm_nginx_agent active</host>
|
||||
<key>nginx[requests,{$NGINX_STATS_URL}]</key>
|
||||
</item>
|
||||
</graph_item>
|
||||
<graph_item>
|
||||
<sortorder>2</sortorder>
|
||||
<drawtype>2</drawtype>
|
||||
<color>00EE00</color>
|
||||
<yaxisside>1</yaxisside>
|
||||
<calc_fnc>2</calc_fnc>
|
||||
<type>0</type>
|
||||
<item>
|
||||
<host>mdm_nginx_agent active</host>
|
||||
<key>nginx[accepts,{$NGINX_STATS_URL}]</key>
|
||||
</item>
|
||||
</graph_item>
|
||||
</graph_items>
|
||||
</graph>
|
||||
</graphs>
|
||||
</zabbix_export>
|
||||
2
nginx/nginx-stats.conf
Executable file
2
nginx/nginx-stats.conf
Executable file
@ -0,0 +1,2 @@
|
||||
UserParameter=nginx[*],/etc/zabbix/scripts/nginx-stats.sh "none" "$1" "$2"
|
||||
|
||||
54
nginx/nginx-stats.sh
Executable file
54
nginx/nginx-stats.sh
Executable file
@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
##### OPTIONS VERIFICATION #####
|
||||
if [[ -z "$1" || -z "$2" || -z "$3" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
##### PARAMETERS #####
|
||||
RESERVED="$1"
|
||||
METRIC="$2"
|
||||
STATSURL="$3"
|
||||
CURL="/usr/bin/curl"
|
||||
CACHE_TTL="55"
|
||||
CACHE_FILE="/tmp/zabbix.nginx.`echo $STATSURL | md5sum | cut -d" " -f1`.cache"
|
||||
EXEC_TIMEOUT="1"
|
||||
NOW_TIME=`date '+%s'`
|
||||
##### RUN #####
|
||||
if [ -s "${CACHE_FILE}" ]; then
|
||||
CACHE_TIME=`stat -c"%Y" "${CACHE_FILE}"`
|
||||
else
|
||||
CACHE_TIME=0
|
||||
fi
|
||||
DELTA_TIME=$((${NOW_TIME} - ${CACHE_TIME}))
|
||||
#
|
||||
if [ ${DELTA_TIME} -lt ${EXEC_TIMEOUT} ]; then
|
||||
sleep $((${EXEC_TIMEOUT} - ${DELTA_TIME}))
|
||||
elif [ ${DELTA_TIME} -gt ${CACHE_TTL} ]; then
|
||||
echo "" >> "${CACHE_FILE}" # !!!
|
||||
DATACACHE=`${CURL} --insecure -s "${STATSURL}" 2>&1`
|
||||
echo "${DATACACHE}" > "${CACHE_FILE}" # !!!
|
||||
chmod 640 "${CACHE_FILE}"
|
||||
fi
|
||||
#
|
||||
if [ "${METRIC}" = "active" ]; then
|
||||
cat "${CACHE_FILE}" | grep "Active connections" | cut -d':' -f2
|
||||
fi
|
||||
if [ "${METRIC}" = "accepts" ]; then
|
||||
cat "${CACHE_FILE}" | sed -n '3p' | cut -d" " -f2
|
||||
fi
|
||||
if [ "${METRIC}" = "handled" ]; then
|
||||
cat "${CACHE_FILE}" | sed -n '3p' | cut -d" " -f3
|
||||
fi
|
||||
if [ "${METRIC}" = "requests" ]; then
|
||||
cat "${CACHE_FILE}" | sed -n '3p' | cut -d" " -f4
|
||||
fi
|
||||
if [ "${METRIC}" = "reading" ]; then
|
||||
cat "${CACHE_FILE}" | grep "Reading" | cut -d':' -f2 | cut -d' ' -f2
|
||||
fi
|
||||
if [ "${METRIC}" = "writing" ]; then
|
||||
cat "${CACHE_FILE}" | grep "Writing" | cut -d':' -f3 | cut -d' ' -f2
|
||||
fi
|
||||
if [ "${METRIC}" = "waiting" ]; then
|
||||
cat "${CACHE_FILE}" | grep "Waiting" | cut -d':' -f4 | cut -d' ' -f2
|
||||
fi
|
||||
#
|
||||
exit 0
|
||||
Loading…
x
Reference in New Issue
Block a user