add LPT pin number to host structure
This commit is contained in:
parent
240aa35786
commit
323eb556c8
5
yasnd.c
5
yasnd.c
@ -154,6 +154,7 @@ void init()
|
||||
{
|
||||
cfg_t* host = cfg_getnsec(cfg, "host", i);
|
||||
hosts[i].hostname=cfg_getstr(host,"hostname");
|
||||
hosts[i].lpt_pin=cfg_getint(host,"lpt_pin");
|
||||
hosts[i].fail_count=0;
|
||||
hosts[i].alert_sent=false;
|
||||
}
|
||||
@ -195,7 +196,9 @@ void check_host(int num,host_decl* host)
|
||||
*/
|
||||
void reset_pin(int pin_num)
|
||||
{
|
||||
if (pin_num<1 || pin_num>8)
|
||||
if (pin_num==0)
|
||||
return; // there is no LPT control for target host
|
||||
if (pin_num<0 || pin_num>8)
|
||||
{
|
||||
log_event("Error: incorrent LPT pin number");
|
||||
return;
|
||||
|
1
yasnd.h
1
yasnd.h
@ -18,6 +18,7 @@
|
||||
// Structure, that described single checked host
|
||||
typedef struct {
|
||||
char* hostname; // address of host
|
||||
int lpt_pin; // pin on LPT control circuit for reset
|
||||
pid_t helper_pid; // pid of helper('pinger') child process
|
||||
int fail_count; // how many times in a row host was unreachable
|
||||
bool alert_sent; // variable, that changed when host goes online/offline
|
||||
|
Loading…
Reference in New Issue
Block a user