Conky (4) : monitoring léger, nouvelle config

J’ai récemment remanié mon Conky, je vous mets juste son code du coup. Pour les autres articles c’est par ici :

 

conky

 

Code

#==============================================================================
#                               conky_Aerya
# Date    : 9/08/2016
# Author  : Aerya
# Version : v0.7
# License : Distributed under the terms of GNU GPL version 2 or later
#
# https://upandclear.org/search/#search/text=conky
#
#==============================================================================

background yes

cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius
own_window_argb_visual no

double_buffer yes
no_buffers yes
text_buffer_size 2048
override_utf8_locale yes
use_xft yes
xftfont open sans:size=9
xftalpha 1
uppercase no
update_interval 1.0

gap_x 1950
gap_y 30
minimum_size 300
maximum_width 300

own_window yes
own_window_type transparent
own_window_transparent yes
own_window_argb_visual yes
own_window_argb_visual yes
own_window_colour 000000
own_window_argb_value 230
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
override_utf8_locale yes

border_inner_margin 0
border_outer_margin 0
alignment top_left

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# Couleurs
default_color FFFFFF
color1 Green #vert
color2 Red #rouge


TEXT

${color}${alignc}${execi 3600 date +"%A %d %B %Y - Semaine %V"}${image ~/Documents/CloudStation/Conky/archlinux_small.png -p 260,30 -s 25x25}
${font size=9}${alignc}${color #6495ed}${time %k:%M:%S}

${font size=10}${color}Système${color #6495ed}${hr 2}
${offset 7}${font}${color #6495ed}Kernel${alignr}${color}$kernel (${machine})  
${offset 7}${font}${color #6495ed}Uptime${alignr}${color}$uptime  
${offset 7}${font}${color #6495ed}Charge${alignr}${color}$loadavg  

${font size=10}${color}Processeur & Mémoire ${color #6495ed}${hr 2}
${offset 7}${font}${color #6495ed}${exec cat /proc/cpuinfo | grep 'model name' | cut -c 14-42 | uniq}${alignr}${color}${hwmon 0 temp 1}°C  
${offset 30}${color}${cpu}%${offset 80}${color}${freq_g}GHz${alignr}${color #6495ed}${cpubar 6,100}  
${offset 30}${color}Processus             ${alignr}PID      ${alignr}CPU      ${alignr}RAM    
${offset 30}${font}${color #e09495}${top name 1}${alignr}${top pid 1}    ${alignr}${top cpu 1}    ${alignr}${top mem 1}%  
${offset 30}${font}${color #e0d094}${top name 2}${alignr}${top pid 2}    ${alignr}${top cpu 2}    ${alignr}${top mem 2}%  
${offset 30}${font}${color #006633}${top name 3}${alignr}${top pid 3}    ${alignr}${top cpu 3}    ${alignr}${top mem 3}%  
${offset 30}${font}${color grey}${top name 4}${alignr}${top pid 4}    ${alignr}${top cpu 4}    ${alignr}${top mem 4}%  
${offset 7}${font}${color #6495ed}RAM${goto 80}${color}$mem${color #6495ed}/$memmax${alignr}${membar 6,100}  
${offset 7}${font}${color #6495ed}SWAP${goto 80}${color}$swap${color #6495ed}/$swapmax${alignr}${swapbar 6,100}  
${offset 30}${color}Processus             ${alignr}PID      ${alignr}CPU      ${alignr}RAM    
${offset 30}${font}${color #e09495}${top_mem name 1}${alignr}${top_mem pid 1}    ${alignr}${top_mem cpu 1}    ${alignr}${top_mem mem 1}%  
${offset 30}${font}${color #e0d094}${top_mem name 2}${alignr}${top_mem pid 2}    ${alignr}${top_mem cpu 2}    ${alignr}${top_mem mem 2}%  
${offset 30}${font}${color #006633}${top_mem name 3}${alignr}${top_mem pid 3}    ${alignr}${top_mem cpu 3}    ${alignr}${top_mem mem 3}%  
${offset 30}${font}${color grey}${top_mem name 4}${alignr}${top_mem pid 4}    ${alignr}${top_mem cpu 4}    ${alignr}${top_mem mem 4}%  

${font size=10}${color}Stockage ${color #6495ed}${hr 2}
${offset 7}${font}${color #6495ed}Home${alignr}${color}${fs_used_perc /home}%  -  ${fs_used /home}${color #6495ed}/${fs_size /home}  ${color #6495ed}${fs_bar 6,100 /home}  
${offset 7}${font}${color #6495ed}Cloud${alignr}${if_mounted /mnt/FON}${color}${fs_used_perc /mnt/FON}%  -  ${fs_used /mnt/FON}${color #6495ed}/${fs_size /mnt/FON}  ${color #6495ed}${fs_bar 6,100 /mnt/FON}${else}${color} - ${color FF0000} ∆ ${endif}${color}  
${offset 7}${font}${color #6495ed}Kodi${alignr}${if_mounted /mnt/Films}${color}${fs_used_perc /mnt/Films}%  -  ${fs_used /mnt/Films}${color #6495ed}/${fs_size /mnt/Films}  ${color #6495ed}${fs_bar 6,100 /mnt/Films}${else}${color} - ${color FF0000} ∆ ${endif}${color}  

${font size=10}${color}Réseau ${color #6495ed}${hr 2}
${offset 7}${font}${color #6495ed}LAN${goto 80}${if_up enp8s0}${color}${addr enp8s0}${color 77B753}${else}${color}${color FF0000} ∆ ${endif}${color}${goto 160}${font}${color #6495ed}WAN${goto 230}${if_existing /proc/net/route wlp14s0}${color}${addr wlp14s0}${color 77B753}${else}${color}${color FF0000} ∆ ${endif}${color}  
${offset 7}${font}${color #6495ed}DL${goto 40}$color${downspeed enp8s0}/s - ${totaldown enp8s0}${goto 180}${if_existing /proc/net/route wlp14s0}$color${downspeed wlp14s0}/s - ${totaldown # wlp14s0}  
${goto 40}${color #6495ed}${downspeedgraph enp8s0 10,100 6495ed ff5c2b}${goto 180}${downspeedgraph wlp14s0 10,100 6495ed ff5c2b}  
${offset 7}${font}${color #6495ed}UP${goto 40}$color${upspeed enp8s0}/s - ${totalup enp8s0}${goto 180}${if_existing /proc/net/route wlp14s0}$color${upspeed wlp14s0}/s - ${totalup # wlp14s0}  
${goto 40}${color #6495ed}${upspeedgraph enp8s0 10,100 6495ed 77b753}${goto 180}${upspeedgraph wlp14s0 10,100 6495ed ff5c2b}  
${offset 7}${font}${color #6495ed}SSID${offset 30}${if_existing /proc/net/route wlp14s0}${color}${wireless_essid wlp14s0}${else}${color}  ${color FF0000}  ${endif}${color}   -   ${font}${color #6495ed}Force${offset 10}${if_existing /proc/net/route wlp14s0}${color}${wireless_bitrate wlp14s0}${alignr}${color #6495ed}${wireless_link_bar 6,50 wlp14s0}${else}${color}  ${color FF0000}  ${endif}${color}  

${offset 7}${font}${color #6495ed}Tor${goto 80}${if_running tor}${color0}${execi 600 proxychains curl icanhazip.com}${color}${color 77B753}${else}${color} - ${color FF0000} ∆ ${endif}${color}${goto 180}${font}${color #6495ed}Docker${goto 240}${if_running docker}${color0}${addr docker0}${color}${color 77B753}${else}${color} - ${color FF0000} ∆ ${endif}  
${offset 7}${font}${color #6495ed}Publique${goto 80}${if_up tun0}${color 77B753}${execi 600 curl icanhazip.com}${color 77B753}${else}${color} - ${color FF0000} ∆ ${endif}${color}${goto 180}${font}${color #6495ed}VPN${goto 240}${if_up tun0}${color0}${addr tun0}${color 77B753}${else}${color} - ${color FF0000} ∆ ${endif}  

${font size=10}${color}Serveurs ${color #6495ed}${hr 2}  
${offset 7}${font}${color #6495ed}TV${goto 120}${if_match "${execi 600 /home/ayx/Documents/CloudStation/Conky/ping.sh 192.168.1.2}" != "0"}${color 77B753}Up${else}${color FF0000} ∆ ${endif}${goto 160}${color #6495ed}NOM${goto 270}${if_match "${execi 600 /home/ayx/Documents/CloudStation/Conky/ping.sh IP}" != "0"}${color 77B753}Up${else}${color FF0000} ∆ ${endif}  

Par rapport au screen j’ai supprimé le code des serveurs, sauf la 1ère ligne.

 

Quelques tips pour l’adapter à votre configuration

Image ArchLinux, ligne 61

Mon interface réseau LAN est enp8s0, lignes 91 etc

Mon interface réseau WAN est wlp14s0, lignes 96 etc

Pour afficher l’IP Tor, il faut faire un curl via Tor, perso j’utilise proxychains, ligne 98

Mon interface VPN est tun0, ligne 99

Notez d’ailleurs que l’IP publique est en vert si VPN activé, sinon en rouge, lignes 99 etc

Pour ajouter des lignes “Serveurs”, il suffit de copier la 1ère et de changer les NOM/IP

Script ping.sh utilisé dans la partie Serveurs, pour avoir un retour de mes machines (et vous devez avoir installé curl)

#!/bin/bash

if sudo ping -c 1 -W 2 $1 > /dev/null; 
then 
	echo "1"
else 
	echo "0"
fi

C’est une config tournant sur ArchLinux, peut-être à adapter un peu pour Debian, *buntu.

 

(290 vues)

Poster un Commentaire

  S’abonner  
Notifier de