Skip to content

check_hcan

hcanIngo edited this page Dec 19, 2015 · 1 revision

check_hcan

Um eine komplexere HCAN Installation zu ueberwachen, eignet sich (wie fuer so ziemlich alle Monitoring-Aufgaben) Nagios, http://www.nagios.org.

Zur Zeit sind noch nicht viele Checks implementiert, es werden sich in naechster Zeit weitere hinzukommen (frei nach dem Jeder-Routine-sein-Test Prinzip: nach jedem Problem ein Check).

check_hcan options:
-h [ --help ]              shows the available options
-a [ --ip-address ] arg
-d [ --dst ] arg           dst address
--ping                     pings the target
--usv_betrieb              Prueft, ob Netz- oder Bat-Betrieb
--usv_min_bat_spannung arg

Einige Anwenungsbeispiele:

$ check_hcan -d 400 --ping
OK: Adresse 400 erreichbar
$ check_hcan -d 500 --ping
CRITICAL: Adresse 500 nicht erreichbar
$ check_hcan -d 400 --usv_betrieb
OK: USV auf Netzbetrieb
$ check_hcan -d 400 --usv_min_bat_spannung 24.3
OK: U(bat) = 24.7852 V

Wie kann man nun diese Checks in Nagios einbinden?

define command{
      command_name    check_hcan_ping
      command_line    /usr/bin/check_hcan -d $HOSTADDRESS$ --ping
}

define command{
      command_name    check_hcan
      command_line    /usr/bin/check_hcan -d $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$
}

define hostgroup {
      hostgroup_name  hcan
      alias           HCAN Boards
}

define host{
      name                            generic-hcan-board
      notifications_enabled           1
      event_handler_enabled           1
      flap_detection_enabled          1
      failure_prediction_enabled      1
      process_perf_data               1
      retain_status_information       1
      retain_nonstatus_information    1
      max_check_attempts              10
      notification_interval           0
      notification_period             24x7
      notification_options            d,u,r
      contact_groups                  admins
      register                        0        
      check_command                   check_hcan_ping
}

define host{
      use                     generic-hcan-board
      host_name               usv-400.hcan
      alias                   usv-400.hcan
      address                 400
      hostgroups              hcan
}

define service{
      use                     generic-service
      host_name               usv-400.hcan
      service_description     PING    
      check_command           check_hcan_ping
}

define service{
      use                     generic-service
      host_name               usv-400.hcan
      service_description     STATUS
      check_command           check_hcan!--usv_betrieb
}

define service{
      use                     generic-service
      host_name               usv-400.hcan
      service_description     U_BAT
      check_command           check_hcan!--usv_min_bat_spannung!24.5
}

Fuer jedes Board legt man ein host Objekt und einen Ping-Check an.

Fuer Details sei auf die Dokumantion von Nagios verwiesen: http://nagios.sourceforge.net/docs/3_0/toc.html

weitere Nagios-Moeglichkeiten fuer HCAN

Nagios bringt ein Plugin namens check_procs mit, mit dem man sehr einfach pruefen kann, ob ein Prozess noch laeuft. Damit laesst sich eine typische HCAN Installation auf einem Linux-Server monitoren:

$ check_procs -C hcand -c 1:1
PROCS OK: 1 process with command name 'hcand'
$ check_procs -C hcanaddressd -c 1:1  
PROCS OK: 1 process with command name 'hcanaddressd'
$ check_procs -C hcanhid -c 1:1
PROCS OK: 1 process with command name 'hcanhid'
$ check_procs -C hcanswd -c 1:1
PROCS OK: 1 process with command name 'hcanswd'

Somit erfaehrt man rechtzeitig, dass der hcanswd nicht mehr laeuft - nicht erst, nachdem man nach ein paar Tagen sich ueber die kaputten Temperatur-Graphen wundert...

Clone this wiki locally