Como uso o Conky para monitorar meu backend do mythtv?

0

Eu gostaria de usar o Conky para monitorar um backend do mythtv, como posso configurar isso?

    
por Jorge Castro 03.11.2011 / 00:10

3 respostas

0

A partir da publicação no fórum (editada para conteúdo e gramática):

I recently discovered this as I had a need for something else but I thought it might be nice to check the status of remote and local frontends.

I wrote a script that displays local and remote frontends status in conky and I would like to share it with you. I am just learning about scripting and this is my first attempt at variables i mostly just put stuff in that i could be typed type from shell with no variables or error correction so i learned a bit preparing this.

The instructions on how to use are in the comments of the file and this link should let you know about mythtv telnet and how to enable it.

ThesecondscreenshotshowshowIuseitcombinedwithDemonBobsideaandconkymythtvrecordingstatushowtofoundhere

#!/bin/bash#MadeByKembleWagner#TousethisScriptyouneedtoEnableNetworkRemoteControlInterfaceonMythfrontend#Thankstowagnerrpfrommythtv-usersonfreenodeforhiscontributionsandtips#theoutputfilesaremeanttobeusedwithconky#e.g.conkyrc#${color#8844ee}LocalFrontendStatus:#${color#8844ee}${execi30mythnc.sh>/dev/null&&cat/var/tmp/local.myth}#${color#8844ee}RemoteFrontendStatus:#${color#8844ee}${execi30mythnc.sh>/dev/null&&cat/var/tmp/remote.myth}#Version0.214/04/09#Version0.3"       " fixed sed to make it parse long file names and unusual characters with spaces and no spaces when outputting Video Playback
#Version 0.4 "       " added more events to output in human friendly terms changes it so only one instance of nc is used to prevent hammering of ports
#Version 0.5 17/04/09 add some fixes to playback status and added a check status in the even the frontend not running but the host is up



#change the host names to suit add more if needed
LOCALHOST=box
#path to text file leave as default is ok 
OUTPUTFILE1=/var/tmp/local.myth
OUTPUTFILETMP1=/var/tmp/local.myth.tmp
FETEST1=/var/tmp/local.fetest
FILENAME1='cat $OUTPUTFILETMP1 | grep 'Playback Video' |sed  -e 's/[[ \t]]*/_/g' | sed 's/\(.*\)\..*//' |  sed  's/  *//g' | sed -e 's/^.*\///;s/ .*$//''
RECFILE1='cat $OUTPUTFILETMP1 | grep 'Playback Recorded' |sed  -e 's/[[ \t]]*/_/g' | sed 's/\(.*\)\..*//' |  sed  's/  *//g' | sed -e 's/^.*\///;s/ .*$//''
#remote host variables


#the stuff below is an attempt to convert telnet status info into human friendly readable info

#below are localhost checks

nc -c exit  $LOCALHOST 6546 && echo opened >  $FETEST1|| echo closed > $FETEST1


#Checking if MythFrontend is running 


if (cat $FETEST1 | grep closed ); then
  echo "$LOCALHOST is up but MythFrontend doesn't seem to be running" > $OUTPUTFILE1 

else
echo -e "query location\nexit" | nc $LOCALHOST 6546 > $OUTPUTFILETMP1
fi

#Checking for TV recording Menu
if (cat $OUTPUTFILETMP1 | grep PlaybackBox ); then
  echo "$LOCALHOST is Idle in TV Recordings Menu" > $OUTPUTFILE1

else 

#Checking for Program Guide
if (cat $OUTPUTFILETMP1 | grep GuideGrid ); then
  echo " $LOCALHOST is in TV Guide" > $OUTPUTFILE1
else 

#Checking for MythVideo Gallery
if (cat $OUTPUTFILETMP1 | grep videogallery ); then
  echo "MythVideo Menu On $LOCALHOST is Idle" > $OUTPUTFILE1
else 

#Checking for MythVideo Listings
if (cat $OUTPUTFILETMP1 | grep videolistings); then
  echo "MythVideo Menu On $LOCALHOST is Idle" > $OUTPUTFILE1
else 

#Checking for MythVideo Browser
if (cat $OUTPUTFILETMP1 | grep videobrowser); then
  echo "MythVideo Menu On $LOCALHOST is Idle" > $OUTPUTFILE1
else 
#Checking for MythMusics
if (cat $OUTPUTFILETMP1 | grep playmusic ); then
  echo "Playing Music Cant you Hear?" > $OUTPUTFILE1
else 

#Checking for MainMenu
if (cat $OUTPUTFILETMP1 | grep MainMenu ); then
  echo "$LOCALHOST is in The Main Menu" > $OUTPUTFILE1

else 

#Checking for Live TV
if (cat $OUTPUTFILETMP1 | grep "Playback LiveTV" ); then
  echo "$LOCALHOST is Watching Live TV" > $OUTPUTFILE1
else 

#Checking for MythVideo Playback
if (cat $OUTPUTFILETMP1 | grep "Playback Video" ); then
  echo "MythVideo is playing $FILENAME1" > $OUTPUTFILE1
else 

if (cat $OUTPUTFILETMP1 | grep  "Playback Recorded" ); then
    echo "MythTV is playing recording $RECFILE1" > $OUTPUTFILE1
else





#if none of the above simply display then query status output
if (cat $OUTPUTFILETMP1 | grep "#"); then 
cat   $OUTPUTFILETMP1 | grep "#" > $OUTPUTFILE1 


fi 
  fi 
     fi 
        fi   
           fi
              fi 
                fi
                  fi
                     fi
                        fi
                          fi




#setting remote host variables you can reproduce this for as many hosts as you want
REMOTE=frontend
OUTPUTFILE2=/var/tmp/remote.myth
OUTPUTFILETMP2=/var/tmp/remote.myth.tmp
# script gets slow if the host is not up when continueing to set remote host variables so check its up first
#checking remote frontend is up first
if ! '/bin/ping -W1 -c1 $REMOTE >/dev/null 2>&1' ; then
echo "$REMOTE Seems Offline" > $OUTPUTFILE2 && exit 0
else

#contine setting remote host variables 

FILENAME2='cat $OUTPUTFILETMP2 | grep 'Playback Video' |sed  -e 's/[[ \t]]*/_/g' | sed 's/\(.*\)\..*//' |  sed  's/  *//g' | sed -e 's/^.*\///;s/ .*$//''
RECFILE2='cat $OUTPUTFILETMP2 | grep 'Playback Recorded' | sed -e 's/^.*\///;s/ .*$//' | sed 's/\(.*\)\..*//''
FETEST2=/var/tmp/remote.fetest


#below are remote host checks

nc -c exit $REMOTE 6546 && echo opened >  $FETEST2|| echo closed > $FETEST2

#Checking if MythFrontend is running 

if (cat $FETEST2 | grep closed ); then
  echo "$REMOTE is up but MythFrontend doesn't seem to be running" > $OUTPUTFILE2 

else

echo -e "query location\nexit" | nc $REMOTE 6546 > $OUTPUTFILETMP2
fi


#Checking for TV recording Menu
if (cat $OUTPUTFILETMP2 | grep PlaybackBox ); then
  echo "$REMOTE is Idle in TV Recordings Menu" > $OUTPUTFILE2 
else 

#Checking for Program Guide
if (cat $OUTPUTFILETMP2 | grep GuideGrid ); then
  echo "$REMOTE is in TV Guide" > $OUTPUTFILE2
else 

#Checking for MythVideo Gallery
if (cat $OUTPUTFILETMP2 | grep videogallery ); then
  echo "MythVideo Menu On $REMOTE is Idle" > $OUTPUTFILE2
else 

#Checking for MythVideo Listings
if (cat $OUTPUTFILETMP2 | grep videolistings); then
  echo "MythVideo Menu On $REMOTE is Idle" > $OUTPUTFILE2
else 

#Checking for MythVideo Browser
if (cat $OUTPUTFILETMP2 | grep videobrowser); then
  echo "MythVideo Menu On $REMOTE is Idle" > $OUTPUTFILE2
else 

#Checking for MythMusics
if (cat $OUTPUTFILETMP2 | grep playmusic ); then
  echo "Playing Music Cant you Hear?" > $OUTPUTFILE2
else 

#Checking for MainMenu
if (cat $OUTPUTFILETMP2 | grep MainMenu ); then
  echo "$REMOTE is in The Main Menu" > $OUTPUTFILE2
else 

#Checking for Live TV
if (cat $OUTPUTFILETMP2 | grep "Playback LiveTV" ); then
  echo "$REMOTE is Watching Live TV" > $OUTPUTFILE2
else 

#Checking for MythVideo Playback
if (cat $OUTPUTFILETMP2 | grep "Playback Video" ); then
  echo "MythVideo On $REMOTE is playing $FILENAME2" > $OUTPUTFILE2
else 

if (cat $OUTPUTFILETMP2 | grep  "Playback Recorded" ); then
    echo "MythTV On $REMOTE is playing recording $RECFILE2" > $OUTPUTFILE2
else



#if none of the above simply display then query status output
if (cat $OUTPUTFILETMP2 | grep "#"); then 
cat   $OUTPUTFILETMP2 | grep "#" > $OUTPUTFILE2 



fi 
  fi 
     fi 
        fi   
           fi
              fi 
                fi 
                   fi
                      fi
                        fi
                          fi
                            fi 
                               fi

I think it is pretty subtle considering how much I had to write in order to enable a few lines in conky. Anyway, this was fun for me i hope people try it and let me know how it goes post back if you need any help i would be glad to help if you have any problems setting it up.

Referências

por Jorge Castro 03.11.2011 / 00:43
1

Apenas um comentário rápido sobre a opção mythtv-status, você pode definir a opção de host em /etc/default/mythtv-status , caso em que será lembrado se o status de mythtv for atualizado ou reinstalado.

Você também pode definir outras opções, como ativar a saída de cores e adicionar outras informações à saída.

    
por Andrew Ruthven 17.01.2012 / 22:41
0

This is a How-To on using conky on any ubuntu box to view recording info on your backend. This is accomplised by install mythtv-status on the ubuntu box that uses conky. I've modified mythtv-status a little bit.

  1. Copie seu /home/username/.mythtv/config.xml de sua caixa do mythbuntu para o desktop ubuntu local /home/username/.mythtv/config.xml

  2. Edite o arquivo config.xml para refletir o endereço IP do seu back-end

    gedit ~/.mythtv/config.xml
    

    Edite esta linha. Altere o localhost para o endereço IP do seu back-end. No meu caso

    <DBHostName>localhost</DBHostName>
    

    Alterado para:

    <DBHostName>192.168.15.3</DBHostName>
    
  3. Vincule o config.xml a /root/.mythtv/config.xml

    sudo mkdir /root/.mythtv
    sudo ln -s ~/.mythtv/config.xml /root/.mythtv/config.xml
    

    Isso é para corrigir o aviso perl api no status mythtv.

  4. Instale o status do mythtv

    sudo apt-get update sudo apt-get instala o status do mythtv

  5. Edite o status mythtv para refletir minhas alterações.

    sudo gedit /usr/bin/mythtv-status
    

    Na linha 21. Altere o localhost para o endereço IP do backend

    my $host = "localhost";
    

    Na minha instância, muda para.

    my $host = "192.168.15.3";
    
  6. Edite o arquivo .conkyrc para adicionar saída.

    gedit ~.conkyrc
    

    Perto do topo, adicione:

    text_buffer_size 1024
    

    Na parte inferior, adicione

    ${color #0077ff} ${execi 300 perl /usr/bin/mythtv-status KISP}
    

Mude as cores para corresponder à sua configuração atual .conkyrc.

Execute o conky para testar.

Referências

por Jorge Castro 03.11.2011 / 00:53

Tags