Xymon Mailing List Archive search

python variables in Xymon

4 messages in this thread

list Alvarez Aguilar José Trinidad · Mon, 24 Aug 2015 01:59:56 +0000 ·
Hello, could help me, I find a way to display information generated in python output to the monitoring system big-brother. Example:

if os.environ.has_key ('BB'):
     os.environ command = ['BB'] + "" + os.environ ['BBDISP'] + "\" status "+ os.environ ['MACHINE'] +." interface "+" "+ COLOR +" "+ TIME + pStatus + '"'
     DEBUGMODE if == 1: print command
     os.system (command)
else:
     sys.stderr.write ("ERROR: set BB, BBDISP and MACHINE Variable environment to point to your installation \ n")
     sys.exit (1)

Generates output information but only in the log file defined in the configuration file: clientlaunch.cfg


Thanks for the support.


José Trinidad Álvarez Aguilar
Av. Epigmenio Gonzalez No. 2, Col. Parques Industriales, C:P.76150
Santiago de Querétaro, Qro.
Tel. 101-82-36

[cid:user-2c809a80e026@xymon.invalid3C270]

Infinitum, la mejor conexión.

CONFIDENTIALITY NOTICE:

This e-mail message including attachments, if any, is intended only for the person or entity to which it is addressed and may contain confidential and /or privileged material. Any review, use, disclosure or distribution of such confidential information without the written authorization of Teléfonos de México is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. By receiving this e-mail you acknowledge that any breach by you and/or your representatives of the above provisions may entitle Teléfonos de México to seek for damages.

 
AVISO DE CONFIDENCIALIDAD:

Este correo electrónico, incluyendo en su caso, los archivos adjuntos al mismo, pueden contener información de carácter confidencial y/o privilegiada, y se envían a la atención única y exclusivamente de la persona y/o entidad a quien va dirigido. La copia, revisión, uso, revelación y/o distribución de dicha información confidencial sin la autorización por escrito de Teléfonos de México está prohibida. Si usted no es el destinatario a quien se dirige el presente correo, favor de contactar al remitente respondiendo al presente correo y eliminar el correo original incluyendo sus archivos, así como cualesquiera copia del mismo. Mediante la recepción del presente correo usted reconoce y acepta que en caso de incumplimiento de su parte y/o de sus representantes a los términos antes mencionados, Teléfonos de México tendrá derecho a los daños y perjuicios que esto le cause.
list Jeremy Laidman · Tue, 25 Aug 2015 08:28:52 +1000 ·
On 24 August 2015 at 11:59, Alvarez Aguilar José Trinidad <user-8d67eaf69650@xymon.invalid
quoted from Alvarez Aguilar José Trinidad
wrote:
     os.environ command = ['BB'] + "" + os.environ ['BBDISP'] + "\"
status "+ os.environ ['MACHINE'] +." interface "+" "+ COLOR +" "+ TIME +
pStatus + '"'
This is not the same as in the script you posted.  You have /os.environ
command = ['BB']/ instead of /command = os.environ['BB']/ and you have /+."
interface "/ instead of /+".interface"/.  Could this be why it doesn't work?
quoted from Alvarez Aguilar José Trinidad

Generates output information but only in the log file defined in the
configuration file: clientlaunch.cfg
Can you show the output from the logfile?

Have you tried running the script with "--debug"?

Cheers
Jeremy
list Alvarez Aguilar José Trinidad · Mon, 24 Aug 2015 22:45:58 +0000 ·
That's right, the original script variables iface.py Xymon are these:
-------------------------------------------------- ---------------------------------------------
  os.environ _cmd_line = ['BB'] + "" + os.environ ['BBDISP'] + "\" status "+ os.environ ['MACHINE'] +." interface "+" "+ COLOR +" "+ TIME + pStatus + '"'

but only generates output information to the log file defined in the file: clientlaunch.cfg

[interfaces]
         ENVFILE $ HOBBITCLIENTHOME / etc / hobbitclient.cfg
         CMD $ HOBBITCLIENTHOME / ext / iface.py --debug
         LOGFILE $ HOBBITCLIENTHOME / logs / interfaces.log
         INTERVAL 5m


$ more interfaces.log
Cannot get device settings: Invalid argument
Cannot get wake-on-lan settings: Invalid argument
Cannot get message level: Invalid argument
Cannot get link status: Invalid argument

<H3>&green Interface: sit0</H3>        IP:  None

<H3>&green Interface: eth0</H3>        IP:  10.104.11.131
&green      Link detected: yes
        Configured speed:100
        Duplex: Full
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full

        Highest link mode:1000 Full
&yellow      Higher link mode possible for this interface

<H3>&green Interface: lo</H3>        IP:  127.0.0.1
&green      Link detected: yes


Regards.
quoted from Alvarez Aguilar José Trinidad


José Trinidad Álvarez Aguilar
Av. Epigmenio Gonzalez No. 2, Col. Parques Industriales, C:P.76150
Santiago de Querétaro, Qro.
Tel. 101-82-36

[cid:user-2c809a80e026@xymon.invalid3C270]

De: Jeremy Laidman [mailto:user-71895fb2e44c@xymon.invalid]
Enviado el: Lunes, 24 de Agosto de 2015 05:29 p.m.
Para: Alvarez Aguilar José Trinidad
CC: xymon at xymon.com
Asunto: Re: [Xymon] python variables in Xymon
quoted from Alvarez Aguilar José Trinidad

On 24 August 2015 at 11:59, Alvarez Aguilar José Trinidad <user-8d67eaf69650@xymon.invalid<mailto:user-8d67eaf69650@xymon.invalid>> wrote:

     os.environ command = ['BB'] + "" + os.environ ['BBDISP'] + "\" status "+ os.environ ['MACHINE'] +." interface "+" "+ COLOR +" "+ TIME + pStatus + '"'

This is not the same as in the script you posted.  You have /os.environ command = ['BB']/ instead of /command = os.environ['BB']/ and you have /+." interface "/ instead of /+".interface"/.  Could this be why it doesn't work?

Generates output information but only in the log file defined in the configuration file: clientlaunch.cfg

Can you show the output from the logfile?

Have you tried running the script with "--debug"?

Cheers
Jeremy
Infinitum, la mejor conexión.

CONFIDENTIALITY NOTICE:

This e-mail message including attachments, if any, is intended only for the person or entity to which it is addressed and may contain confidential and /or privileged material. Any review, use, disclosure or distribution of such confidential information without the written authorization of Teléfonos de México is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. By receiving this e-mail you acknowledge that any breach by you and/or your representatives of the above provisions may entitle Teléfonos de México to seek for damages.

 
AVISO DE CONFIDENCIALIDAD:

Este correo electrónico, incluyendo en su caso, los archivos adjuntos al mismo, pueden contener información de carácter confidencial y/o privilegiada, y se envían a la atención única y exclusivamente de la persona y/o entidad a quien va dirigido. La copia, revisión, uso, revelación y/o distribución de dicha información confidencial sin la autorización por escrito de Teléfonos de México está prohibida. Si usted no es el destinatario a quien se dirige el presente correo, favor de contactar al remitente respondiendo al presente correo y eliminar el correo original incluyendo sus archivos, así como cualesquiera copia del mismo. Mediante la recepción del presente correo usted reconoce y acepta que en caso de incumplimiento de su parte y/o de sus representantes a los términos antes mencionados, Teléfonos de México tendrá derecho a los daños y perjuicios que esto le cause.
list Jeremy Laidman · Tue, 25 Aug 2015 11:08:26 +1000 ·
José

I would expect more output in your log.  Are you showing all of the
logfile?  For instance, in debug mode, the script sends the status message
contents to standard output (which goes to the logfile), and then sends the
bb command-line along with (again) the status message contents to standard
output.  So I would expect to see everything twice, but with some extra
information the second time.

What output to do get if you run the script manually using bbcmd or
hobbitcmd to set the environment, such as:

$ /usr/lib/hobbit/client/bin/bbcmd /usr/lib/hobbit/client/ext/iface.py
--debug

This is not relevant to your problem, but I thought I'd mention it.  The
errors about "invalid argument" is because ethtool cannot provide results
for "sit0" so you might want to add that interface to BLACKLIST.

Cheers
Jeremy


On 25 August 2015 at 08:45, Alvarez Aguilar José Trinidad <user-8d67eaf69650@xymon.invalid
quoted from Alvarez Aguilar José Trinidad
wrote:
That's right, the original script variables iface.py Xymon are these:


  os.environ _cmd_line = ['BB'] + "" + os.environ ['BBDISP'] + "\" status
"+ os.environ ['MACHINE'] +." interface "+" "+ COLOR +" "+ TIME + pStatus
+ '"'


but only generates output information to the log file defined in the file:
clientlaunch.cfg


[interfaces]

         ENVFILE $ HOBBITCLIENTHOME / etc / hobbitclient.cfg

         CMD $ HOBBITCLIENTHOME / ext / iface.py --debug

         LOGFILE $ HOBBITCLIENTHOME / logs / interfaces.log

         INTERVAL 5m


$ *more interfaces.log*

Cannot get device settings: Invalid argument

Cannot get wake-on-lan settings: Invalid argument

Cannot get message level: Invalid argument

Cannot get link status: Invalid argument


<H3>&green Interface: sit0</H3>        IP:  None


<H3>&green Interface: eth0</H3>        IP:  10.104.11.131

&green      Link detected: yes

        Configured speed:100

        Duplex: Full

        Supported link modes:   10baseT/Half 10baseT/Full

                                100baseT/Half 100baseT/Full

                                1000baseT/Half 1000baseT/Full


        Highest link mode:1000 Full

&yellow      Higher link mode possible for this interface


<H3>&green Interface: lo</H3>        IP:  127.0.0.1

&green      Link detected: yes


Regards.


*José Trinidad Álvarez Aguilar*

*Av. Epigmenio Gonzalez No. 2, Col. Parques Industriales, C:P.76150*

*Santiago de Querétaro, Qro.*

*Tel. 101-82-36*


[image: cid:user-2c809a80e026@xymon.invalid3C270]
quoted from Alvarez Aguilar José Trinidad


*De:* Jeremy Laidman [mailto:user-71895fb2e44c@xymon.invalid]
*Enviado el:* Lunes, 24 de Agosto de 2015 05:29 p.m.
*Para:* Alvarez Aguilar José Trinidad
*CC:* xymon at xymon.com
*Asunto:* Re: [Xymon] python variables in Xymon


On 24 August 2015 at 11:59, Alvarez Aguilar José Trinidad <
user-8d67eaf69650@xymon.invalid> wrote:


     os.environ command = ['BB'] + "" + os.environ ['BBDISP'] + "\" status
"+ os.environ ['MACHINE'] +." interface "+" "+ COLOR +" "+ TIME + pStatus +
'"'


This is not the same as in the script you posted.  You have /os.environ
command = ['BB']/ instead of /command = os.environ['BB']/ and you have /+."
interface "/ instead of /+".interface"/.  Could this be why it doesn't work?


Generates output information but only in the log file defined in the
configuration file: clientlaunch.cfg


Can you show the output from the logfile?


Have you tried running the script with "--debug"?


Cheers

Jeremy

*Infinitum, la mejor conexión.*


CONFIDENTIALITY NOTICE:

This e-mail message including attachments, if any, is intended only for
the person or entity to which it is addressed and may contain confidential
and /or privileged material. Any review, use, disclosure or distribution of
such confidential information without the written authorization of
Teléfonos de México is prohibited. If you are not the intended recipient,
please contact the sender by reply e-mail and destroy all copies of the
original message. By receiving this e-mail you acknowledge that any breach
by you and/or your representatives of the above provisions may entitle
Teléfonos de México to seek for damages.


AVISO DE CONFIDENCIALIDAD:

Este correo electrónico, incluyendo en su caso, los archivos adjuntos al
mismo, pueden contener información de carácter confidencial y/o
privilegiada, y se envían a la atención única y exclusivamente de la
persona y/o entidad a quien va dirigido. La copia, revisión, uso,
revelación y/o distribución de dicha información confidencial sin la
autorización por escrito de Teléfonos de México está prohibida. Si usted no
es el destinatario a quien se dirige el presente correo, favor de contactar
al remitente respondiendo al presente correo y eliminar el correo original
incluyendo sus archivos, así como cualesquiera copia del mismo. Mediante la
recepción del presente correo usted reconoce y acepta que en caso de
incumplimiento de su parte y/o de sus representantes a los términos antes
mencionados, Teléfonos de México tendrá derecho a los daños y perjuicios
que esto le cause.

17:46:00 08/24/15