Applications Systems

Python Examples for Unix or Linux monitor on Linux

This article includes an example of a Python script that returns constants and an example of a Python script that will print the value of a variable. These are running on SAM 6.6.1.

First published date

11/14/2018 5:42 PM

Last published date

4/19/2022 7:54 AM

Overview

Here are sample Python scripts. These are running on SAM 6.6.1.

Product section

Server Application Monitor

Resolution

1.  Here is an example of a Python script that returns constants:

 

print ("Statistic.Stat1: 1");

print ("Message.Stat1: Hello World");

 

=======================================

Output Result:

Statistic.Stat1:   1

Message.Stat1:  Hello World

 

2.  Here is an example of a Python script that will print the value of a variable (the variable, value, is an integer):

 

#!/usr/bin/python

 

import sys

value = 20

 

print "Statistic.Stat1:  %d" % value

print "Message.Stat1: hello World"

sys.exit(0)

 

========================================  

Output Result:

Statistic.Stat1:    20

Message.Stat1:  hello World