How I monitored RIP-12 from Bolid

Redundant power supplies are used everywhere. They provide uninterrupted power supply to security and fire alarm devices, access control equipment and other systems. At our enterprise, as such sources, as a rule, we use devices from ZAO NVP Bolid. Some of them, such as RIP-12-6 / 80M3-R-RS, have an RS485 interface, which allows them to be included in the monitoring system.





Monitoring tools

We are using Zabbix 5.2. We will receive data from the RIP using the Modbus RTU over TCP protocol. Support for this protocol is implemented in Zabbix using the libzbxmodbus loadable module . Also, the C2000-PP protocol converter (ver. 1.32) in the β€œMaster” mode and a serial interface converter (RS485 to Ethernet) are involved in the monitoring process.





Monitoring objects

First, let's decide what exactly we can control. From the documentation for RIP-12-6 / 80M3-R-RS and S2000-PP, it turned out that we can count on obtaining the state of seven zones (AL) and numerical values ​​of current and voltage. During the experiments, I was able to reproduce the following states of the loop:





Loop # 0 Device status





149





Hacking the device case





RIP building is open





152





Restoration of the device case





RIP building closed





250













β„–1





193













192













199













250













β„–2





194









7,5





195









7,5





250













β„–3 β„–4 β„–1 β„–2





200









10 ,





202









7





211









11





250













β„–5





196













197













250













β„–6





1





220





< 150 > 250





2





220





150…250





250













, . , , β„–3 β„–4 [204] , β„–0 - [203] . , . , .





, . UProg :





  1. ( 2000-),





  2. 2000- (Modbus RTU),





  3. , , 2000-. , , -, , -, .





UProg.  Configuration S2000-PP
UProg. 2000-

:





  • - , 126,





  • - 0 6,





  • - , β„–0 "3 - ", - "8- / ".





Zabbix

, Zabbix libzbxmodbus Modbus-. - C2000-, , .





  • .





  • , .





, RIP 12 mod 56 RIP 12 6 80 M3 R RS. Request " ". : modbus_read[{$MODBUS_PORT},{$MODBUS_SLAVE},{$STATUS_REG},3,7*uint16] . , modbus C2000-.





  • {MODBUS_PORT} - (enc - Modbus RTU over TCP), .





  • {MODBUS_SLAVE} - Modbus UID 2000- ( UProg ).





  • {STATUS_REG} - β„–0 . : " 2000-" + 40000 - 1. : 450+40000-1 = 40449.





Request - 2000- JSON. JSON , 2000-, - :





{
  "40449":39115,
  "40450":51195,
  "40451":50171,
  "40452":51963,
  "40453":51451,
  "40454":50683,
  "40455":763
}
      
      



Request 7 . - JSON . :





  • Status - ( β„–0),





  • Uout - ( β„–1),





  • Iout - ( β„–2),





  • Ubat1 - 1 ( β„–3),





  • Ubat2 - 2 ( β„–4),





  • Capacity - ( β„–5),





  • Uin - ( β„–6).





β„–0 (Status), . JSONPath, 256, .





, JSONPath. javascritpt-. , Iout ( β„–2) javascript- :





function (value){
    var reg = parseInt({$STATUS_REG})+2;
    var data = JSON.parse(value);
    return data[reg];
}
      
      



. :





  1. ,





  2. ,





  3. ,





  4. 1,





  5. 2,





  6. 1 ,





  7. 2 ,





  8. 220 ,





  9. ,





  10. Status,





  11. Iout,





  12. Uout,





  13. 1,





  14. 2,





  15. Capacity,





  16. Uin,





  17. MODBUS.





RIP 12 mod 56 RIP 12 6 80 M3 R RS

RIP 12 mod 56 RIP 12 6 80 M3 R RS in pictures
RIP 12 mod 56 RIP 12 6 80 M3 R RS
An example of creating a host

: RIP 12 mod 56 RIP 12 6 80 M3 R RS, RIP 12 mod 56 RIP 12 6 80 M3 R RS.





. , modbus- 2000-. , - . libzbxmodbus, .. c .





, , - , Zabbix. libzbxmodbus , .





, libzbxmodbus , .





shell

, , flock. Modbus modpoll. /usr/lib/zabbix/externalscripts rip_12_mod_56.sh





#!/bin/bash
# rip_12_mod_56.sh

# $1 - protocol://host:port
# $2 - Modbus UID
# $3 - Status register
# $4 - Offset (0 - 6)

# Example of requesting statuses:       ./rip_12_mod_56.sh enc://127.0.0.1:4001 1 40000
# Example value request:                ./rip_12_mod_56.sh enc://127.0.0.1:4001 1 40000 3

(($# < 3)) && { printf '%s\n' "You have given little data. Command exited with non-zero"; exit 1; }

lockfile=$(echo "$1" | awk -F "://" '{print $2}')

setzone()
{
        modpoll -m $1 -a $4 -r 46181 -0 -1 -c 1 -p $3 $2 $5> /dev/null 2>&1

    (($? != 0)) && { printf '%s\n' "Command exited with non-zero"; exit 1; }

    sleep 0.15
}

getvalue ()
{
        value=$(modpoll -m $1 -a $4 -r 46328 -0 -1 -c 1 -t 4:hex -p $3 $2 |grep ]: |awk '{print $2}')
        printf "%d" $value
}

getstatus ()
{
        status=$(modpoll -m $1 -a $4 -r $5 -1 -c 7 -t 4:hex -p $3 $2 | grep ]: | awk -F "0x" 'BEGIN { printf"["} NR!=7{printf "\""$2"\","} NR==7 {printf "\""$2"\""} END { printf "]"}')
    echo "{ \"status\": $status }"
}

(
        flock -e 200

        protocol=$(echo $1 | awk -F "://" '{print $1}');
        host=$(echo $1 | awk -F "://" '{print $2}' | awk -F ":" '{print $1}')
        port=$(echo $1 | awk -F "://" '{print $2}' | awk -F ":" '{print $2}')
        register=$(($3+1))

        if (($# >= 4)); then
                zone=$(($register+$4-40000))

                setzone $protocol $host $port $2 $zone

                echo $(getvalue $protocol $host $port $2)

                sleep 0.15

                exit 0
        fi

        echo $(getstatus $protocol $host $port $2 $register)

        sleep 0.15;

) 200> /tmp/$lockfile
      
      



Zabbix .





RIP 12 mod 56 RIP 12 6 80 M3 R RS EXTENDED

Request " ". : rip_12_mod_56.sh[{$MODBUS_PORT}, {$MODBUS_SLAVE}, {$STATUS_REG}]. RIP 12 mod 56 RIP 12 6 80 M3 R RS, Request - JSON .





JSON JSONPath. :





{
  "status": ["98CB","C7FB","C3FB","CAFB","C8FB","C5FB","02FB"]
}
      
      



. .

, Request 7 . - JSON .





5 " ".





  • Uout_value - , .





  • Iout_value - , .





  • Ubat1_value - β„–1, .





  • Ubat2_value - β„–2, .





  • Uin_value - , .





: rip_12_mod_56.sh[{$MODBUS_PORT}, {$MODBUS_SLAVE}, {$STATUS_REG}, < >].





, RIP 12 mod 56 RIP 12 6 80 M3 R RS.





RIP 12 mod 56 RIP 12 6 80 M3 R RS EXTENDED

RIP 12 mod 56 RIP 12 6 80 M3 R RS EXTENDED in pictures
RIP 12 mod 56 RIP 12 6 80 M3 R RS EXTENDED
Latest RIP 12 mod 56 RIP 12 6 80 M3 R RS EXTENDED
RIP 12 mod 56 RIP 12 6 80 M3 R RS EXTENDED

: RIP 12 mod 56 RIP 12 6 80 M3 R RS EXTENDED, rip_12_mod_56.sh.





RIP 12 mod 56 RIP 12 6 80 M3 R RS. - - . , . , .





, , . .





!








All Articles