add LPT pin number to host structure

This commit is contained in:
Sergey Popov 2011-12-19 15:19:18 +04:00
parent 240aa35786
commit 323eb556c8
2 changed files with 5 additions and 1 deletions

View File

@ -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;

View File

@ -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