
Originally Posted by
bra|10n
Thanks for the link Sector11.
I have another question...
I'm using vnstat and would like to include an ${if_match} ... ${color red} scenario for the total monthly usage.
As I have a small (3GB) usage allowance I would like the total to turn red @ 2.9GB or 2900.00MB.
This is the relevant code,
Code:
${execi 300 vnstat -m | grep "`date +"%b '%y"`" | awk '{print $9 $10}'}
My efforts to date have failed.
Appreciate any help...
I use this:
Code:
${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $9" "$10}'}
but I have configured vnstat NOT to display the 'y just y so you'd have to change it to:
Code:
${execi 300 vnstat -m | grep "`date +"%b '%y"`" | awk '{print $9" "$10}'}
You nee the " " between the %9 and %10
Code:
25 Oct 12 | 22:08:48 ~
$ vnstat -m | grep "`date +"%b %y"`" | awk '{print $9" "$10}'
41.21 GB
25 Oct 12 | 22:10:46 ~
$
I'm no good with 'scripts' that might pars out that "$9" value (41.21) and colorize it at a certain point but maybe Crinos512's colorize.sh script will work with it.
It's worth a try.
Here's my vnstat.conky
Code:
# killall conky && conky -c ~/Conky/S11_VNS.conky &
# with help from dk75
### Begin Window Settings ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes
own_window_type normal #override
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
# own_window_colour ffffff
own_window_class Conky
own_window_title Vnstats
### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes
### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
#own_window_argb_value 150
minimum_size 350 0 ## width, height
maximum_width 350 ## width, usually a good idea to equal minimum width
gap_x 395 ### left &right
gap_y 295 ### up & down
alignment top_left
#################################################### End Window Settings ###
### Font Settings ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont Anonymous Pro:size=9
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes
### WARNING ### These do NOT play well with ~/Conky/LUA/draw-bg.lua
###################################################################
draw_shades no #### <<<--- yes --- To see it easier on light screens.
#default_shade_color black
draw_outline no #### <<<--- yes --- Amplifies text if yes
default_outline_color black
uppercase no
###################################################### End Font Settings ###
### Color Settings #########################################################
default_shade_color gray
default_outline_color black
default_color DCDCDC #220 220 220 Gainsboro
color0 8FBC8F #143 188 143 DarkSeaGreen
color1 778899 #119 136 153 LightSlateGray
color2 FF8C00 #255 140 0 DarkOrange
color3 7FFF00 #127 255 0 Chartreuse
color4 FFA07A #255 160 122 LightSalmon
color5 FFDEAD #255 222 173 NavajoWhite
color6 00BFFF # 0 191 255 DeepSkyBlue
color7 00FFFF # 0 255 255 Cyan
color8 FFFF00 #255 255 0 Yellow
color9 B22222 #178 34 34 FireBrick
##################################################### End Color Settings ###
### Borders Section ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders no
##################################################### End Borders Secton ###
### Miscellaneous Section ##################################################
# yes
background yes
# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer right
# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
# text_buffer_size 256
# Subtract (file system) buffers from used memory?
no_buffers yes
# change GiB to G and MiB to M
short_units yes
# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2
# Maximum size of user text buffer, i.e. layout below TEXT line in config file
# (default is 16384 bytes)
# max_user_text 16384
############################################## End Miscellaneous Section ###
### LUA Settings ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load ~/Conky/LUA/draw-bg.lua
#TEXT
#${lua conky_draw_bg 10 0 0 0 0 0x000000 0.6}
#
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
## OR Both above TEXT (No composite manager required - no blinking!)
#
lua_load ~/Conky/LUA/draw-bg.lua
lua_draw_hook_pre draw_bg 15 0 0 0 0 0x000000 0.5
#
####################################################### End LUA Settings ###
#digiThe all important - How often conky refreshes.5
# If you have a "Crey" try: 0.2 - smokin' - but watch the CPU useage go UP!
update_interval 1 # in seconds
# stuff after 'TEXT' will be formatted on screen
TEXT
${color0}Network${color} ${hr}
${downspeedgraph eth0 24,150 A52A2A 0000FF -t -l}${goto 180}${upspeedgraph eth0 24,150 0000FF A52A2A -t -l}
Down: ${downspeedf eth0}${goto 195}Up: ${upspeedf eth0}
${color0}Transfer Totals${color} ${hr}
${color6}rx${goto 98}tx${goto 182}Total${goto 265}Avg Rate${color}
${color0}Today:${color}
${execpi 300 vnstat | grep "today" | awk '{print $2" "$3"\
${goto 98}"$5" "$6"\
${goto 182}"$8" "$9"\
${goto 265}"$11" "$12}'}
${color0}Yesterday:${color}
${execpi 300 vnstat | grep "yesterday" | awk '{print $2" "$3"\
${goto 98}"$5" "$6 "\
${goto 182}" $8" "$9 "\
${goto 265}" $11" "$12}'}
${color0}Last Week:${color}
${execpi 300 vnstat -w | grep "last week" | awk '{print $3" "$4"\
${goto 98}" $6" "$7 "\
${goto 182}" $9" "$10 "\
${goto 265}" $12" "$13}'}
${color0}Last 7 Days:${color}
${execpi 300 vnstat -w | grep "last 7 days" | awk '{print $4" "$5 "\
${goto 98}" $7" "$8 "\
${goto 182}" $10" "$11 "\
${goto 265}" $13" "$14}'}
${color0}Current Week:${color}
${execpi 300 vnstat -w | grep "current week" | awk '{print $3" "$4 "\
${goto 98}" $6" "$7 "\
${goto 182}" $9" "$10 "\
${goto 265}" $12" "$13}'}
${color0}${time %B %Y}:${color}
${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $3" "$4}'}\
${goto 98}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $6" "$7}'}\
${goto 182}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $9" "$10}'}\
${goto 265}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $12" "$13}'}
${color0}Yearly Transfer Totals${color} ${hr}
${color6}${goto 75}rx${goto 155}tx${goto 235}Total${color}
${execpi 300 vnstat -m | grep "Jan" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4"${goto 155}"$6" "$7"${goto 235}"$9" "$10}'}
${execpi 300 vnstat -m | grep "Feb" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4"${goto 155}"$6" "$7"${goto 235}"$9" "$10}'}
${execpi 300 vnstat -m | grep "Mar" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4"${goto 155}"$6" "$7"${goto 235}"$9" "$10}'}
${execpi 300 vnstat -m | grep "Apr" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4"${goto 155}"$6" "$7"${goto 235}"$9" "$10}'}
${execpi 300 vnstat -m | grep "May" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4"${goto 155}"$6" "$7"${goto 235}"$9" "$10}'}
${execpi 300 vnstat -m | grep "Jun" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4"${goto 155}"$6" "$7"${goto 235}"$9" "$10}'}
${execpi 300 vnstat -m | grep "Jul" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4"${goto 155}"$6" "$7"${goto 235}"$9" "$10}'}
${execpi 300 vnstat -m | grep "Aug" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4"${goto 155}"$6" "$7"${goto 235}"$9" "$10}'}
${execpi 300 vnstat -m | grep "Sep" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4"${goto 155}"$6" "$7"${goto 235}"$9" "$10}'}
${execpi 300 vnstat -m | grep "Oct" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4"${goto 155}"$6" "$7"${goto 235}"$9" "$10}'}
${execpi 300 vnstat -m | grep "Nov" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4" ${goto 155}"$6" "$7" ${goto 235}"$9" "$10}'}
${execpi 300 vnstat -m | grep "Dec" | awk '{print "${color6}"$1" "$2"${color}${goto 75}"$3" "$4"${goto 155}"$6" "$7"${goto 235}"$9" "$10}'}
${color0}${hr}${color}
Bookmarks