Advertisement
kazoda

Zabbix history max value

Jul 27th, 2014
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.46 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. start_daytime=$(date --date "$1 00:00:00" +%s)
  4. end_daytime=$(date --date "$2 00:00:00" +%s)
  5. itemid=${3:-23347}
  6. itemid="'"$itemid"'"
  7.  
  8. sql_string="select * from history where value = \
  9.        ( select max(value) from history where itemid=$itemid and \
  10.        clock >= $start_daytime and clock <= $end_daytime) \
  11.        and itemid=$itemid and clock >= $start_daytime and clock <= $end_daytime"
  12.  
  13. mysql -B -s -u root -p zabbix -e "$sql_string"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement