commit 7c53a3100136797eac5f2a595616ef294122970f Author: Mikhail Grebenkin Date: Tue May 17 22:28:19 2022 +0300 first commit diff --git a/IRST/irst.txt b/IRST/irst.txt new file mode 100644 index 0000000..d082fe1 --- /dev/null +++ b/IRST/irst.txt @@ -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 diff --git a/Keepalived/keepalived.addr.availability.sh b/Keepalived/keepalived.addr.availability.sh new file mode 100644 index 0000000..9c9d949 --- /dev/null +++ b/Keepalived/keepalived.addr.availability.sh @@ -0,0 +1,8 @@ +#/usr/bin/env bash +# Description: determines if the IP address is available on this server +# Author: Lesovsky A.V. +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 diff --git a/Keepalived/keepalived.addr.discovery.sh b/Keepalived/keepalived.addr.discovery.sh new file mode 100644 index 0000000..9d4f739 --- /dev/null +++ b/Keepalived/keepalived.addr.discovery.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Description: keepalived virtual addreses auto-discovery +# Author: Lesovsky A.V. +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 ']}' diff --git a/Keepalived/keepalived.conf b/Keepalived/keepalived.conf new file mode 100644 index 0000000..1d2f7e2 --- /dev/null +++ b/Keepalived/keepalived.conf @@ -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 diff --git a/Keepalived/keepalived_template.xml b/Keepalived/keepalived_template.xml new file mode 100644 index 0000000..9fe7493 --- /dev/null +++ b/Keepalived/keepalived_template.xml @@ -0,0 +1,173 @@ + + + 2.0 + 2015-03-18T10:51:33Z + + + Templates + + + + + + + + {Inet-Template-Keepalived:proc.num[keepalived].last()}=0 + Keepalived down (proc count=0) + + 0 + 4 + + 0 + + + + diff --git a/MS_sql_server.xml b/MS_sql_server.xml new file mode 100644 index 0000000..688ce0c --- /dev/null +++ b/MS_sql_server.xml @@ -0,0 +1,1852 @@ + + + 2.0 + 2015-04-13T14:07:09Z + + + Ms_SQL_Server + + + Templates + + + + + + + + {Ms_SQL_Server:perf_counter["\SQLServer:Locks(_Total)\Number of Deadlocks/sec"].last(0)}>0 + SQL: Number >0 of Deadlocks per second + + 0 + 4 + + 0 + + + + {Ms_SQL_Server:service_state[MSSQLServerOLAPService].last(0)}#0 + SQL: Service State - Analysis Services + + 0 + 4 + + 0 + + + + {Ms_SQL_Server:service_state[MSDtsServer].last(0)}#0 + SQL: Service State - Integration Services + + 0 + 4 + + 0 + + + + {Ms_SQL_Server:service_state[ReportServer].last(0)}#0 + SQL: Service State - Reporting Services + + 0 + 4 + + 0 + + + + {Ms_SQL_Server:service_state[SQLServerAgent].last(0)}#0 + SQL: Service State - SQL Agent + + 0 + 4 + + 0 + + + + {Ms_SQL_Server:service_state[SQLBrowser].last(0)}#0 + SQL: Service State - SQL Browser + + 0 + 4 + + 0 + + + + {Ms_SQL_Server:service_state[MSSQLSERVER].last(0)}#0 + SQL: Service State - SQL Server + + 0 + 4 + + 0 + + + + + + SQL: LogicalDisk(E:\F:)\Avg. Disk sec/Read\Write + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 5 + C80000 + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(E:)\Среднее время чтения с диска (с)"] + + + + 1 + 1 + 00C800 + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(E:)\Среднее время записи на диск (с)"] + + + + 2 + 5 + 0000C8 + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(F:)\Среднее время чтения с диска (с)"] + + + + 3 + 5 + C800C8 + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(F:)\Среднее время записи на диск (с)"] + + + + + + SQL: LogicalDisk(E:\F:)\Disk Reads/Write sec + 500 + 200 + 0.0000 + 100.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 5 + C80000 + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(e:)\Обращений чтения с диска/с"] + + + + 1 + 1 + 00C800 + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(E:)\Обращений записи на диск/с"] + + + + 2 + 5 + 6666FF + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(F:)\Обращений чтения с диска/с"] + + + + 3 + 5 + 00DDDD + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(F:)\Обращений записи на диск/с"] + + + + + + SQL: LogicalDisk(G:\H:)\Disk Reads/Write sec + 500 + 200 + 0.0000 + 100.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 5 + 00C8C8 + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(G:)\Обращений чтения с диска/с"] + + + + 1 + 5 + C8C800 + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(G:)\Обращений записи на диск/с"] + + + + 2 + 5 + C8C8C8 + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(H:)\Обращений чтения с диска/с"] + + + + 3 + 5 + 960000 + 0 + 4 + 0 + + Ms_SQL_Server + perf_counter["\Логический диск(H:)\Обращений записи на диск/с"] + + + + + + diff --git a/Nut-ups/NUT_template.xml b/Nut-ups/NUT_template.xml new file mode 100644 index 0000000..69ae812 --- /dev/null +++ b/Nut-ups/NUT_template.xml @@ -0,0 +1,3170 @@ + + + 4.0 + 2022-05-17T18:59:34Z + + + UPS + + + + + + + + NUT UPS Alarm + + + 0 + Всё нормально + + + 1 + INVERTER_AC_OVER_VOLTAGE + + + 2 + INVERTER_AC_UNDER_VOLTAGE + + + 3 + INVERTER_OVER_OR_UNDER_FREQ + + + 4 + BYPASS_AC_OVER_VOLTAGE + + + 5 + BYPASS_AC_UNDER_VOLTAGE + + + 6 + BYPASS_OVER_OR_UNDER_FREQ + + + 7 + INPUT_AC_OVER_VOLTAGE + + + 8 + INPUT_AC_UNDER_VOLTAGE + + + 9 + INPUT_UNDER_OR_OVER_FREQ + + + 10 + OUTPUT_OVER_VOLTAGE + + + 11 + OUTPUT_UNDER_VOLTAGE + + + 12 + OUTPUT_UNDER_OR_OVER_FREQ + + + 13 + REMOTE_EMERGENCY_PWR_OFF + + + 14 + REMOTE_GO_TO_BYPASS + + + 15 + BUILDING_ALARM_6 + + + 16 + BUILDING_ALARM_5 + + + 17 + BUILDING_ALARM_4 + + + 18 + BUILDING_ALARM_3 + + + 19 + BUILDING_ALARM_2 + + + 20 + BUILDING_ALARM_1 + + + 21 + STATIC_SWITCH_OVER_TEMP + + + 22 + CHARGER_OVER_TEMP + + + 23 + CHARGER_LOGIC_PWR_FAIL + + + 24 + CHARGER_OVER_VOLTAGE_OR_CURRENT + + + 25 + INVERTER_OVER_TEMP + + + 26 + OUTPUT_OVERLOAD + + + 27 + RECTIFIER_INPUT_OVER_CURRENT + + + 28 + INVERTER_OUTPUT_OVER_CURRENT + + + 29 + DC_LINK_OVER_VOLTAGE + + + 30 + DC_LINK_UNDER_VOLTAGE + + + 31 + RECTIFIER_FAILED + + + 32 + INVERTER_FAULT + + + 33 + BATTERY_CONNECTOR_FAIL + + + 34 + BYPASS_BREAKER_FAIL + + + 35 + CHARGER_FAIL + + + 36 + RAMP_UP_FAILED + + + 37 + STATIC_SWITCH_FAILED + + + 38 + ANALOG_AD_REF_FAIL + + + 39 + BYPASS_UNCALIBRATED + + + 40 + RECTIFIER_UNCALIBRATED + + + 41 + OUTPUT_UNCALIBRATED + + + 42 + INVERTER_UNCALIBRATED + + + 43 + DC_VOLT_UNCALIBRATED + + + 44 + OUTPUT_CURRENT_UNCALIBRATED + + + 45 + RECTIFIER_CURRENT_UNCALIBRATED + + + 46 + BATTERY_CURRENT_UNCALIBRATED + + + 47 + INVERTER_ON_OFF_STAT_FAIL + + + 48 + BATTERY_CURRENT_LIMIT + + + 49 + INVERTER_STARTUP_FAIL + + + 50 + ANALOG_BOARD_AD_STAT_FAIL + + + 51 + OUTPUT_CURRENT_OVER_100 + + + 52 + BATTERY_GROUND_FAULT + + + 53 + WAITING_FOR_CHARGER_SYNC + + + 54 + NV_RAM_FAIL + + + 55 + ANALOG_BOARD_AD_TIMEOUT + + + 56 + SHUTDOWN_IMMINENT + + + 57 + BATTERY_LOW + + + 58 + UTILITY_FAIL + + + 59 + OUTPUT_SHORT_CIRCUIT + + + 60 + UTILITY_NOT_PRESENT + + + 61 + FULL_TIME_CHARGING + + + 62 + FAST_BYPASS_COMMAND + + + 63 + AD_ERROR + + + 64 + INTERNAL_COM_FAIL + + + 65 + RECTIFIER_SELFTEST_FAIL + + + 66 + RECTIFIER_EEPROM_FAIL + + + 67 + RECTIFIER_EPROM_FAIL + + + 68 + INPUT_LINE_VOLTAGE_LOSS + + + 69 + BATTERY_DC_OVER_VOLTAGE + + + 70 + POWER_SUPPLY_OVER_TEMP + + + 71 + POWER_SUPPLY_FAIL + + + 72 + POWER_SUPPLY_5V_FAIL + + + 73 + POWER_SUPPLY_12V_FAIL + + + 74 + HEATSINK_OVER_TEMP + + + 75 + HEATSINK_TEMP_SENSOR_FAIL + + + 76 + RECTIFIER_CURRENT_OVER_125 + + + 77 + RECTIFIER_FAULT_INTERRUPT_FAIL + + + 78 + RECTIFIER_POWER_CAPASITOR_FAIL + + + 79 + INVERTER_PROGRAM_STACK_ERROR + + + 80 + INVERTER_BOARD_SELFTEST_FAIL + + + 81 + INVERTER_AD_SELFTEST_FAIL + + + 82 + INVERTER_RAM_SELFTEST_FAIL + + + 83 + NV_MEMORY_CHECKSUM_FAIL + + + 84 + PROGRAM_CHECKSUM_FAIL + + + 85 + INVERTER_CPU_SELFTEST_FAIL + + + 86 + NETWORK_NOT_RESPONDING + + + 87 + FRONT_PANEL_SELFTEST_FAIL + + + 88 + NODE_EEPROM_VERIFICATION_ERROR + + + 89 + OUTPUT_AC_OVER_VOLT_TEST_FAIL + + + 90 + OUTPUT_DC_OVER_VOLTAGE + + + 91 + INPUT_PHASE_ROTATION_ERROR + + + 92 + INVERTER_RAMP_UP_TEST_FAILED + + + 93 + INVERTER_OFF_COMMAND + + + 94 + INVERTER_ON_COMMAND + + + 95 + TO_BYPASS_COMMAND + + + 96 + FROM_BYPASS_COMMAND + + + 97 + AUTO_MODE_COMMAND + + + 98 + EMERGENCY_SHUTDOWN_COMMAND + + + 99 + SETUP_SWITCH_OPEN + + + 100 + INVERTER_OVER_VOLT_INT + + + 101 + INVERTER_UNDER_VOLT_INT + + + 102 + ABSOLUTE_DCOV_ACOV + + + 103 + PHASE_A_CURRENT_LIMIT + + + 104 + PHASE_B_CURRENT_LIMIT + + + 105 + PHASE_C_CURRENT_LIMIT + + + 106 + BYPASS_NOT_AVAILABLE + + + 107 + RECTIFIER_BREAKER_OPEN + + + 108 + BATTERY_CONTACTOR_OPEN + + + 109 + INVERTER_CONTACTOR_OPEN + + + 110 + BYPASS_BREAKER_OPEN + + + 111 + INV_BOARD_ACOV_INT_TEST_FAIL + + + 112 + INVERTER_OVER_TEMP_TRIP + + + 113 + INV_BOARD_ACUV_INT_TEST_FAIL + + + 114 + INVERTER_VOLTAGE_FEEDBACK_ERROR + + + 115 + DC_UNDER_VOLTAGE_TIMEOUT + + + 116 + AC_UNDER_VOLTAGE_TIMEOUT + + + 117 + DC_UNDER_VOLTAGE_WHILE_CHARGE + + + 118 + INVERTER_VOLTAGE_BIAS_ERROR + + + 119 + RECTIFIER_PHASE_ROTATION + + + 120 + BYPASS_PHASER_ROTATION + + + 121 + SYSTEM_INTERFACE_BOARD_FAIL + + + 122 + PARALLEL_BOARD_FAIL + + + 123 + LOST_LOAD_SHARING_PHASE_A + + + 124 + LOST_LOAD_SHARING_PHASE_B + + + 125 + LOST_LOAD_SHARING_PHASE_C + + + 126 + DC_OVER_VOLTAGE_TIMEOUT + + + 127 + BATTERY_TOTALLY_DISCHARGED + + + 128 + INVERTER_PHASE_BIAS_ERROR + + + 129 + INVERTER_VOLTAGE_BIAS_ERROR_2 + + + 130 + DC_LINK_BLEED_COMPLETE + + + 131 + LARGE_CHARGER_INPUT_CURRENT + + + 132 + INV_VOLT_TOO_LOW_FOR_RAMP_LEVEL + + + 133 + LOSS_OF_REDUNDANCY + + + 134 + LOSS_OF_SYNC_BUS + + + 135 + RECTIFIER_BREAKER_SHUNT_TRIP + + + 136 + LOSS_OF_CHARGER_SYNC + + + 137 + INVERTER_LOW_LEVEL_TEST_TIMEOUT + + + 138 + OUTPUT_BREAKER_OPEN + + + 139 + CONTROL_POWER_ON + + + 140 + INVERTER_ON + + + 141 + CHARGER_ON + + + 142 + BYPASS_ON + + + 143 + BYPASS_POWER_LOSS + + + 144 + ON_MANUAL_BYPASS + + + 145 + BYPASS_MANUAL_TURN_OFF + + + 146 + INVERTER_BLEEDING_DC_LINK_VOLT + + + 147 + CPU_ISR_ERROR + + + 148 + SYSTEM_ISR_RESTART + + + 149 + PARALLEL_DC + + + 150 + BATTERY_NEEDS_SERVICE + + + 151 + BATTERY_CHARGING + + + 152 + BATTERY_NOT_CHARGED + + + 153 + DISABLED_BATTERY_TIME + + + 154 + SERIES_7000_ENABLE + + + 155 + OTHER_UPS_ON + + + 156 + PARALLEL_INVERTER + + + 157 + UPS_IN_PARALLEL + + + 158 + OUTPUT_BREAKER_REALY_FAIL + + + 159 + CONTROL_POWER_OFF + + + 160 + LEVEL_2_OVERLOAD_PHASE_A + + + 161 + LEVEL_2_OVERLOAD_PHASE_B + + + 162 + LEVEL_2_OVERLOAD_PHASE_C + + + 163 + LEVEL_3_OVERLOAD_PHASE_A + + + 164 + LEVEL_3_OVERLOAD_PHASE_B + + + 165 + LEVEL_3_OVERLOAD_PHASE_C + + + 166 + LEVEL_4_OVERLOAD_PHASE_A + + + 167 + LEVEL_4_OVERLOAD_PHASE_B + + + 168 + LEVEL_4_OVERLOAD_PHASE_C + + + 169 + UPS_ON_BATTERY + + + 170 + UPS_ON_BYPASS + + + 171 + LOAD_DUMPED + + + 172 + LOAD_ON_INVERTER + + + 173 + UPS_ON_COMMAND + + + 174 + UPS_OFF_COMMAND + + + 175 + LOW_BATTERY_SHUTDOWN + + + 176 + AUTO_ON_ENABLED + + + 177 + SOFTWARE_INCOMPABILITY_DETECTED + + + 178 + INVERTER_TEMP_SENSOR_FAILED + + + 179 + DC_START_OCCURED + + + 180 + IN_PARALLEL_OPERATION + + + 181 + SYNCING_TO_BYPASS + + + 182 + RAMPING_UPS_UP + + + 183 + INVERTER_ON_DELAY + + + 184 + CHARGER_ON_DELAY + + + 185 + WAITING_FOR_UTIL_INPUT + + + 186 + CLOSE_BYPASS_BREAKER + + + 187 + TEMPORARY_BYPASS_OPERATION + + + 188 + SYNCING_TO_OUTPUT + + + 189 + BYPASS_FAILURE + + + 190 + AUTO_OFF_COMMAND_EXECUTED + + + 191 + AUTO_ON_COMMAND_EXECUTED + + + 192 + BATTERY_TEST_FAILED + + + 193 + FUSE_FAIL + + + 194 + FAN_FAIL + + + 195 + SITE_WIRING_FAULT + + + 196 + BACKFEED_CONTACTOR_FAIL + + + 197 + ON_BUCK + + + 198 + ON_BOOST + + + 199 + ON_DOUBLE_BOOST + + + 200 + BATTERIES_DISCONNECTED + + + 201 + UPS_CABINET_OVER_TEMP + + + 202 + TRANSFORMER_OVER_TEMP + + + 203 + AMBIENT_UNDER_TEMP + + + 204 + AMBIENT_OVER_TEMP + + + 205 + CABINET_DOOR_OPEN + + + 206 + CABINET_DOOR_OPEN_VOLT_PRESENT + + + 207 + AUTO_SHUTDOWN_PENDING + + + 208 + TAP_SWITCHING_REALY_PENDING + + + 209 + UNABLE_TO_CHARGE_BATTERIES + + + 210 + STARTUP_FAILURE_CHECK_EPO + + + 211 + AUTOMATIC_STARTUP_PENDING + + + 212 + MODEM_FAILED + + + 213 + INCOMING_MODEM_CALL_STARTED + + + 214 + OUTGOING_MODEM_CALL_STARTED + + + 215 + MODEM_CONNECTION_ESTABLISHED + + + 216 + MODEM_CALL_COMPLETED_SUCCESS + + + 217 + MODEM_CALL_COMPLETED_FAIL + + + 218 + INPUT_BREAKER_FAIL + + + 219 + SYSINIT_IN_PROGRESS + + + 220 + AUTOCALIBRATION_FAIL + + + 221 + SELECTIVE_TRIP_OF_MODULE + + + 222 + INVERTER_OUTPUT_FAILURE + + + 223 + ABNORMAL_OUTPUT_VOLT_AT_STARTUP + + + 224 + RECTIFIER_OVER_TEMP + + + 225 + CONFIG_ERROR + + + 226 + REDUNDANCY_LOSS_DUE_TO_OVERLOAD + + + 227 + ON_ALTERNATE_AC_SOURCE + + + 228 + IN_HIGH_EFFICIENCY_MODE + + + 229 + SYSTEM_NOTICE_ACTIVE + + + 230 + SYSTEM_ALARM_ACTIVE + + + 231 + ALTERNATE_POWER_SOURCE_NOT_AVAILABLE + + + 232 + CURRENT_BALANCE_FAILURE + + + 233 + CHECK_AIR_FILTER + + + 234 + SUBSYSTEM_NOTICE_ACTIVE + + + 235 + SUBSYSTEM_ALARM_ACTIVE + + + 236 + CHARGER_ON_COMMAND + + + 237 + CHARGER_OFF_COMMAND + + + 238 + UPS_NORMAL + + + 239 + INVERTER_PHASE_ROTATION + + + 240 + UPS_OFF + + + 241 + EXTERNAL_COMMUNICATION_FAILURE + + + 242 + BATTERY_TEST_INPROGRESS + + + 243 + SYSTEM_TEST_INPROGRESS + + + 244 + BATTERY_TEST_ABORTED + + + + + NUT UPS Status + + + 0 + Неизвестно + + + 1 + OL = Работа от сети + + + 2 + OB = Работа от батарей + + + 3 + LB = Низкий заряд батарей + + + 4 + RB = Замените бабареи + + + 5 + CHRG = Батареи заряжается + + + 6 + DISCHRG = Батареи разряжаются (работа через инвертор) + + + 7 + BYPASS = + + + 8 + CAL = Калибровка времени работы от батарей + + + 9 + OFF = ИБП выключен + + + 10 + OVER = Перегрузка ИБП + + + 11 + TRIM = Режим понижения входного напряжения + + + 12 + BOOST = Режим повышения входного напряжения + + + + + diff --git a/Nut-ups/nut-ups.sh b/Nut-ups/nut-ups.sh new file mode 100755 index 0000000..b65f71d --- /dev/null +++ b/Nut-ups/nut-ups.sh @@ -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 diff --git a/Nut-ups/userparameter_nut.conf b/Nut-ups/userparameter_nut.conf new file mode 100644 index 0000000..4a7e12e --- /dev/null +++ b/Nut-ups/userparameter_nut.conf @@ -0,0 +1 @@ +UserParameter=upsmon[*],/opt/nut-ups.sh $1 $2 diff --git a/ProxmoxVM/Template_ProxmoxVM_agent.xml b/ProxmoxVM/Template_ProxmoxVM_agent.xml new file mode 100644 index 0000000..9888f97 --- /dev/null +++ b/ProxmoxVM/Template_ProxmoxVM_agent.xml @@ -0,0 +1,257 @@ + + + 2.0 + 2015-03-19T07:22:49Z + + + MyTemplates + + + + + + diff --git a/ProxmoxVM/vmscript.sh b/ProxmoxVM/vmscript.sh new file mode 100644 index 0000000..e6fef0b --- /dev/null +++ b/ProxmoxVM/vmscript.sh @@ -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 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/hdd_perf/hdd_discovery.sh b/hdd_perf/hdd_discovery.sh new file mode 100644 index 0000000..968e5d0 --- /dev/null +++ b/hdd_perf/hdd_discovery.sh @@ -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} \ No newline at end of file diff --git a/hdd_perf/hdd_perf.conf b/hdd_perf/hdd_perf.conf new file mode 100644 index 0000000..f7694c8 --- /dev/null +++ b/hdd_perf/hdd_perf.conf @@ -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 \ No newline at end of file diff --git a/hdd_perf/zbx_export_mixTemplate_hdd_perf.xml b/hdd_perf/zbx_export_mixTemplate_hdd_perf.xml new file mode 100644 index 0000000..15bcf74 --- /dev/null +++ b/hdd_perf/zbx_export_mixTemplate_hdd_perf.xml @@ -0,0 +1,281 @@ + + + 2.0 + 2016-04-05T08:25:03Z + + + mix_template + + + + + + diff --git a/megacli_parser/megacli_parse.py b/megacli_parser/megacli_parse.py new file mode 100644 index 0000000..37bce19 --- /dev/null +++ b/megacli_parser/megacli_parse.py @@ -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)) diff --git a/megacli_parser/mix_megacli_parser.xml b/megacli_parser/mix_megacli_parser.xml new file mode 100644 index 0000000..7b85d7a --- /dev/null +++ b/megacli_parser/mix_megacli_parser.xml @@ -0,0 +1,623 @@ + + + 2.0 + 2015-11-18T08:30:50Z + + + mix_template + + + + + + diff --git a/mix_cisco.xml b/mix_cisco.xml new file mode 100644 index 0000000..57bd0df --- /dev/null +++ b/mix_cisco.xml @@ -0,0 +1,2657 @@ + + + 3.0 + 2018-01-21T13:13:12Z + + + Cisco + + + Templates + + + + + + + + + {mix_Cisco_ASA:icmpping.last()}<>1 + Asa ping unavailable + + 0 + 4 + + 0 + + + + {mix_Cisco_2960:cpu_us_1min.last()}>60 + CPU load too high + + 0 + 4 + + 0 + + + + {mix_Cisco_ASA:cpmCPUTotal1min.1.last()}=0 + CPU load too high + + 0 + 4 + + 0 + + + + {mix_Cisco_ASA:cpmCPUTotal1min.1.last()}>60 + CPU load too high + + 0 + 4 + + 0 + + + + {mix_Cisco_2960:stp_changes.delta(3600)}<>0 + STP topology changes + + 0 + 4 + + 0 + + + + + + ASA Connections + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + 009900 + 1 + 2 + 0 + + mix_Cisco_ASA + cfwConnectionStatCount.protoIp.currentInUse + + + + 0 + 0 + 999900 + 1 + 2 + 0 + + mix_Cisco_ASA + cfwConnectionStatValue.protoIp.currentInUse + + + + + + ASA CPU 1min Average + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 1 + FF0000 + 1 + 2 + 0 + + mix_Cisco_ASA + cpmCPUTotal1min.1 + + + + + + ASA Memory + 900 + 200 + 0.0000 + 100.0000 + 0 + 1 + 1 + 1 + 0 + 0.0000 + 0.0000 + 1 + 0 + 0 + 0 + + + 0 + 1 + CC0000 + 0 + 2 + 0 + + mix_Cisco_ASA + ciscoMemoryPoolUsed.1 + + + + 1 + 1 + 009900 + 0 + 2 + 0 + + mix_Cisco_ASA + ciscoMemoryPoolFree.1 + + + + + + ASA VPN Sessions and Tunnels + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + FF0000 + 1 + 2 + 0 + + mix_Cisco_ASA + crasNumSessions.0 + + + + 0 + 1 + FF00FF + 1 + 2 + 0 + + mix_Cisco_ASA + crasNumUsers.0 + + + + 0 + 0 + 009900 + 1 + 2 + 0 + + mix_Cisco_ASA + cikeGlobalActiveTunnels.0 + + + + 0 + 1 + 000099 + 1 + 2 + 0 + + mix_Cisco_ASA + cipSecGlobalActiveTunnels.0 + + + + + + Cisco IKE Throughput + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 1 + 0000FF + 1 + 2 + 0 + + mix_Cisco_ASA + cikeGlobalOutOctets.0 + + + + 0 + 2 + 009900 + 1 + 2 + 0 + + mix_Cisco_ASA + cikeGlobalInOctets.0 + + + + + + Cisco IPSEC Throughput + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 1 + 0000FF + 1 + 2 + 0 + + mix_Cisco_ASA + cipSecGlobalOutOctets.0 + + + + 0 + 2 + 009900 + 1 + 2 + 0 + + mix_Cisco_ASA + cipSecGlobalInOctets.0 + + + + + + diff --git a/proxmox/notes_4_ansible.txt b/proxmox/notes_4_ansible.txt new file mode 100644 index 0000000..d173dca --- /dev/null +++ b/proxmox/notes_4_ansible.txt @@ -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 + +закинуть скриптойды + diff --git a/proxmox/zabbix_agent_minimal.conf b/proxmox/zabbix_agent_minimal.conf new file mode 100644 index 0000000..71ddaca --- /dev/null +++ b/proxmox/zabbix_agent_minimal.conf @@ -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=, diff --git a/sensors_parser/sensors_parse.py b/sensors_parser/sensors_parse.py new file mode 100644 index 0000000..a57f0eb --- /dev/null +++ b/sensors_parser/sensors_parse.py @@ -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) diff --git a/sensors_parser/zbx_export_mixTemplate_sensors.xml b/sensors_parser/zbx_export_mixTemplate_sensors.xml new file mode 100644 index 0000000..51db76f --- /dev/null +++ b/sensors_parser/zbx_export_mixTemplate_sensors.xml @@ -0,0 +1,127 @@ + + + 2.0 + 2015-03-13T07:29:32Z + + + Linux servers + + + + + + diff --git a/simple_checks.xml b/simple_checks.xml new file mode 100644 index 0000000..f787644 --- /dev/null +++ b/simple_checks.xml @@ -0,0 +1,1029 @@ + + + 2.0 + 2015-04-13T19:14:53Z + + + COD + + + SWAN + + + + + + + + {Simple Shecks:net.tcp.service[http,,80].last(0)}=0 + {HOSTNAME} 80 port K-Vrachu not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,81].last(0)}=0 + {HOSTNAME} 81 port Promed not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,83].last(0)}=0 + {HOSTNAME} 83 port ER Perm not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,444].last(0)}=0 + {HOSTNAME} 444 port Promed Cluster not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,2080].last(0)}=0 + {HOSTNAME} 2080 port Promed Apache not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,2083].last(0)}=0 + {HOSTNAME} 2083 port Promed Apache not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,2222].last(0)}=0 + {HOSTNAME} 2222 port Promed Apache not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,4082].last(0)}=0 + {HOSTNAME} 4082 port ERMP Perm not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,4086].last(0)}=0 + {HOSTNAME} 4086 port IAS not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,8080].last(0)}=0 + {HOSTNAME} 8080 port Tomcat not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,8081].last(0)}=0 + {HOSTNAME} 8081 port Tomcat not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,8443].last(0)}=0 + {HOSTNAME} 8443 port Promed Komi not available + + 1 + 3 + + 0 + + + + {Simple Shecks:net.tcp.service[http,,8444].last(0)}=0 + {HOSTNAME} 8444 port ER Komi not available + + 1 + 3 + + 0 + + + + {Simple Shecks:icmpping[,3,128,25,128].last(0)}=0 + {HOSTNAME} ICMP Ping not available through + + 0 + 5 + + 0 + + + + diff --git a/swan/external_ldap_check/ldapsearch_check.sh b/swan/external_ldap_check/ldapsearch_check.sh new file mode 100644 index 0000000..468d8de --- /dev/null +++ b/swan/external_ldap_check/ldapsearch_check.sh @@ -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 diff --git a/swan/external_ldap_check/ldapsearch_time.sh b/swan/external_ldap_check/ldapsearch_time.sh new file mode 100644 index 0000000..705d36d --- /dev/null +++ b/swan/external_ldap_check/ldapsearch_time.sh @@ -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 diff --git a/swan/external_ldap_check/template_external_ldap_check.xml b/swan/external_ldap_check/template_external_ldap_check.xml new file mode 100644 index 0000000..a522454 --- /dev/null +++ b/swan/external_ldap_check/template_external_ldap_check.xml @@ -0,0 +1,159 @@ + + + 3.4 + 2020-09-29T17:25:11Z + + + Templates + + + + + + + + {external_ldap_check:ldapsearch_check.sh[{HOST.CONN},{$LDAP_USER},{$LDAP_PASS}].last()}=0 + 0 + + ldap check failed + 0 + + + 0 + 3 + + 0 + 0 + + + + + {external_ldap_check:ldapsearch_time.sh[{HOST.CONN},{$LDAP_USER},{$LDAP_PASS}].last()}>25 + 0 + + ldap check time too long + 0 + + + 0 + 3 + + 0 + 1 + + + + + diff --git a/zabbix_ufa_sql1.zip b/zabbix_ufa_sql1.zip new file mode 100644 index 0000000..ded0cdf Binary files /dev/null and b/zabbix_ufa_sql1.zip differ