diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-09-06 19:09:52 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-09-06 19:09:52 +0000 |
| commit | 32aa4e7f66fdc3d7f4a9fec2e5efdc3cb7417bc1 (patch) | |
| tree | 7ca499cf3d8dad9cae3a7dcf84305f5b9363a577 | |
| parent | 61e6766bf1dd3a14331b5390001ad252ec933a7c (diff) | |
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@2046 97f52cf1-0a1b-0410-bd0e-c28be96e8082
| -rw-r--r-- | frontends/php/triggers.php | 10 | ||||
| -rw-r--r-- | include/db.h | 2 | ||||
| -rw-r--r-- | src/libs/zbxdbhigh/db.c | 8 | ||||
| -rw-r--r-- | src/zabbix_server/functions.c | 5 |
4 files changed, 17 insertions, 8 deletions
diff --git a/frontends/php/triggers.php b/frontends/php/triggers.php index d0666e7e..0045ef19 100644 --- a/frontends/php/triggers.php +++ b/frontends/php/triggers.php @@ -220,11 +220,11 @@ if(isset($_GET["hostid"])&&!isset($_GET["triggerid"])) { table_begin(); - table_header(array(S_ID,S_DESCRIPTION,S_EXPRESSION, S_SEVERITY, S_STATUS, S_ACTIONS)); + table_header(array(S_ID,S_DESCRIPTION,S_EXPRESSION, S_SEVERITY, S_STATUS, S_ERROR, S_ACTIONS)); echo "<form method=\"get\" action=\"triggers.php\">"; echo "<input class=\"biginput\" name=\"hostid\" type=hidden value=".$_GET["hostid"]." size=8>"; - $result=DBselect("select distinct h.hostid,h.host,t.triggerid,t.expression,t.description,t.status,t.value,t.priority from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and h.hostid=".$_GET["hostid"]." order by h.host,t.description"); + $result=DBselect("select distinct h.hostid,h.host,t.triggerid,t.expression,t.description,t.status,t.value,t.priority,t.error from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and h.hostid=".$_GET["hostid"]." order by h.host,t.description"); $col=0; while($row=DBfetch($result)) { @@ -271,6 +271,11 @@ } // $expression=rawurlencode($row["expression"]); + if($row["error"]=="") + { + $row["error"]=" "; + } + if(isset($_GET["hostid"])) { $actions="<A HREF=\"triggers.php?triggerid=".$row["triggerid"]."&hostid=".$row["hostid"]."#form\">".S_CHANGE."</A>"; @@ -294,6 +299,7 @@ explode_exp($row["expression"],1), $priority, $status, + $row["error"], $actions ),$col++); } diff --git a/include/db.h b/include/db.h index 488ce9bc..17a1f572 100644 --- a/include/db.h +++ b/include/db.h @@ -263,7 +263,7 @@ int DBadd_alert(int actionid, int mediatypeid, char *sendto, char *subject, char void DBupdate_triggers_status_after_restart(void); int DBget_prev_trigger_value(int triggerid); /*int DBupdate_trigger_value(int triggerid,int value,int clock);*/ -int DBupdate_trigger_value(DB_TRIGGER *trigger, int new_value, int now); +int DBupdate_trigger_value(DB_TRIGGER *trigger, int new_value, int now, char *reason); int DBget_default_escalation_id(); int DBget_items_count(void); diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c index 2cd262f6..19c19c21 100644 --- a/src/libs/zbxdbhigh/db.c +++ b/src/libs/zbxdbhigh/db.c @@ -626,7 +626,7 @@ int DBupdate_trigger_value(int triggerid,int value,int clock) } */ -void update_triggers_status_to_unknown(int hostid,int clock) +void update_triggers_status_to_unknown(int hostid,int clock,char *reason) { int i; char sql[MAX_STRING_LEN]; @@ -645,7 +645,7 @@ void update_triggers_status_to_unknown(int hostid,int clock) { trigger.triggerid=atoi(DBget_field(result,i,0)); trigger.value=atoi(DBget_field(result,i,1)); - DBupdate_trigger_value(&trigger,TRIGGER_VALUE_UNKNOWN,clock); + DBupdate_trigger_value(&trigger,TRIGGER_VALUE_UNKNOWN,clock,reason); } DBfree_result(result); @@ -822,7 +822,7 @@ void DBupdate_triggers_status_after_restart(void) lastchange=atoi(DBget_field(result2,0,0)); DBfree_result(result2); - DBupdate_trigger_value(&trigger,TRIGGER_VALUE_UNKNOWN,lastchange); + DBupdate_trigger_value(&trigger,TRIGGER_VALUE_UNKNOWN,lastchange,"ZABBIX was down."); } DBfree_result(result); @@ -898,7 +898,7 @@ void DBupdate_host_availability(int hostid,int available,int clock, char *error) return; } - update_triggers_status_to_unknown(hostid,clock); + update_triggers_status_to_unknown(hostid,clock,"Host is unavailable."); zabbix_log(LOG_LEVEL_DEBUG,"End of update_host_availability()"); return; diff --git a/src/zabbix_server/functions.c b/src/zabbix_server/functions.c index da71a1d5..807d777a 100644 --- a/src/zabbix_server/functions.c +++ b/src/zabbix_server/functions.c @@ -363,13 +363,16 @@ void update_triggers(int itemid) { zabbix_log( LOG_LEVEL_WARNING, "Expression [%s] cannot be evaluated [%s]",trigger.expression, error); zabbix_syslog("Expression [%s] cannot be evaluated [%s]",trigger.expression, error); + + now = time(NULL); + DBupdate_trigger_value(&trigger, exp_value, now, error); continue; } zabbix_log( LOG_LEVEL_DEBUG, "exp_value trigger.value trigger.prevvalue [%d] [%d] [%d]", exp_value, trigger.value, trigger.prevvalue); now = time(NULL); - DBupdate_trigger_value(&trigger, exp_value, now); + DBupdate_trigger_value(&trigger, exp_value, now, NULL); } DBfree_result(result); } |
