@ -0,0 +1,104 @@ | |||
--CONTROLLER INFORMATION-- | |||
Name: Intel(R) Desktop/Workstation/Server Express Chipset SATA RAID Controller | |||
Type: AHCI | |||
Supported RAID: 0,1,5,10 | |||
Max Disks/Array: 6 | |||
HW Information: | |||
Vendor ID: 0x8086 | |||
Device ID: 0x2822 | |||
HW Revision: 0 | |||
Dynamic Storage Accelerator: Disabled | |||
--ARRAY INFORMATION-- | |||
Name: SATA_Array_0000 | |||
Size: 466 GB | |||
Free: 0 GB | |||
Num Disks: 2 | |||
Num Vols: 1 | |||
Write Cache: On | |||
--VOLUME INFORMATION-- | |||
Name: System | |||
Raid Level: 1 | |||
Size: 233 GB | |||
StripeSize: 64 KB | |||
Num Disks: 2 | |||
State: Normal | |||
System: True | |||
Initialized: True | |||
Cache Policy: Off | |||
--ARRAY INFORMATION-- | |||
Name: SATA_Array_0001 | |||
Size: 954 GB | |||
Free: 0 GB | |||
Num Disks: 2 | |||
Num Vols: 1 | |||
Write Cache: On | |||
--VOLUME INFORMATION-- | |||
Name: Data | |||
Raid Level: 1 | |||
Size: 477 GB | |||
StripeSize: 64 KB | |||
Num Disks: 2 | |||
State: Normal | |||
System: False | |||
Initialized: True | |||
Cache Policy: Off | |||
--END DEVICE INFORMATION-- | |||
ID: 0-0-0-0 | |||
Type: Disk | |||
Disk Type: SATA SSD | |||
State: Normal | |||
Size: 233 GB | |||
Free Size: 0 GB | |||
System Disk: False | |||
Usage: Array member | |||
Serial Number: S2R4NX0JC08736Y | |||
Model: Samsung SSD 850 EVO 250GB | |||
ID: 0-0-1-0 | |||
Type: Disk | |||
Disk Type: Unknown disk type SSD | |||
State: Normal | |||
Size: 0 GB | |||
Free Size: 0 GB | |||
System Disk: False | |||
Usage: Array member | |||
Serial Number: S2R4NX0JC08724K | |||
Model: | |||
ID: 0-0-2-0 | |||
Type: Disk | |||
Disk Type: Unknown disk type SSD | |||
State: Normal | |||
Size: 0 GB | |||
Free Size: 0 GB | |||
System Disk: False | |||
Usage: Array member | |||
Serial Number: S39FNX0JA04860V | |||
Model: | |||
ID: 0-0-3-0 | |||
Type: Disk | |||
Disk Type: Unknown disk type SSD | |||
State: Normal | |||
Size: 0 GB | |||
Free Size: 0 GB | |||
System Disk: False | |||
Usage: Array member | |||
Serial Number: S39FNX0JB12076E | |||
Model: | |||
0 |
@ -0,0 +1,8 @@ | |||
#/usr/bin/env bash | |||
# Description: determines if the IP address is available on this server | |||
# Author: Lesovsky A.V. <lesovsky@gmail.com> | |||
PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' | |||
IPADDR=$1 | |||
[[ $1 ]] || { echo "ZBX_NOTSUPPORTED, need at least one parameter in which IP address must be specified."; exit 1; } | |||
[[ -f $(which ip 2>/dev/null) ]] || { echo "ZBX_NOTSUPPORTED, ip utility from iproute2 not found."; exit 1; } | |||
if ip addr show |grep -qo $IPADDR; then echo "1"; else echo "0"; fi |
@ -0,0 +1,11 @@ | |||
#!/usr/bin/env bash | |||
# Description: keepalived virtual addreses auto-discovery | |||
# Author: Lesovsky A.V. <lesovsky@gmail.com> | |||
echo "---"$1"---"$2 >> /tmp/discovery.log | |||
KEEPALIVED_CONF=$1 | |||
[[ $1 ]] || { echo "ZBX_NOTSUPPORTED, need at least one parameter in which keepalived.conf must be specified"; exit 1; } | |||
[[ -f $KEEPALIVED_CONF ]] || { echo "ZBX_NOTSUPPORTED, $KEEPALIVED_CONF doesn't exist" ; exit 1; } | |||
ADDRESSES=$(sed -n -e '/virtual_ipaddress {/,/}/p' $KEEPALIVED_CONF |grep -v ^# |awk '{print $1}' |grep -oE '([0-9]{1,3}[\.]){3}[0-9]{1,3}*') | |||
echo -n '{"data":[' | |||
for addr in $ADDRESSES; do echo -n "{\"{#KADDR}\": \"$addr\"},"; done |sed -e 's:\},$:\}:' | |||
echo ']}' |
@ -0,0 +1,2 @@ | |||
UserParameter=keepalived.addr.discovery[*],/usr/libexec/zabbix-extensions/scripts/keepalived.addr.discovery.sh $1 | |||
UserParameter=keepalived.addr.availability[*],/usr/libexec/zabbix-extensions/scripts/keepalived.addr.availability.sh $1 |
@ -0,0 +1,173 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<zabbix_export> | |||
<version>2.0</version> | |||
<date>2015-03-18T10:51:33Z</date> | |||
<groups> | |||
<group> | |||
<name>Templates</name> | |||
</group> | |||
</groups> | |||
<templates> | |||
<template> | |||
<template>Inet-Template-Keepalived</template> | |||
<name>Inet-Template-Keepalived</name> | |||
<groups> | |||
<group> | |||
<name>Templates</name> | |||
</group> | |||
</groups> | |||
<applications> | |||
<application> | |||
<name>Keepalived</name> | |||
</application> | |||
</applications> | |||
<items> | |||
<item> | |||
<name>Keepalived: process count</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>proc.num[keepalived]</key> | |||
<delay>60</delay> | |||
<history>1</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units/> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>Keepalived</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
</item> | |||
</items> | |||
<discovery_rules> | |||
<discovery_rule> | |||
<name>Keepalived: virtual address discovery</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<snmp_oid/> | |||
<key>keepalived.addr.discovery[/etc/keepalived/keepalived.conf]</key> | |||
<delay>3600</delay> | |||
<status>0</status> | |||
<allowed_hosts/> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<filter>{#KADDR}:</filter> | |||
<lifetime>1</lifetime> | |||
<description/> | |||
<item_prototypes> | |||
<item_prototype> | |||
<name>Keepalived: virtual address $1 status</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>keepalived.addr.availability[{#KADDR}]</key> | |||
<delay>30</delay> | |||
<history>7</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units/> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>Keepalived</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
</item_prototype> | |||
</item_prototypes> | |||
<trigger_prototypes> | |||
<trigger_prototype> | |||
<expression>{Inet-Template-Keepalived:keepalived.addr.availability[{#KADDR}].delta(600)}#0</expression> | |||
<name>Primary node changes</name> | |||
<url/> | |||
<status>0</status> | |||
<priority>4</priority> | |||
<description/> | |||
<type>0</type> | |||
</trigger_prototype> | |||
</trigger_prototypes> | |||
<graph_prototypes/> | |||
<host_prototypes/> | |||
</discovery_rule> | |||
</discovery_rules> | |||
<macros/> | |||
<templates/> | |||
<screens/> | |||
</template> | |||
</templates> | |||
<triggers> | |||
<trigger> | |||
<expression>{Inet-Template-Keepalived:proc.num[keepalived].last()}=0</expression> | |||
<name>Keepalived down (proc count=0)</name> | |||
<url/> | |||
<status>0</status> | |||
<priority>4</priority> | |||
<description/> | |||
<type>0</type> | |||
<dependencies/> | |||
</trigger> | |||
</triggers> | |||
</zabbix_export> |
@ -0,0 +1,313 @@ | |||
#!/bin/bash | |||
state_num(){ | |||
case $state in | |||
OL) echo 1 ;; | |||
OB) echo 2 ;; | |||
LB) echo 3 ;; | |||
RB) echo 4 ;; | |||
CHRG) echo 5 ;; | |||
DISCHRG) echo 6 ;; | |||
BYPASS) echo 7 ;; | |||
CAL) echo 8 ;; | |||
OFF) echo 9 ;; | |||
OVER) echo 10 ;; | |||
TRIM) echo 11 ;; | |||
BOOST) echo 12 ;; | |||
ALARM) echo 13 ;; | |||
* ) echo 0 ;; | |||
esac | |||
} | |||
alarm_num(){ | |||
case "$alarm" in | |||
INVERTER_AC_OVER_VOLTAGE) echo 1;; | |||
INVERTER_AC_UNDER_VOLTAGE) echo 2;; | |||
INVERTER_OVER_OR_UNDER_FREQ) echo 3;; | |||
BYPASS_AC_OVER_VOLTAGE) echo 4;; | |||
BYPASS_AC_UNDER_VOLTAGE) echo 5;; | |||
BYPASS_OVER_OR_UNDER_FREQ) echo 6;; | |||
INPUT_AC_OVER_VOLTAGE) echo 7;; | |||
INPUT_AC_UNDER_VOLTAGE) echo 8;; | |||
INPUT_UNDER_OR_OVER_FREQ) echo 9;; | |||
OUTPUT_OVER_VOLTAGE) echo 10;; | |||
OUTPUT_UNDER_VOLTAGE) echo 11;; | |||
OUTPUT_UNDER_OR_OVER_FREQ) echo 12;; | |||
REMOTE_EMERGENCY_PWR_OFF) echo 13;; | |||
REMOTE_GO_TO_BYPASS) echo 14;; | |||
BUILDING_ALARM_6) echo 15;; | |||
BUILDING_ALARM_5) echo 16;; | |||
BUILDING_ALARM_4) echo 17;; | |||
BUILDING_ALARM_3) echo 18;; | |||
BUILDING_ALARM_2) echo 19;; | |||
BUILDING_ALARM_1) echo 20;; | |||
STATIC_SWITCH_OVER_TEMP) echo 21;; | |||
CHARGER_OVER_TEMP) echo 22;; | |||
CHARGER_LOGIC_PWR_FAIL) echo 23;; | |||
CHARGER_OVER_VOLTAGE_OR_CURRENT) echo 24;; | |||
INVERTER_OVER_TEMP) echo 25;; | |||
OUTPUT_OVERLOAD) echo 26;; | |||
RECTIFIER_INPUT_OVER_CURRENT) echo 27;; | |||
INVERTER_OUTPUT_OVER_CURRENT) echo 28;; | |||
DC_LINK_OVER_VOLTAGE) echo 29;; | |||
DC_LINK_UNDER_VOLTAGE) echo 30;; | |||
RECTIFIER_FAILED) echo 31;; | |||
INVERTER_FAULT) echo 32;; | |||
BATTERY_CONNECTOR_FAIL) echo 33;; | |||
BYPASS_BREAKER_FAIL) echo 34;; | |||
CHARGER_FAIL) echo 35;; | |||
RAMP_UP_FAILED) echo 36;; | |||
STATIC_SWITCH_FAILED) echo 37;; | |||
ANALOG_AD_REF_FAIL) echo 38;; | |||
BYPASS_UNCALIBRATED) echo 39;; | |||
RECTIFIER_UNCALIBRATED) echo 40;; | |||
OUTPUT_UNCALIBRATED) echo 41;; | |||
INVERTER_UNCALIBRATED) echo 42;; | |||
DC_VOLT_UNCALIBRATED) echo 43;; | |||
OUTPUT_CURRENT_UNCALIBRATED) echo 44;; | |||
RECTIFIER_CURRENT_UNCALIBRATED) echo 45;; | |||
BATTERY_CURRENT_UNCALIBRATED) echo 46;; | |||
INVERTER_ON_OFF_STAT_FAIL) echo 47;; | |||
BATTERY_CURRENT_LIMIT) echo 48;; | |||
INVERTER_STARTUP_FAIL) echo 49;; | |||
ANALOG_BOARD_AD_STAT_FAIL) echo 50;; | |||
OUTPUT_CURRENT_OVER_100) echo 51;; | |||
BATTERY_GROUND_FAULT) echo 52;; | |||
WAITING_FOR_CHARGER_SYNC) echo 53;; | |||
NV_RAM_FAIL) echo 54;; | |||
ANALOG_BOARD_AD_TIMEOUT) echo 55;; | |||
SHUTDOWN_IMMINENT) echo 56;; | |||
BATTERY_LOW) echo 57;; | |||
UTILITY_FAIL) echo 58;; | |||
OUTPUT_SHORT_CIRCUIT) echo 59;; | |||
UTILITY_NOT_PRESENT) echo 60;; | |||
FULL_TIME_CHARGING) echo 61;; | |||
FAST_BYPASS_COMMAND) echo 62;; | |||
AD_ERROR) echo 63;; | |||
INTERNAL_COM_FAIL) echo 64;; | |||
RECTIFIER_SELFTEST_FAIL) echo 65;; | |||
RECTIFIER_EEPROM_FAIL) echo 66;; | |||
RECTIFIER_EPROM_FAIL) echo 67;; | |||
INPUT_LINE_VOLTAGE_LOSS) echo 68;; | |||
BATTERY_DC_OVER_VOLTAGE) echo 69;; | |||
POWER_SUPPLY_OVER_TEMP) echo 70;; | |||
POWER_SUPPLY_FAIL) echo 71;; | |||
POWER_SUPPLY_5V_FAIL) echo 72;; | |||
POWER_SUPPLY_12V_FAIL) echo 73;; | |||
HEATSINK_OVER_TEMP) echo 74;; | |||
HEATSINK_TEMP_SENSOR_FAIL) echo 75;; | |||
RECTIFIER_CURRENT_OVER_125) echo 76;; | |||
RECTIFIER_FAULT_INTERRUPT_FAIL) echo 77;; | |||
RECTIFIER_POWER_CAPASITOR_FAIL) echo 78;; | |||
INVERTER_PROGRAM_STACK_ERROR) echo 79;; | |||
INVERTER_BOARD_SELFTEST_FAIL) echo 80;; | |||
INVERTER_AD_SELFTEST_FAIL) echo 81;; | |||
INVERTER_RAM_SELFTEST_FAIL) echo 82;; | |||
NV_MEMORY_CHECKSUM_FAIL) echo 83;; | |||
PROGRAM_CHECKSUM_FAIL) echo 84;; | |||
INVERTER_CPU_SELFTEST_FAIL) echo 85;; | |||
NETWORK_NOT_RESPONDING) echo 86;; | |||
FRONT_PANEL_SELFTEST_FAIL) echo 87;; | |||
NODE_EEPROM_VERIFICATION_ERROR) echo 88;; | |||
OUTPUT_AC_OVER_VOLT_TEST_FAIL) echo 89;; | |||
OUTPUT_DC_OVER_VOLTAGE) echo 90;; | |||
INPUT_PHASE_ROTATION_ERROR) echo 91;; | |||
INVERTER_RAMP_UP_TEST_FAILED) echo 92;; | |||
INVERTER_OFF_COMMAND) echo 93;; | |||
INVERTER_ON_COMMAND) echo 94;; | |||
TO_BYPASS_COMMAND) echo 95;; | |||
FROM_BYPASS_COMMAND) echo 96;; | |||
AUTO_MODE_COMMAND) echo 97;; | |||
EMERGENCY_SHUTDOWN_COMMAND) echo 98;; | |||
SETUP_SWITCH_OPEN) echo 99;; | |||
INVERTER_OVER_VOLT_INT) echo 100;; | |||
INVERTER_UNDER_VOLT_INT) echo 101;; | |||
ABSOLUTE_DCOV_ACOV) echo 102;; | |||
PHASE_A_CURRENT_LIMIT) echo 103;; | |||
PHASE_B_CURRENT_LIMIT) echo 104;; | |||
PHASE_C_CURRENT_LIMIT) echo 105;; | |||
BYPASS_NOT_AVAILABLE) echo 106;; | |||
RECTIFIER_BREAKER_OPEN) echo 107;; | |||
BATTERY_CONTACTOR_OPEN) echo 108;; | |||
INVERTER_CONTACTOR_OPEN) echo 109;; | |||
BYPASS_BREAKER_OPEN) echo 110;; | |||
INV_BOARD_ACOV_INT_TEST_FAIL) echo 111;; | |||
INVERTER_OVER_TEMP_TRIP) echo 112;; | |||
INV_BOARD_ACUV_INT_TEST_FAIL) echo 113;; | |||
INVERTER_VOLTAGE_FEEDBACK_ERROR) echo 114;; | |||
DC_UNDER_VOLTAGE_TIMEOUT) echo 115;; | |||
AC_UNDER_VOLTAGE_TIMEOUT) echo 116;; | |||
DC_UNDER_VOLTAGE_WHILE_CHARGE) echo 117;; | |||
INVERTER_VOLTAGE_BIAS_ERROR) echo 118;; | |||
RECTIFIER_PHASE_ROTATION) echo 119;; | |||
BYPASS_PHASER_ROTATION) echo 120;; | |||
SYSTEM_INTERFACE_BOARD_FAIL) echo 121;; | |||
PARALLEL_BOARD_FAIL) echo 122;; | |||
LOST_LOAD_SHARING_PHASE_A) echo 123;; | |||
LOST_LOAD_SHARING_PHASE_B) echo 124;; | |||
LOST_LOAD_SHARING_PHASE_C) echo 125;; | |||
DC_OVER_VOLTAGE_TIMEOUT) echo 126;; | |||
BATTERY_TOTALLY_DISCHARGED) echo 127;; | |||
INVERTER_PHASE_BIAS_ERROR) echo 128;; | |||
INVERTER_VOLTAGE_BIAS_ERROR_2) echo 129;; | |||
DC_LINK_BLEED_COMPLETE) echo 130;; | |||
LARGE_CHARGER_INPUT_CURRENT) echo 131;; | |||
INV_VOLT_TOO_LOW_FOR_RAMP_LEVEL) echo 132;; | |||
LOSS_OF_REDUNDANCY) echo 133;; | |||
LOSS_OF_SYNC_BUS) echo 134;; | |||
RECTIFIER_BREAKER_SHUNT_TRIP) echo 135;; | |||
LOSS_OF_CHARGER_SYNC) echo 136;; | |||
INVERTER_LOW_LEVEL_TEST_TIMEOUT) echo 137;; | |||
OUTPUT_BREAKER_OPEN) echo 138;; | |||
CONTROL_POWER_ON) echo 139;; | |||
INVERTER_ON) echo 140;; | |||
CHARGER_ON) echo 141;; | |||
BYPASS_ON) echo 142;; | |||
BYPASS_POWER_LOSS) echo 143;; | |||
ON_MANUAL_BYPASS) echo 144;; | |||
BYPASS_MANUAL_TURN_OFF) echo 145;; | |||
INVERTER_BLEEDING_DC_LINK_VOLT) echo 146;; | |||
CPU_ISR_ERROR) echo 147;; | |||
SYSTEM_ISR_RESTART) echo 148;; | |||
PARALLEL_DC) echo 149;; | |||
BATTERY_NEEDS_SERVICE) echo 150;; | |||
BATTERY_CHARGING) echo 151;; | |||
BATTERY_NOT_CHARGED) echo 152;; | |||
DISABLED_BATTERY_TIME) echo 153;; | |||
SERIES_7000_ENABLE) echo 154;; | |||
OTHER_UPS_ON) echo 155;; | |||
PARALLEL_INVERTER) echo 156;; | |||
UPS_IN_PARALLEL) echo 157;; | |||
OUTPUT_BREAKER_REALY_FAIL) echo 158;; | |||
CONTROL_POWER_OFF) echo 159;; | |||
LEVEL_2_OVERLOAD_PHASE_A) echo 160;; | |||
LEVEL_2_OVERLOAD_PHASE_B) echo 161;; | |||
LEVEL_2_OVERLOAD_PHASE_C) echo 162;; | |||
LEVEL_3_OVERLOAD_PHASE_A) echo 163;; | |||
LEVEL_3_OVERLOAD_PHASE_B) echo 164;; | |||
LEVEL_3_OVERLOAD_PHASE_C) echo 165;; | |||
LEVEL_4_OVERLOAD_PHASE_A) echo 166;; | |||
LEVEL_4_OVERLOAD_PHASE_B) echo 167;; | |||
LEVEL_4_OVERLOAD_PHASE_C) echo 168;; | |||
UPS_ON_BATTERY) echo 169;; | |||
UPS_ON_BYPASS) echo 170;; | |||
LOAD_DUMPED) echo 171;; | |||
LOAD_ON_INVERTER) echo 172;; | |||
UPS_ON_COMMAND) echo 173;; | |||
UPS_OFF_COMMAND) echo 174;; | |||
LOW_BATTERY_SHUTDOWN) echo 175;; | |||
AUTO_ON_ENABLED) echo 176;; | |||
SOFTWARE_INCOMPABILITY_DETECTED) echo 177;; | |||
INVERTER_TEMP_SENSOR_FAILED) echo 178;; | |||
DC_START_OCCURED) echo 179;; | |||
IN_PARALLEL_OPERATION) echo 180;; | |||
SYNCING_TO_BYPASS) echo 181;; | |||
RAMPING_UPS_UP) echo 182;; | |||
INVERTER_ON_DELAY) echo 183;; | |||
CHARGER_ON_DELAY) echo 184;; | |||
WAITING_FOR_UTIL_INPUT) echo 185;; | |||
CLOSE_BYPASS_BREAKER) echo 186;; | |||
TEMPORARY_BYPASS_OPERATION) echo 187;; | |||
SYNCING_TO_OUTPUT) echo 188;; | |||
BYPASS_FAILURE) echo 189;; | |||
AUTO_OFF_COMMAND_EXECUTED) echo 190;; | |||
AUTO_ON_COMMAND_EXECUTED) echo 191;; | |||
BATTERY_TEST_FAILED) echo 192;; | |||
FUSE_FAIL) echo 193;; | |||
FAN_FAIL) echo 194;; | |||
SITE_WIRING_FAULT) echo 195;; | |||
BACKFEED_CONTACTOR_FAIL) echo 196;; | |||
ON_BUCK) echo 197;; | |||
ON_BOOST) echo 198;; | |||
ON_DOUBLE_BOOST) echo 199;; | |||
BATTERIES_DISCONNECTED) echo 200;; | |||
UPS_CABINET_OVER_TEMP) echo 201;; | |||
TRANSFORMER_OVER_TEMP) echo 202;; | |||
AMBIENT_UNDER_TEMP) echo 203;; | |||
AMBIENT_OVER_TEMP) echo 204;; | |||
CABINET_DOOR_OPEN) echo 205;; | |||
CABINET_DOOR_OPEN_VOLT_PRESENT) echo 206;; | |||
AUTO_SHUTDOWN_PENDING) echo 207;; | |||
TAP_SWITCHING_REALY_PENDING) echo 208;; | |||
UNABLE_TO_CHARGE_BATTERIES) echo 209;; | |||
STARTUP_FAILURE_CHECK_EPO) echo 210;; | |||
AUTOMATIC_STARTUP_PENDING) echo 211;; | |||
MODEM_FAILED) echo 212;; | |||
INCOMING_MODEM_CALL_STARTED) echo 213;; | |||
OUTGOING_MODEM_CALL_STARTED) echo 214;; | |||
MODEM_CONNECTION_ESTABLISHED) echo 215;; | |||
MODEM_CALL_COMPLETED_SUCCESS) echo 216;; | |||
MODEM_CALL_COMPLETED_FAIL) echo 217;; | |||
INPUT_BREAKER_FAIL) echo 218;; | |||
SYSINIT_IN_PROGRESS) echo 219;; | |||
AUTOCALIBRATION_FAIL) echo 220;; | |||
SELECTIVE_TRIP_OF_MODULE) echo 221;; | |||
INVERTER_OUTPUT_FAILURE) echo 222;; | |||
ABNORMAL_OUTPUT_VOLT_AT_STARTUP) echo 223;; | |||
RECTIFIER_OVER_TEMP) echo 224;; | |||
CONFIG_ERROR) echo 225;; | |||
REDUNDANCY_LOSS_DUE_TO_OVERLOAD) echo 226;; | |||
ON_ALTERNATE_AC_SOURCE) echo 227;; | |||
IN_HIGH_EFFICIENCY_MODE) echo 228;; | |||
SYSTEM_NOTICE_ACTIVE) echo 229;; | |||
SYSTEM_ALARM_ACTIVE) echo 230;; | |||
ALTERNATE_POWER_SOURCE_NOT_AVAILABLE) echo 231;; | |||
CURRENT_BALANCE_FAILURE) echo 232;; | |||
CHECK_AIR_FILTER) echo 233;; | |||
SUBSYSTEM_NOTICE_ACTIVE) echo 234;; | |||
SUBSYSTEM_ALARM_ACTIVE) echo 235;; | |||
CHARGER_ON_COMMAND) echo 236;; | |||
CHARGER_OFF_COMMAND) echo 237;; | |||
UPS_NORMAL) echo 238;; | |||
INVERTER_PHASE_ROTATION) echo 239;; | |||
UPS_OFF) echo 240;; | |||
EXTERNAL_COMMUNICATION_FAILURE) echo 241;; | |||
BATTERY_TEST_INPROGRESS) echo 242;; | |||
SYSTEM_TEST_INPROGRESS) echo 243;; | |||
BATTERY_TEST_ABORTED) echo 244;; | |||
* ) echo "0" ;; | |||
esac | |||
} | |||
other_val(){ | |||
case "$val" in | |||
"Error: Variable not supported by UPS") echo "NA" ;; | |||
* ) echo $val ;; | |||
esac | |||
} | |||
ups=$1 | |||
if [ $ups = ups.discovery ]; then | |||
echo -e "{\n\t\"data\":[" | |||
first=1 | |||
/bin/upsc -l 2>&1 | grep -v SSL | while read discovered ; do | |||
if [ $first -eq 0 ]; then | |||
echo -e "," | |||
fi | |||
echo -en "\t\t{ \"{#UPSNAME}\":\t\"${discovered}\" }" | |||
first=0 | |||
done | |||
echo -e "\n\t]\n}" | |||
else | |||
key=$2 | |||
case $key in | |||
ups.status) state=`/bin/upsc $ups $key 2>&1 | grep -v SSL|awk '{print $1}'`;state_num;exit;; | |||
ups.status-2) state=`/bin/upsc $ups ups.status 2>&1 | grep -v SSL|awk '{print $2}'`;state_num;exit;; | |||
ups.status-3) state=`/bin/upsc $ups ups.status 2>&1 | grep -v SSL|awk '{print $3}'`;state_num;exit;; | |||
ups.status-4) state=`/bin/upsc $ups ups.status 2>&1 | grep -v SSL|awk '{print $4}'`;state_num;exit;; | |||
ups.status-5) state=`/bin/upsc $ups ups.status 2>&1 | grep -v SSL|awk '{print $5}'`;state_num;exit;; | |||
ups.alarm ) alarm=`/bin/upsc $ups ups.alarm 2>&1 | grep -v SSL|awk '{print $1}'`;alarm_num;exit;; | |||
ups.alarm-2) alarm=`/bin/upsc $ups ups.alarm 2>&1 | grep -v SSL|awk '{print $2}'`;alarm_num;exit;; | |||
ups.alarm-3) alarm=`/bin/upsc $ups ups.alarm 2>&1 | grep -v SSL|awk '{print $3}'`;alarm_num;exit;; | |||
ups.alarm-4) alarm=`/bin/upsc $ups ups.alarm 2>&1 | grep -v SSL|awk '{print $4}'`;alarm_num;exit;; | |||
ups.alarm-5) alarm=`/bin/upsc $ups ups.alarm 2>&1 | grep -v SSL|awk '{print $5}'`;alarm_num;exit;; | |||
ups.alarm-6) alarm=`/bin/upsc $ups ups.alarm 2>&1 | grep -v SSL|awk '{print $6}'`;alarm_num;exit;; | |||
ups.alarm-7) alarm=`/bin/upsc $ups ups.alarm 2>&1 | grep -v SSL|awk '{print $7}'`;alarm_num;exit;; | |||
ups.alarm-8) alarm=`/bin/upsc $ups ups.alarm 2>&1 | grep -v SSL|awk '{print $8}'`;alarm_num;exit;; | |||
ups.alarm-9) alarm=`/bin/upsc $ups ups.alarm 2>&1 | grep -v SSL|awk '{print $9}'`;alarm_num;exit;; | |||
ups.alarm-10) alarm=`/bin/upsc $ups ups.alarm 2>&1 | grep -v SSL|awk '{print $10}'`;alarm_num;exit;; | |||
* ) val=`/bin/upsc $ups $key 2>&1 | grep -v SSL`;other_val;exit;; | |||
esac | |||
fi |
@ -0,0 +1 @@ | |||
UserParameter=upsmon[*],/opt/nut-ups.sh $1 $2 |
@ -0,0 +1,257 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<zabbix_export> | |||
<version>2.0</version> | |||
<date>2015-03-19T07:22:49Z</date> | |||
<groups> | |||
<group> | |||
<name>MyTemplates</name> | |||
</group> | |||
</groups> | |||
<templates> | |||
<template> | |||
<template>MyTemplate_ProxmoxVM_agent</template> | |||
<name>MyTemplate_ProxmoxVM_agent</name> | |||
<groups> | |||
<group> | |||
<name>MyTemplates</name> | |||
</group> | |||
</groups> | |||
<applications> | |||
<application> | |||
<name>VM-s</name> | |||
</application> | |||
</applications> | |||
<items/> | |||
<discovery_rules> | |||
<discovery_rule> | |||
<name>Proxmox_VE_discovery</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<snmp_oid/> | |||
<key>vmscript</key> | |||
<delay>900</delay> | |||
<status>0</status> | |||
<allowed_hosts/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privpassphrase/> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<filter>:</filter> | |||
<lifetime>30</lifetime> | |||
<description/> | |||
<item_prototypes> | |||
<item_prototype> | |||
<name>vm {#VMNAME} cpu load</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>vmscript[{#VMNAME},cpu]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>0</value_type> | |||
<allowed_hosts/> | |||
<units>%</units> | |||
<delta>0</delta> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>VM-s</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>vm {#VMNAME} HDD read</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>1</multiplier> | |||
<snmp_oid/> | |||
<key>vmscript[{#VMNAME},read]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>0</value_type> | |||
<allowed_hosts/> | |||
<units>B/s</units> | |||
<delta>0</delta> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privpassphrase/> | |||
<formula>1024</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>VM-s</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>vm {#VMNAME} HDD write</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>1</multiplier> | |||
<snmp_oid/> | |||
<key>vmscript[{#VMNAME},write]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>0</value_type> | |||
<allowed_hosts/> | |||
<units>B/s</units> | |||
<delta>0</delta> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privpassphrase/> | |||
<formula>1024</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>VM-s</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>vm {#VMNAME} memory</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>1</multiplier> | |||
<snmp_oid/> | |||
<key>vmscript[{#VMNAME},mem]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units>B</units> | |||
<delta>0</delta> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privpassphrase/> | |||
<formula>1024</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>VM-s</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>vm {#VMNAME} pid</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>vmscript[{#VMNAME},pid]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units/> | |||
<delta>0</delta> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>VM-s</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
</item_prototype> | |||
</item_prototypes> | |||
<trigger_prototypes/> | |||
<graph_prototypes/> | |||
</discovery_rule> | |||
</discovery_rules> | |||
<macros/> | |||
<templates/> | |||
<screens/> | |||
</template> | |||
</templates> | |||
</zabbix_export> |
@ -0,0 +1,59 @@ | |||
#!/bin/bash | |||
HN=`hostname` | |||
if [[ -z $1 || -z $2 ]]; then | |||
##### DISCOVERY ##### | |||
VMS=`ls /etc/pve/nodes/$HN/qemu-server | sed s/\.conf//` | |||
if [[ -n ${VMS} ]]; then | |||
JSON="{ \"data\":[" | |||
for VM in ${VMS}; do | |||
JSON=${JSON}"{ \"{#VMNAME}\":\"${VM}\"}," | |||
done | |||
JSON=${JSON}"]}" | |||
echo ${JSON} | |||
fi | |||
exit 0 | |||
else | |||
##### PARAMETERS ##### | |||
VM="$1" | |||
METRIC="$2" | |||
FILECACHE="/tmp/zabbix.vmstat.cache" | |||
TTLCACHE="50" | |||
TIMENOW=`date '+%s'` | |||
##### CACHE ##### | |||
if [ -s "${FILECACHE}" ]; then | |||
TIMECACHE=`stat -c"%Y" "${FILECACHE}"` | |||
else | |||
TIMECACHE=0 | |||
fi | |||
if [ "$((${TIMENOW} - ${TIMECACHE}))" -gt "${TTLCACHE}" ]; then | |||
echo "">> ${FILECACHE} # !!! | |||
DATACACHE1=`ps -eo pid,pcpu,%mem,rss,command | awk '/usr\/bin\/kvm -id/ {print "VM"$7" "$1" "$2" "$3" "$4}' | sort` | |||
DATACACHE2=`sudo /usr/sbin/iotop -P -k -n 1 --batch | awk '/kvm -id/ {print "VM"$14" "$1" "$4" "$6}' | sort` | |||
echo "${DATACACHE1}" > ${FILECACHE} # !!! | |||
echo "${DATACACHE2}">> ${FILECACHE} # !!! | |||
chmod 777 ${FILECACHE} | |||
fi | |||
##### VM statistic ##### | |||
if [ "` cat ${FILECACHE} | grep VM${VM}`" = "" ]; then | |||
echo 0 | |||
exit 0 | |||
fi | |||
case "$METRIC" in | |||
"cpu") | |||
cat ${FILECACHE} | grep VM${VM} | head -n 1 | awk '{print$3}' | |||
exit 0;; | |||
"mem") | |||
cat ${FILECACHE} | grep VM${VM} | head -n 1 | awk '{print$5}' | |||
exit 0;; | |||
"read") | |||
cat ${FILECACHE} | grep VM${VM} | tail -n 1 | awk '{print$3}' | |||
exit 0;; | |||
"write") | |||
cat ${FILECACHE} | grep VM${VM} | tail -n 1 | awk '{print$4}' | |||
exit 0;; | |||
"pid") | |||
cat ${FILECACHE} | grep VM${VM} | head -n 1 | awk '{print$2}' | |||
exit 0;; | |||
esac; | |||
# | |||
fi |
@ -0,0 +1,13 @@ | |||
#!/bin/bash | |||
HDDs=`cat /proc/diskstats | awk '/[sh][d][a-z] / {print$3}'` | |||
FIRST="1" | |||
JSON="{ \"data\":[" | |||
for HDD in ${HDDs}; do | |||
if [ $FIRST == "0" ]; then | |||
JSON="${JSON}," | |||
fi | |||
JSON=${JSON}"{ \"{#HDD}\":\"${HDD}\"}" | |||
FIRST="0" | |||
done | |||
JSON=${JSON}"]}" | |||
echo ${JSON} |
@ -0,0 +1,9 @@ | |||
UserParameter=custom.vfs.dev.read.ops[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$4}' | |||
UserParameter=custom.vfs.dev.read.ms[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$7}' | |||
UserParameter=custom.vfs.dev.write.ops[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$8}' | |||
UserParameter=custom.vfs.dev.write.ms[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$11}' | |||
UserParameter=custom.vfs.dev.io.active[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$12}' | |||
UserParameter=custom.vfs.dev.io.ms[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$13}' | |||
UserParameter=custom.vfs.dev.read.sectors[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$6}' | |||
UserParameter=custom.vfs.dev.write.sectors[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$10}' | |||
UserParameter=custom.vfs.hdd.discovery,/etc/zabbix/scripts/hdd_discovery.sh |
@ -0,0 +1,281 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<zabbix_export> | |||
<version>2.0</version> | |||
<date>2016-04-05T08:25:03Z</date> | |||
<groups> | |||
<group> | |||
<name>mix_template</name> | |||
</group> | |||
</groups> | |||
<templates> | |||
<template> | |||
<template>mix_Template_linux_HDD_perf</template> | |||
<name>mix_Template_linux_HDD_perf</name> | |||
<groups> | |||
<group> | |||
<name>mix_template</name> | |||
</group> | |||
</groups> | |||
<applications> | |||
<application> | |||
<name>HDD_Perf</name> | |||
</application> | |||
</applications> | |||
<items/> | |||
<discovery_rules> | |||
<discovery_rule> | |||
<name>hdd_discovery</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<snmp_oid/> | |||
<key>custom.vfs.hdd.discovery</key> | |||
<delay>3600</delay> | |||
<status>0</status> | |||
<allowed_hosts/> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<filter>:</filter> | |||
<lifetime>30</lifetime> | |||
<description/> | |||
<item_prototypes> | |||
<item_prototype> | |||
<name>{#HDD}:Latency:IOps</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>1</multiplier> | |||
<snmp_oid/> | |||
<key>custom.vfs.dev.io.ms[{#HDD}]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units>s</units> | |||
<delta>1</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>0.001</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>HDD_Perf</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>{#HDD}:Read:Bytes/sec</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>1</multiplier> | |||
<snmp_oid/> | |||
<key>custom.vfs.dev.read.sectors[{#HDD}]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units>Bytes/sec</units> | |||
<delta>1</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>512</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>HDD_Perf</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>{#HDD}:Read:IOps</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>custom.vfs.dev.read.ops[{#HDD}]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units>IOps</units> | |||
<delta>1</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>HDD_Perf</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>{#HDD}:Write:Bytes/sec</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>1</multiplier> | |||
<snmp_oid/> | |||
<key>custom.vfs.dev.write.sectors[{#HDD}]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units>Bytes/sec</units> | |||
<delta>1</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>512</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>HDD_Perf</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>{#HDD}:Write:IOps</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>custom.vfs.dev.write.ops[{#HDD}]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units>IOps</units> | |||
<delta>1</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>HDD_Perf</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
</item_prototypes> | |||
<trigger_prototypes/> | |||
<graph_prototypes/> | |||
<host_prototypes/> | |||
</discovery_rule> | |||
</discovery_rules> | |||
<macros/> | |||
<templates/> | |||
<screens/> | |||
</template> | |||
</templates> | |||
</zabbix_export> |
@ -0,0 +1,169 @@ | |||
#! /usr/bin/env python | |||
import subprocess | |||
import sys | |||
import os | |||
import time | |||
ld_file = "/tmp/megacli-logical.out" | |||
pd_file = "/tmp/megacli-physical.out" | |||
ld_cmd = "cat /opt/py/megacli-logical.out" | |||
pd_cmd = "cat /opt/py/megacli-physical.out" | |||
pd_dict = dict(slot='Slot Number', port_stat='Port status', size='Raw Size', data='Inquiry Data', | |||
temp='Drive Temperature ', smart_err='Drive has flagged a S.M.A.R.T alert', | |||
manufacter='Inquiry Data', model='Inquiry Data', serial='Inquiry Data') | |||
ld_dict = dict(num='Virtual Drive:', raid_lvl='RAID Level ', size='Size', state='State', pd_count='Number Of Drives') | |||
def f_ld_discover(cli_out): | |||
drives = [] | |||
linesplit = '' | |||
for line in cli_out: | |||
if 'Virtual Drive:' in line: | |||
linesplit = line.split(' ') | |||
drives.append(str(linesplit[2])) | |||
return drives | |||
def f_pd_discover(cli_out): | |||
drives = [] | |||
linesplit = '' | |||
for line in cli_out: | |||
if 'Slot Number:' in line: | |||
linesplit = line.split(' ') | |||
drives.append(str(linesplit[2])) | |||
return drives | |||
def f_json_print(inp, name): | |||
first = True | |||
print("{") | |||
print("\t\"data\":[") | |||
for key in inp: | |||
if not first: | |||
sys.stdout.write(",") | |||
else: | |||
first = False | |||
sys.stdout.write("\n\t\t{\"{#" + name + "}\":\"" + key + "\"}") | |||
print("\n\t]") | |||
print("}") | |||
def f_read_file(path): | |||
cli_out = [] | |||
try: | |||
f = open(path, 'r') | |||
except Exception: | |||
print(Exception) | |||
return [] | |||
else: | |||
for line in f.readlines(): | |||
cli_out.append(line.strip()) | |||
f.close() | |||
return cli_out | |||
def f_read_cli(cmd, outfile): | |||
outdata, stderr = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True).communicate() | |||
try: | |||
f = open(outfile, 'w') | |||
except Exception: | |||
return 1 | |||
else: | |||
f.write(outdata) | |||
f.close() | |||
return 0 | |||
def f_get_pd_val(slot, val, source): | |||
data = f_read_file(source) | |||
k = 0 | |||
out = "" | |||
for line in data: | |||
if pd_dict['slot'] in line: | |||
# print(line.strip().split(':')[1].strip()) | |||
if line.strip().split(':')[1].strip() == slot: | |||
k = 1 | |||
if k == 0: | |||
continue | |||
if k == 1: | |||
if pd_dict[val] in line: | |||
out = line.strip().split(':')[1].strip().split() | |||
if out != "": | |||
break | |||
if len(out) == 1 and out[0].isdigit(): | |||
return out[0] | |||
elif val == 'smart_err': | |||
if out[0] == 'No': | |||
return '0' | |||
else: | |||
return '1' | |||
elif val == "manufacter": | |||
return out[0].strip() | |||
elif val == "model": | |||
return out[1].strip() | |||
elif val == "serial": | |||
return out[2].strip() | |||
elif val == 'size': | |||
return out[0] | |||
elif val == 'port_stat': | |||
if out[0] == 'Active': | |||
return '1' | |||
else: | |||
return '0' | |||
elif val == 'temp': | |||
return out[0][:-1] | |||
def f_get_ld_val(num, val, source): | |||
data = f_read_file(source) | |||
k = 0 | |||
out = "" | |||
for line in data: | |||
if ld_dict['num'] in line: | |||
if line.split(':')[1].strip().split()[0].strip() == num: | |||
k = 1 | |||
if k == 0: | |||
continue | |||
if k == 1: | |||
if ld_dict[val] in line: | |||
out = line.split(':')[1].strip() | |||
if out != "": | |||
break | |||
if val == 'raid_lvl': | |||
return out | |||
elif val == 'size': | |||
return out.split()[0] | |||
elif val == 'state': | |||
if out.strip() == 'Optimal': | |||
return '0' | |||
else: | |||
return '1' | |||
elif val == 'pd_count': | |||
return out.strip() | |||
return out | |||
if __name__ == '__main__': | |||
if len(sys.argv) == 1 or len(sys.argv) == 3 or len(sys.argv) > 4: | |||
print("Wrong args. Cache will be updated if necessary") | |||
stat_pd = os.stat(pd_file) | |||
stat_ld = os.stat(ld_file) | |||
if (float(time.time()) - float(stat_pd.st_ctime)) > 50: | |||
f_read_cli(pd_cmd, pd_file) | |||
if (float(time.time()) - float(stat_ld.st_ctime)) > 50: | |||
f_read_cli(ld_cmd, ld_file) | |||
if len(sys.argv) == 2: | |||
if sys.argv[1] == "ld": | |||
f_json_print(f_ld_discover(f_read_file(ld_file)), "LD") | |||
if sys.argv[1] == "pd": | |||
f_json_print(f_pd_discover(f_read_file(pd_file)), "PD") | |||
elif len(sys.argv) == 4: | |||
if sys.argv[1] == 'pd': | |||
if sys.argv[3] in pd_dict.keys(): | |||
print(f_get_pd_val(sys.argv[2], sys.argv[3], pd_file)) | |||
if sys.argv[1] == 'ld': | |||
if sys.argv[3] in ld_dict.keys(): | |||
print(f_get_ld_val(sys.argv[2], sys.argv[3], ld_file)) |
@ -0,0 +1,623 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<zabbix_export> | |||
<version>2.0</version> | |||
<date>2015-11-18T08:30:50Z</date> | |||
<groups> | |||
<group> | |||
<name>mix_template</name> | |||
</group> | |||
</groups> | |||
<templates> | |||
<template> | |||
<template>mix_megacli_parser</template> | |||
<name>mix_megacli_parser</name> | |||
<groups> | |||
<group> | |||
<name>mix_template</name> | |||
</group> | |||
</groups> | |||
<applications> | |||
<application> | |||
<name>logical_disks</name> | |||
</application> | |||
<application> | |||
<name>physical_disks</name> | |||
</application> | |||
</applications> | |||
<items/> | |||
<discovery_rules> | |||
<discovery_rule> | |||
<name>logical_disc_discovery</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<snmp_oid/> | |||
<key>megacli_parser[ld]</key> | |||
<delay>3600</delay> | |||
<status>0</status> | |||
<allowed_hosts/> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<filter>{#LD}:</filter> | |||
<lifetime>30</lifetime> | |||
<description/> | |||
<item_prototypes> | |||
<item_prototype> | |||
<name>logical_disc {#LD} physical disc count</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>megacli_parser[ld,{#LD},pd_count]</key> | |||
<delay>3600</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units/> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>logical_disks</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>logical_disc {#LD} raid level</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>megacli_parser[ld,{#LD},raid_lvl]</key> | |||
<delay>3600</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>4</value_type> | |||
<allowed_hosts/> | |||
<units/> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>logical_disks</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>logical_disc {#LD} size</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>megacli_parser[ld,{#LD},size]</key> | |||
<delay>3600</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>0</value_type> | |||
<allowed_hosts/> | |||
<units>GB</units> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>logical_disks</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>logical_disc {#LD} state</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>megacli_parser[ld,{#LD},state]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units/> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>logical_disks</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
</item_prototypes> | |||
<trigger_prototypes> | |||
<trigger_prototype> | |||
<expression>{mix_megacli_parser:megacli_parser[ld,{#LD},state].last()}#0</expression> | |||
<name>raid state {#LD} not optimal</name> | |||
<url/> | |||
<status>0</status> | |||
<priority>5</priority> | |||
<description/> | |||
<type>0</type> | |||
</trigger_prototype> | |||
</trigger_prototypes> | |||
<graph_prototypes/> | |||
<host_prototypes/> | |||
</discovery_rule> | |||
<discovery_rule> | |||
<name>physical_disc_discovery</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<snmp_oid/> | |||
<key>megacli_parser[pd]</key> | |||
<delay>3600</delay> | |||
<status>0</status> | |||
<allowed_hosts/> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<filter>{#PD}:</filter> | |||
<lifetime>30</lifetime> | |||
<description/> | |||
<item_prototypes> | |||
<item_prototype> | |||
<name>physical disk {#PD} manufacter</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>megacli_parser[pd,{#PD},manufacter]</key> | |||
<delay>3600</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>4</value_type> | |||
<allowed_hosts/> | |||
<units/> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>physical_disks</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>physical disk {#PD} model</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>megacli_parser[pd,{#PD}},model]</key> | |||
<delay>3600</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>4</value_type> | |||
<allowed_hosts/> | |||
<units/> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>physical_disks</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>physical disk {#PD} port status</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>megacli_parser[pd,{#PD},port_stat]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units/> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>physical_disks</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>physical disk {#PD} serial</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>megacli_parser[pd,{#PD},serial]</key> | |||
<delay>3600</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>4</value_type> | |||
<allowed_hosts/> | |||
<units/> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>physical_disks</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>physical disk{#PD} size</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>megacli_parser[pd,{#PD},size]</key> | |||
<delay>3600</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>0</value_type> | |||
<allowed_hosts/> | |||
<units>GB</units> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>physical_disks</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>physical disk {#PD} smart error</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>megacli_parser[pd,{#PD},smart_err]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units/> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>physical_disks</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
<item_prototype> | |||
<name>physical disk {#PD} temp</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>megacli_parser[pd,{#PD},temp]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>3</value_type> | |||
<allowed_hosts/> | |||
<units>C</units> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>physical_disks</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
</item_prototype> | |||
</item_prototypes> | |||
<trigger_prototypes> | |||
<trigger_prototype> | |||
<expression>{mix_megacli_parser:megacli_parser[pd,{#PD},port_stat].last()}#1</expression> | |||
<name>physical disk {#PD} port status not Active</name> | |||
<url/> | |||
<status>0</status> | |||
<priority>5</priority> | |||
<description/> | |||
<type>0</type> | |||
</trigger_prototype> | |||
<trigger_prototype> | |||
<expression>{mix_megacli_parser:megacli_parser[pd,{#PD},smart_err].last()}#0</expression> | |||
<name>physical disk {#PD} smart error</name> | |||
<url/> | |||
<status>0</status> | |||
<priority>5</priority> | |||
<description/> | |||
<type>0</type> | |||
</trigger_prototype> | |||
<trigger_prototype> | |||
<expression>{mix_megacli_parser:megacli_parser[pd,{#PD},temp].last()}> 60</expression> | |||
<name>physical disk {#PD} temp > 60С</name> | |||
<url/> | |||
<status>0</status> | |||
<priority>4</priority> | |||
<description/> | |||
<type>0</type> | |||
</trigger_prototype> | |||
<trigger_prototype> | |||
<expression>{mix_megacli_parser:megacli_parser[pd,{#PD},temp].last()}> 70</expression> | |||
<name>physical disk {#PD} temp > 70С</name> | |||
<url/> | |||
<status>0</status> | |||
<priority>5</priority> | |||
<description/> | |||
<type>0</type> | |||
</trigger_prototype> | |||
</trigger_prototypes> | |||
<graph_prototypes/> | |||
<host_prototypes/> | |||
</discovery_rule> | |||
</discovery_rules> | |||
<macros/> | |||
<templates/> | |||
<screens/> | |||
</template> | |||
</templates> | |||
</zabbix_export> |
@ -0,0 +1,10 @@ | |||
apt install net-tools tmux htop zabbix-agent lm-sensors vim | |||
dpkg -i megacli_8.07.14-2_all.deb | |||
сгенерить zabbix_agentd.conf | |||
закинуть zabbix_agentd.conf.d | |||
закинуть скриптойды | |||
@ -0,0 +1,49 @@ | |||
# Minimal zabbix_agentd.conf | |||
# author Grebenkin Mikhail | |||
############ GENERAL PARAMETERS ################# | |||
PidFile=/var/run/zabbix/zabbix_agentd.pid | |||
###LOGGING### | |||
# LogType=file # default | |||
LogFile=/var/log/zabbix-agent/zabbix_agentd.log | |||
LogFileSize=0 # Maximum size of log file in MB. 0 - disable automatic log rotation. | |||
# DebugLevel=3 # default | |||
###NETWORK### | |||
# SourceIP= # default | |||
# EnableRemoteCommands=0 | |||
# LogRemoteCommands=0 # default | |||
##### Passive checks related | |||
Server=127.0.0.1 # server name or ip | |||
# ListenPort=10050 #default | |||
# ListenIP=0.0.0.0 #default | |||
# StartAgents=3 #default | |||
##### Active checks related | |||
ServerActive=127.0.0.1 # server name or ip | |||
# Hostname= #name must mach with hosntame in server options | |||
# HostnameItem=system.hostname #name must mach with hosntame in server options | |||
# RefreshActiveChecks=120 #default | |||
# HostMetadata= #default | |||
# HostMetadataItem= #default | |||
# BufferSend=5 #default (seconds to keep data to send) | |||
# BufferSize=100 #default (buffer to keep values) | |||
# MaxLinesPerSecond=20 #default (max lines in the buffer) | |||
############ ADVANCED PARAMETERS ################# | |||
# Timeout=3 #default (Timeout of system operations) | |||
# AllowRoot=0 #default (don't permit agent to start as root) | |||
# User=zabbix #default ( agent user start as) | |||
Include=/etc/zabbix/zabbix_agentd.conf.d/*.conf | |||
####### USER-DEFINED MONITORED PARAMETERS ####### | |||
# UnsafeUserParameters=0 #default | |||
# UserParameter= # Format: UserParameter=<key>,<shell command> |
@ -0,0 +1,62 @@ | |||
#! /usr/bin/env python | |||
import subprocess | |||
import sys | |||
def f_parse(sens_out): | |||
CPUN = 0 | |||
firstCPU = True | |||
coreN = 0 | |||
dimm = "0" | |||
ret = {} | |||
line_sp = "" | |||
for line in sens_out: | |||
if "DIMM" in line: | |||
line_sp = line.split() | |||
dimm = "DIMM" + line_sp[1] + "-" + line_sp[3][0] | |||
ret[dimm] = line_sp[4][1:-3] | |||
elif "coretemp" in line: | |||
if firstCPU: | |||
firstCPU = False | |||
else: | |||
CPUN = CPUN + 1 | |||
elif "Core" in line: | |||
line_sp = line.split() | |||
coreN = "core" + str(CPUN) + "-" + line_sp[1][0] | |||
ret[coreN] = line_sp[2][1:-3] | |||
return(ret) | |||
def f_sensors(): | |||
res = subprocess.Popen(['sudo sensors'], stdout=subprocess.PIPE, shell=True) | |||
sensors_out = res.stdout.readlines() | |||
return(sensors_out) | |||
def f_main(): | |||
sensors_out = f_sensors() | |||
sensors_parsed = f_parse(sensors_out) | |||
return(sensors_parsed) | |||
def f_json_print(inp): | |||
first = True | |||
print("{") | |||
print("\t\"data\":[") | |||
for key in inp: | |||
if not first: | |||
sys.stdout.write(",") | |||
else: | |||
first = False | |||
sys.stdout.write("\n\t\t{\"{#SENSOR}\":\"" + key + "\"}") | |||
print("\n\t]") | |||
print("}") | |||
if __name__ == '__main__': | |||
out = {} | |||
out = f_main() | |||
if len(sys.argv) == 2 and sys.argv[1]: | |||
print((out.get(sys.argv[1], "error"))) | |||
else: | |||
f_json_print(out) |
@ -0,0 +1,127 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<zabbix_export> | |||
<version>2.0</version> | |||
<date>2015-03-13T07:29:32Z</date> | |||
<groups> | |||
<group> | |||
<name>Linux servers</name> | |||
</group> | |||
</groups> | |||
<templates> | |||
<template> | |||
<template>mixTemplate_linux_sensors</template> | |||
<name>mixTemplate_linux_sensors</name> | |||
<groups> | |||
<group> | |||
<name>Linux servers</name> | |||
</group> | |||
</groups> | |||
<applications> | |||
<application> | |||
<name>Temperature</name> | |||
</application> | |||
</applications> | |||
<items/> | |||
<discovery_rules> | |||
<discovery_rule> | |||
<name>sensors_detect</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<snmp_oid/> | |||
<key>sensors_parse</key> | |||
<delay>600</delay> | |||
<status>0</status> | |||
<allowed_hosts/> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<filter>:</filter> | |||
<lifetime>90</lifetime> | |||
<description/> | |||
<item_prototypes> | |||
<item_prototype> | |||
<name>{#SENSOR} temp</name> | |||
<type>0</type> | |||
<snmp_community/> | |||
<multiplier>0</multiplier> | |||
<snmp_oid/> | |||
<key>sensors_parse[{#SENSOR}]</key> | |||
<delay>60</delay> | |||
<history>90</history> | |||
<trends>365</trends> | |||
<status>0</status> | |||
<value_type>0</value_type> | |||
<allowed_hosts/> | |||
<units>C</units> | |||
<delta>0</delta> | |||
<snmpv3_contextname/> | |||
<snmpv3_securityname/> | |||
<snmpv3_securitylevel>0</snmpv3_securitylevel> | |||
<snmpv3_authprotocol>0</snmpv3_authprotocol> | |||
<snmpv3_authpassphrase/> | |||
<snmpv3_privprotocol>0</snmpv3_privprotocol> | |||
<snmpv3_privpassphrase/> | |||
<formula>1</formula> | |||
<delay_flex/> | |||
<params/> | |||
<ipmi_sensor/> | |||
<data_type>0</data_type> | |||
<authtype>0</authtype> | |||
<username/> | |||
<password/> | |||
<publickey/> | |||
<privatekey/> | |||
<port/> | |||
<description/> | |||
<inventory_link>0</inventory_link> | |||
<applications> | |||
<application> | |||
<name>Temperature</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
</item_prototype> | |||
</item_prototypes> | |||
<trigger_prototypes> | |||
<trigger_prototype> | |||
<expression>{mixTemplate_linux_sensors:sensors_parse[{#SENSOR}].last()}>70</expression> | |||
<name>{#SENSOR} temp > 70 C</name> | |||
<url/> | |||
<status>0</status> | |||
<priority>3</priority> | |||
<description/> | |||
<type>0</type> | |||
</trigger_prototype> | |||
<trigger_prototype> | |||
<expression>{mixTemplate_linux_sensors:sensors_parse[{#SENSOR}].last()}>80</expression> | |||
<name>{#SENSOR} temp > 80 C</name> | |||
<url/> | |||
<status>0</status> | |||
<priority>5</priority> | |||
<description/> | |||
<type>0</type> | |||
</trigger_prototype> | |||
</trigger_prototypes> | |||
<graph_prototypes/> | |||
<host_prototypes/> | |||
</discovery_rule> | |||
</discovery_rules> | |||
<macros/> | |||
<templates/> | |||
<screens/> | |||
</template> | |||
</templates> | |||
</zabbix_export> |
@ -0,0 +1,2 @@ | |||
#!/bin/bash | |||
/usr/bin/time --format=%e /usr/bin/ldapsearch -o nettimeout=27 -x -h $1 -p 389 -D "$2" -w "$3" -s base 2>&1 | grep "result: 0 Success" | wc -l |
@ -0,0 +1,2 @@ | |||
#!/bin/bash | |||
/usr/bin/time --format=%e /usr/bin/ldapsearch -o nettimeout=27 -x -h $1 -p 389 -D "$2" -w "$3" -s base 2>&1 | tail -n 1 |
@ -0,0 +1,159 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<zabbix_export> | |||
<version>3.4</version> | |||
<date>2020-09-29T17:25:11Z</date> | |||
<groups> | |||
<group> | |||
<name>Templates</name> | |||
</group> | |||
</groups> | |||
<templates> | |||
<template> | |||
<template>external_ldap_check</template> | |||
<name>external_ldap_check</name> | |||
<description/> | |||
<groups> | |||
<group> | |||
<name>Templates</name> | |||
</group> | |||
</groups> | |||
<applications> | |||
<application> | |||
<name>ldap_check</name> | |||
</application> | |||
</applications> | |||
<items> | |||
<item> | |||
<name>ldap_check</name> | |||
<type>10</type> | |||
<snmp_community/> | |||
<snmp_oid/> | |||
<key>ldapsearch_check.sh[{HOST.CONN},{$LDAP_USER},{$LDAP_PASS}]</key> | |||
<delay>300s</delay> | |||
<history>90d</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>ldap_check</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
<preprocessing/> | |||
<jmx_endpoint/> | |||
<master_item/> | |||
</item> | |||
<item> | |||
<name>ldap_answer_time</name> | |||
<type>10</type> | |||
<snmp_community/> | |||
<snmp_oid/> | |||
<key>ldapsearch_time.sh[{HOST.CONN},{$LDAP_USER},{$LDAP_PASS}]</key> | |||
<delay>300s</delay> | |||
<history>90d</history> | |||
<trends>365d</trends> | |||
<status>0</status> | |||
<value_type>0</value_type> | |||
<allowed_hosts/> | |||
<units>s</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>ldap_check</name> | |||
</application> | |||
</applications> | |||
<valuemap/> | |||
<logtimefmt/> | |||
<preprocessing/> | |||
<jmx_endpoint/> | |||
<master_item/> | |||
</item> | |||
</items> | |||
<discovery_rules/> | |||
<httptests/> | |||
<macros> | |||
<macro> | |||
<macro>{$LDAP_PASS}</macro> | |||
<value>Zabbix1</value> | |||
</macro> | |||
<macro> | |||
<macro>{$LDAP_USER}</macro> | |||
<value>uid=zabbixldap,ou=users,dc=swan,dc=perm,dc=ru</value> | |||
</macro> | |||
</macros> | |||
<templates/> | |||
<screens/> | |||
</template> | |||
</templates> | |||
<triggers> | |||
<trigger> | |||
<expression>{external_ldap_check:ldapsearch_check.sh[{HOST.CONN},{$LDAP_USER},{$LDAP_PASS}].last()}=0</expression> | |||
<recovery_mode>0</recovery_mode> | |||
<recovery_expression/> | |||
<name>ldap check failed</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>{external_ldap_check:ldapsearch_time.sh[{HOST.CONN},{$LDAP_USER},{$LDAP_PASS}].last()}>25</expression> | |||
<recovery_mode>0</recovery_mode> | |||
<recovery_expression/> | |||
<name>ldap check time too long</name> | |||
<correlation_mode>0</correlation_mode> | |||
<correlation_tag/> | |||
<url/> | |||
<status>0</status> | |||
<priority>3</priority> | |||
<description/> | |||
<type>0</type> | |||
<manual_close>1</manual_close> | |||
<dependencies/> | |||
<tags/> | |||
</trigger> | |||
</triggers> | |||
</zabbix_export> |
Powered by TurnKey Linux.