Mon Conky! PC

Publié le par Levi59

Capture

Voici mon conky version PC et tout les scripts ^^
Par defaut, configuré pour que les conkyrc ainsi que les scripts rhythmbox.sh et scriptip.sh soit mis dans un dossier ~/.conky/
Il faut également installer lm-sensor et hddtemp et faire la configuration de chacun.

Edit: Mise à jour du conkyrc le 28/09/10

Quelques changements graphiques et la suppression de 2 scripts laissés en annexe sur le blog pour les curieux. (temp et couleurbarre.sh)


conkyrc1

(information utilisation cpu, ram, swap, espace disque libre...)

background        no
update_interval        2.0
double_buffer        yes

use_xft            yes
override_utf8_locale
xftfont            Sans:size=8
xftalpha        0.8

own_window        yes
own_window_transparent    yes
#own_window_type        override
own_window_hints    undecorated,below,sticky,skip_taskbar,skip_pager
#on_bottom        yes

minimum_size        280 150
draw_shades        no
draw_outline        no
draw_borders        no
draw_graph_borders    yes
stippled_borders    0
border_inner_margin        3
border_width        0
text_buffer_size 1524

default_color        white
default_shade_color    black
default_outline_color    black
color0 FFFFFF
color1 e49c16
color2 ffc11f

alignment top_right
gap_x            6
gap_y            48

no_buffers        yes


TEXT

$alignc$nodename - $sysname $kernel on $machine
$alignc${exec lsb_release -c | awk {'print $2'}}
${color1}Uptime:$color $uptime ${color0}
${color1}CPU Utilisé :${color0} $cpu% ${goto 150}${color2}${if_match $cpu > 4}${cpubar}${else}${execbar echo 4}${endif}${offset -130}${color black}${execbar echo 0}
$color${cpugraph ffc11f 8b4b0b}
${color1}Mémoire RAM :
${color0} $mem/$memmax - $memperc% ${color2}${goto 150}${membar}${offset -130}${color black}${execbar echo 0}
${color1}Utilisation du Swap :
${color0} $swap/$swapmax - $swapperc% ${color2}${goto 150}${if_match $swapperc > 4}${swapbar}${else}${execbar echo 4}${endif}${offset -130}${color black}${execbar echo 0}
${color1}Processus : $color $processes   ${color1}En cours : $color $running_processes

$color$stippled_hr

${color1}Espace Disque Libre :
${color red}Mountpoint${goto 120}% Utilisé
${if_match ${exec ls /media | wc -l} >0}${color0}${execpi 10 grep ^\/dev\/ /etc/mtab | grep -v [\,\ ]ro[\,\ ] | awk -F " " {'print $2'} | while read line ; do name=$(echo $line | awk -F "/" {'print $NF'}|sed 's/^$/Root/') ;
echo $name '${goto 140}${fs_used_perc '$line'}%${goto 180}${color2}${if_match ${fs_used_perc '$line'} > 4}${fs_bar '$line'}${else}${execbar echo 4}${endif}${offset -100}${color black}${execbar echo 0}${color}'
done }${else}${alignc}- No device -${endif}
$stippled_hr

conkyrc2

(informations rhytmbox)

background        no
update_interval        1.0
double_buffer        yes

use_xft            yes
override_utf8_locale
xftfont            Sans:size=8
xftalpha        0.8

own_window        yes
own_window_transparent    yes
#own_window_type        override
own_window_hints    undecorated,below,sticky,skip_taskbar,skip_pager
#on_bottom        yes

minimum_size        280 5
draw_shades        no
draw_outline        no
draw_borders        no
draw_graph_borders    yes
stippled_borders    0
border_inner_margin        3
border_width        0

default_color        white
default_shade_color    black
default_outline_color    black

alignment top_middle
gap_x            150
gap_y            48

no_buffers        yes

TEXT

${if_running rhythmbox}
${execpi 1 $HOME/.conky/rhythmbox.sh}${else}${alignc}${color e49c16}----- Rhythmbox non allumé -----${color white}$endif

conkyrc3

(information connectivité et processus en cours)

background        no
update_interval        2.0
double_buffer        yes

minimum_size        280 420
draw_shades        no
draw_outline        no
draw_borders        no
draw_graph_borders    yes
stippled_borders    0
border_inner_margin        3
border_width        0

default_color        white
default_shade_color    black
default_outline_color    black

use_xft            yes
override_utf8_locale
xftfont            Sans:size=8
xftalpha        0.8

own_window        yes
own_window_transparent    yes
#own_window_type        override
own_window_hints    undecorated,below,sticky,skip_taskbar,skip_pager
#on_bottom        yes

alignment bottom_right
gap_x            6
gap_y            48

no_buffers        yes

color1 e49c16
color2 FFFFFF
color3 ffc11f
color4 orange
color5 green
color6 d50004


TEXT
${color2}$stippled_hr

${color1}ToDo List :
${color2}${offset 5}${font Droid sans mono:size=8}${exec cat ~/.conky/ToDo | fold -s -w 65}${font}

${color2}$stippled_hr

${color1}Réseau :
${if_existing /sys/class/net/wlan0/operstate up}$alignc - Wifi -
    ${color2}IP Locale : ${addr wlan0}
    ${color2}IP Publique : ${exec cat /tmp/ip}
${color1}Download :${color} $alignc${offset 20}${downspeed wlan0} ${color} ${goto 145}${color1}Upload:$alignr${color} ${upspeed wlan0}
${color2}${downspeedgraph wlan0 32,135 8b4b0b ffc11f}  ${color2}${upspeedgraph wlan0 32,135 ffc11f 8b4b0b}
${color1}Qualitée du signal: [${font webdings:size=7}${color}${if_match ${wireless_link_qual wlan0} >60}${color5}${else}${if_match ${wireless_link_qual wlan0} >20}${color4}${else}${color6}${endif}${endif}=${color}${if_match ${wireless_link_qual wlan0} >60}${color5}${else}${if_match ${wireless_link_qual wlan0} >20}${color4}${else}${color6}${endif}${endif}=${if_match ${wireless_link_qual wlan0} >60}${color5}${else}${if_match ${wireless_link_qual wlan0} >20}${color4}${else}${color}${endif}${endif}=${if_match ${wireless_link_qual wlan0} >60}${color5}${else}${if_match ${wireless_link_qual wlan0} >20}${color4}${else}${color}${endif}${endif}=${if_match ${wireless_link_qual wlan0} >60}${color5}${else}${if_match ${wireless_link_qual wlan0} >20}${color4}${else}${color}${endif}${endif}=${if_match ${wireless_link_qual wlan0} >60}${color5}${else}${color}${endif}=${if_match ${wireless_link_qual wlan0} >60}${color5}${else}${color}${endif}=${if_match ${wireless_link_qual wlan0} >70}${color5}${else}${color}${endif}=${if_match ${wireless_link_qual wlan0} >80}${color5}${else}${color}${endif}=${if_match ${wireless_link_qual wlan0} >90}${color5}${else}${color}${endif}=${font}${color1}] ${else}${if_existing /proc/net/route eth0}$alignc - Ethernet -
    ${color2}IP Locale : ${addr eth0}
    ${color2}IP Publique : ${exec cat /tmp/ip}
${color1}Download :${color} $alignc${offset 20}${downspeed eth0} ${color} ${goto 145}${color1}Upload:$alignr${color} ${upspeed eth0}
${color2}${downspeedgraph eth0 32,135 8b4b0b ffc11f}  ${color2}${upspeedgraph eth0 32,135 ffc11f 8b4b0b}${else}$alignc${color D50004} - Pas de connexion -${endif}${endif}

${color2}$stippled_hr

${color1}Processus$alignr${color D50004}(%)  PID    CPU    MEM
${color2}${top name 1} $alignr${top pid 1} ${top cpu 1} ${top mem 1}
${color CACACA}${top name 2} $alignr${top pid 2} ${top cpu 2} ${top mem 2}
${color A2A2A2}${top name 3} $alignr${top pid 3} ${top cpu 3} ${top mem 3}
${color 787878}${top name 4} $alignr${top pid 4} ${top cpu 4} ${top mem 4}

conkyrc4

(informations température)

background        no
update_interval        2.0
double_buffer        yes

use_xft            yes
override_utf8_locale
xftfont            Sans:size=8
xftalpha        0.8

own_window        yes
own_window_transparent    yes
#own_window_type        override
own_window_hints    undecorated,below,sticky,skip_taskbar,skip_pager
#on_bottom        yes

minimum_size        280 5
draw_shades        no
draw_outline        no
draw_borders        no
draw_graph_borders    yes
stippled_borders    0
border_inner_margin        3
border_width        0

default_color        white
default_shade_color    black
default_outline_color    black

alignment bottom_middle
gap_x            6
gap_y            48

no_buffers        yes

color1 orange
color2 white
color4 red
color5 green

TEXT
${color}$stippled_hr

${color e49c16}Températures système et ventilateurs: ${color}
     ${color2}CPU : ${color} ${goto 60}${i2c temp 2}°C ${goto 100}${color1}[${font webdings:size=7}${if_match ${i2c temp 2} >0}${color5}${else}${color2}${endif}=${if_match ${i2c temp 2} >20}${color5}${else}${color2}${endif}=${if_match ${i2c temp 2} >25}${color5}${else}${color2}${endif}=${if_match ${i2c temp 2} >30}${color5}${else}${color2}${endif}=${if_match ${i2c temp 2} >35}${color5}${else}${color2}${endif}=${if_match ${i2c temp 2} >40}${color1}${else}${color2}${endif}=${if_match ${i2c temp 2} >45}${color1}${else}${color2}${endif}=${if_match ${i2c temp 2} >50}${color1}${else}${color2}${endif}=${if_match ${i2c temp 2} >55}${color4}${else}${color2}${endif}=${if_match ${i2c temp 2} >60}${color4}${else}${color2}${endif}=${if_match ${i2c temp 2} >65}${color4}${else}${color2}${endif}=${font}${color1}]
     ${color2}M/B : ${color} ${goto 60}${i2c temp 1}°C${goto 100}${color1}[${font webdings:size=7}${if_match ${i2c temp 1} >0}${color5}${else}${color2}${endif}=${if_match ${i2c temp 1} >20}${color5}${else}${color2}${endif}=${if_match ${i2c temp 1} >25}${color5}${else}${color2}${endif}=${if_match ${i2c temp 1} >30}${color5}${else}${color2}${endif}=${if_match ${i2c temp 1} >35}${color5}${else}${color2}${endif}=${if_match ${i2c temp 1} >40}${color1}${else}${color2}${endif}=${if_match ${i2c temp 1} >45}${color1}${else}${color2}${endif}=${if_match ${i2c temp 1} >50}${color1}${else}${color2}${endif}=${if_match ${i2c temp 1} >55}${color4}${else}${color2}${endif}=${if_match ${i2c temp 1} >60}${color4}${else}${color2}${endif}=${if_match ${i2c temp 1} >65}${color4}${else}${color2}${endif}=${font}${color1}]
     ${color2}Sys : ${color} ${goto 60}${i2c temp 3}°C${goto 100}${color1}[${font webdings:size=7}${if_match ${i2c temp 3} >0}${color5}${else}${color2}${endif}=${if_match ${i2c temp 3} >20}${color5}${else}${color2}${endif}=${if_match ${i2c temp 3} >25}${color5}${else}${color2}${endif}=${if_match ${i2c temp 3} >30}${color5}${else}${color2}${endif}=${if_match ${i2c temp 3} >35}${color5}${else}${color2}${endif}=${if_match ${i2c temp 3} >40}${color1}${else}${color2}${endif}=${if_match ${i2c temp 3} >45}${color1}${else}${color2}${endif}=${if_match ${i2c temp 3} >50}${color1}${else}${color2}${endif}=${if_match ${i2c temp 3} >55}${color4}${else}${color2}${endif}=${if_match ${i2c temp 3} >60}${color4}${else}${color2}${endif}=${if_match ${i2c temp 3} >65}${color4}${else}${color2}${endif}=${font}${color1}]
     ${color2}HDa : ${color} ${goto 60}${exec hddtemp -n /dev/sda}°C${goto 100}
     ${color2}HDb : ${color} ${goto 60}${exec hddtemp -n /dev/sdb}°C${goto 100}
     ${color2}Fan1 : ${color2} ${goto 60}${exec expr `cat /sys/devices/platform/smsc47m1.2048/fan1_input`} tours/min
     ${color2}Fan2 : ${color2} ${goto 60}${exec expr `cat /sys/devices/platform/smsc47m1.2048/fan2_input`} tours/min

rhythmbox.sh

(script pour avoir une barre de progression avec rhythmbox -cf conkyrc2- )

#!/bin/bash
# script pour avoir l'avancement de la lecture dans rhythmbox
# affiche un aller-retour si il n'y a pas de durée totale
#
# Copyright (C) 05 Jan. 2010, Rombeaut Rodolphe
# http://scriptam.over-blog.com/
# Released into the public domain.

INFOS=`rhythmbox-client --no-start --print-playing-format "%te|%td|%tt|%at|%ag"`
curr=`echo "${INFOS}" | cut -d"|" -f1 | grep -v "Pas de lecture en cours" | grep -v ^Inconnu$`
tot=`echo "${INFOS}" | cut -d"|" -f2 | grep -v "Pas de lecture en cours" | grep -v ^Inconnu$`
TITRE=`echo "${INFOS}" | cut -d"|" -f3 | grep -v "Pas de lecture en cours" | grep -v ^Inconnu$`
ALBUM=`echo "${INFOS}" | cut -d"|" -f4 | grep -v "Pas de lecture en cours" | grep -v ^Inconnu$`
GENRE=`echo "${INFOS}" | cut -d"|" -f5 | grep -v "Pas de lecture en cours" | grep -v ^Inconnu$`

#--------------------------------------------------
#Si pas de durée totale (radio) on fait faire des aller retour de 0 à 100%
#--------------------------------------------------

[ -z "${tot}" ] && {
    a=`date +'%S'`
    a=${a#0}
    b=$(( (${a}*100) / 30 ))
    c=$(( 200-${b} ))
    [ "${a}" -le 30 ] && AVANC=${b} || AVANC=${c}
} || {

#--------------------------------------------------
#Sinon, traduire valeur courante (hh:mm:ss ou mm:ss) en secondes
#--------------------------------------------------

    [ "${#curr}" -gt 6 ] && {
        currh=${curr%%:*}
        currm=${curr%:*}
        currm=${curr#*:}
    } || {
        currh=0
        currm=${curr%:*}
    }
    [ -z "${currm#0}" ] && currm=0 || currm=${currm#0}
    currs=${curr##*:}
    [ -z "${currs#0}" ] && currs=0 || currs=${currs#0}
    
    currm=$(( ${currm}*60 ))
    currh=$(( ${currh}*3600 ))

    currt=$(( (${currh}+${currm}) + ${currs} ))

#--------------------------------------------------
#Traduire valeur totale (hh:mm:ss ou mm:ss) en secondes
#--------------------------------------------------

    [ "${#tot}" -gt 6 ] && {
        toth=${tot%%:*}
        totm=${tot%:*}
        totm=${tot#*:}
    } || {
        toth=0
        totm=${tot%:*}
    }
    [ -z "${totm#0}" ] && totm=0 || totm=${totm#0}
    tots=${tot##*:}
    tots=${tots#0}
    [ -z "${tots#0}" ] && tots=0

    totm=$(( ${totm}*60 ))
    toth=$(( ${toth}*3600 ))

    tott=$(( (${toth}+${totm}) + ${tots} ))
    
#--------------------------------------------------
# calcul du pourcentage d'avancement
#--------------------------------------------------
   
    AVANC=$(( (${currt}*100) / ${tott} ))
    [ "${AVANC}" -lt 0 -o "${AVANC}" -gt 100 ] && AVANC=0
}

printf '${alignc}${color e49c16}--------- Rhythmbox ---------${color white}\n\n${alignc}'"${TITRE}"' '"${ALBUM}"' '"${GENRE}"'\n${color white}'"${curr}"'${alignr}'"${tot}"'\n${color ffc11f}${execbar echo '"${AVANC}"'}\n'

scriptip.sh

(juste pour récupérer l'ip au démarrage)

#!/bin/bash

# voir ip derriere routeur

cd $HOME/.conky/

wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1 > /tmp/ip

.conky.sh

(fichier de lancement des conkyrc au démarrage)

#!/bin/bash

sleep 20
killall conky
#zenity --info --text="connection établie?" #Si vous desirez avoir une fenetre  vous demandant quand la connection est active.
conky -c $HOME/.conky/conkyrc1 &
conky -c $HOME/.conky/conkyrc2 &
conky -c $HOME/.conky/conkyrc3 &
conky -c $HOME/.conky/conkyrc4 &
sleep 10
$HOME/.conky/scriptip.sh
echo ok
exit 0
done

.lanceurconky.sh

(petit bonus)

#!/bin/bash
# Script interrupteur pour conky : allume si eteind (ou si moins de 4 conkyrc ouverts) et vice versa.

#!/bin/bash
$HOME/.conky/scriptip.sh
    [ $(pgrep -c conky) -lt 4 ] && {
        killall conky
        sleep 1
        conky -c $HOME/.conky/conkyrc1 &
        conky -c $HOME/.conky/conkyrc2 &
        conky -c $HOME/.conky/conkyrc3 &
        conky -c $HOME/.conky/conkyrc4 &
    } || {
        killall conky
        sleep 1
    }
echo ok
exit 0

Publié dans Monitoring

Commenter cet article