SNMP_Check and Event_Command

Hi all,

I’ve a Makito X4 Encoder box which can be monitored and managed via SNMP. The check of an input signal on the four encoder ports works well.

object Host "stream-makitox4" {
  display_name = "stream-makitox4"
  address = "IP Address"
  check_command = "hostalive"

  vars.snmp_oid["Plenarsaal (Port 1)"] = {
    snmp_oid = ".1.3.6.1.4.1.25433.2.1.1.2.7.1.3.0"
  }
  vars.snmp_oid["Raum_1050 (Port 2)"] = {
    snmp_oid = ".1.3.6.1.4.1.25433.2.1.1.2.7.1.3.1"
  }
  vars.snmp_oid["Raum_1070 (Port 3)"] = {
    snmp_oid = ".1.3.6.1.4.1.25433.2.1.1.2.7.1.3.2"
  }
  vars.snmp_oid["Raum_2050 (Port 4)"] = {
    snmp_oid = ".1.3.6.1.4.1.25433.2.1.1.2.7.1.3.3"
  }
  vars.snmp_community = "<Community>"
}

apply Service "Stream: " for (oid => config in host.vars.snmp_oid) {
  import "generic-service"
  check_command = "snmp"
  display_name = "Eingang " + oid
  event_command = "Stop Stream Output"

  max_check_attempts = 3
  check_interval = 10s
  retry_interval = 5s
  check_period = "06-22"

  vars.snmp_ereg = "1"

  vars += config

  assign where match ("stream-makitox4*", host.name)
}

But I’ve two problems:

Once the input signal fails I want to stop the encoder output. This can be done via snmpset (works from the command line). I’ve tried to set up an Event_Command but that got never triggerd.

object EventCommand "Stop Stream Output" {
  import "plugin-event-command"
  command = [ "test $service.state_id$ -eq 2 && test $service.duration_sec$ -gt 20s && /usr/bin/snmpset -v2c -c <Community> <IP Address> HAI-AVT-STREAM-MIB::haiAvtStreamAdminStatus.9 i stop" ]
}

When the input signal is back again then the encoder output should be started again via snmpset. How can I achive that? Again an Event_Command?

There is a non default mapping between encoder ports and encoder output.

HAI-HDC-MIB::haiHdcVideoInState.0 --> HAI-AVT-STREAM-MIB::haiAvtStreamName.9
HAI-HDC-MIB::haiHdcVideoInState.1 --> HAI-AVT-STREAM-MIB::haiAvtStreamName.4
HAI-HDC-MIB::haiHdcVideoInState.2 --> HAI-AVT-STREAM-MIB::haiAvtStreamName.7
HAI-HDC-MIB::haiHdcVideoInState.3 --> HAI-AVT-STREAM-MIB::haiAvtStreamName.1

How can I setup this in a smart way so I don’t have to create an Service for each of the encoder ports?

Best regards
Stephan