MMazaOIT
Contributor
Contributor

How to write script for service?

I have written a servic plugin as follows:

<plugin>
  <service name="AM_Service_test">
    <config>
      <option name="script"
            description="Test script"
            default="/home/hyperic/agent/bundles/agent-4.5.1/pdk/scripts/test.sh"/>
    </config>
    <filter name="template"
            value="exec:exec=sudo,file=%script%"/>
    <metric name="Availability"
            template="${template}:Availability"
            indicator="true"/>
    <metric name="Metric1"
            category="PERFORMANCE"
            template="${template}:x"
            indicator="true"/>
  </service>
</plugin>

I want just to test any value.

How the Shell Script has to look like?

How it can be written for Windows as Batch File?

Thanks for help.

0 Kudos
3 Replies
MMazaOIT
Contributor
Contributor

Just found out how it works on Windows with Batch script:

e.g. script countains:

echo x=2

Then the hyperic will show for Metric1 allways a 2.

Now I need to find out how it works with a shell script under Linux.

0 Kudos
hqpso
Enthusiast
Enthusiast

It works the same on All OSes in all scripting languages.

The key=value being 'echo-ed' must match the metric being requested.

0 Kudos
staceyeschneide
Hot Shot
Hot Shot

Thanks for posting your conclusion!

0 Kudos