This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

SAM Component returning 'Script output values are not defined or improperly defined' but worked in other components

I am trying to run the same script in multiple linux script monitors but with different arguments. However when i use this method some of the scripts return the error "Script output values are not defined or improperly defined." for a few while the first 2 are fine.

The only difference on the script is the argument and i've switched argument around fine. all scripts are returning the same thing yet there for some reason it returns unknown.

The script is as follows (with some obfuscation)

#!/usr/bin/python

import sys,re
from subprocess import Popen,PIPE

service = sys.argv[1]

file = "/etc/init.d/" + service

#Get path and name from /etc/init.d script
searchfile = open(file, "rt")
contents = searchfile.read()
searchfile.close()
filepath = re.search('SOME_STRING=\s*(.*)', contents)
name = re.search('some_NAME=\s*(.*)', contents)
filepath = filepath.group().replace('"', '')[14:]
name = name.group().replace('"', '')[9:]

#Check via ps -ef if the service is running
command = filepath + "/path/to/file -quiet agentup"
status = Popen(["sudo -S " + command],stdout=PIPE, stdin=PIPE, stderr=PIPE, shell=True)
out,err=status.communicate(sudopass + '\n')

if status.returncode == 0: #If service is running do this
        print("Message.Status: service " + service + " IS running")
        print("Statistic.Status: 0")
        print("Message.Path: " + filepath)
        print("Statistic.Path: 0")
        print("Message.Name: " + name)
        print("Statistic.Name: 0")
        exit(0)
else: #If service is not running send to SW
        print("Message.Status: service " + service + " is NOT running")
        print("Statistic.Status: 1")
        print("Message.Path: " + filepath)
        print("Statistic.Path: 1")
        print("Message.Name: " + name)
        print("Statistic.Name: 1")
        exit(1)

The output that shows up is this:

Output: =====================================================

python /path/to./APM_1755529765.pl scriptname

Message.Status: service IS running

Statistic.Status: 0

Message.Path: /some/path/is/here

Statistic.Path: 0

Message.Name: servicename

Statistic.Name: 0

The output that shows down is:

Script output values are not defined or improperly defined.

Output: =====================================================

python /path/to./APM_1755529765.pl scriptname

Message.Status: service IS running

Statistic.Status: 0

Message.Path: /some/path/is/here

Statistic.Path: 0

Message.Name: servicename

Statistic.Name: 0

What can be the reason for the same script to return unkown on the same node but show up on a different component?? Is there a limit on component scripts you can run at a time?

  • This was due to the output not being defined by us not using the 'get output' function in each script when setting it up. It was missed because we used the multi edit function to bulk edit the  script.

    On this note, is there a way to bulk "get output" to get the output values for all component monitors within an application monitor?

    Inkednotdefined_LI.jpg