Ad Widget

Collapse

Help with macros for actions.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • linuxdan
    Junior Member
    • Sep 2008
    • 18

    #1

    Help with macros for actions.

    First things first. I'm running zabbix 1.6.1 on RHEL 4. I've got a trigger setup to go off when more than X processes are running. I also have an action that e-mails me when the that trigger goes off.

    I want to be emailed the output of 'ps fax' as well so that I know which piece of software is spawning so many processes. The message I'm sending is as follows:

    Too many processes on {HOSTNAME}.
    Processes:
    {{HOSTNAME}:system.run["ps fax"]}
    and the message I receive is:

    Too many processes on example.com.
    Processes:
    {example.com:system.run["ps fax"]}
    So my question is, What am I doing wrong and how can I get the results I'm looking for?

    Thanks

    Dan
  • geno
    Junior Member
    • Nov 2008
    • 29

    #2
    I've never used system.run so I cannot comment on that, but you might want to try UserParameter (just search for that in the manual...?

    Comment

    • linuxdan
      Junior Member
      • Sep 2008
      • 18

      #3
      User Parameters are problematic too.

      I'm also having issues with user parameters but out of curiosity if I did manage to get user parameters working how would I include them in a "action" email?

      Comment

      • geno
        Junior Member
        • Nov 2008
        • 29

        #4
        Yes
        You would create something like this (I might have it slighty wrong, doing this off top of my head):

        agentd.conf:
        UserParameter=ps.fax,ps fax

        Your item would call ps.fax and the result would probably be text.

        In your action's default message you would use the macro {ITEM.LASTVALUE} (if i recall correct, something along those lines)...

        Comment

        • geno
          Junior Member
          • Nov 2008
          • 29

          #5
          did that help?

          Comment

          • linuxdan
            Junior Member
            • Sep 2008
            • 18

            #6
            No such luck.

            No, unfortunately I can't get user parameters working either. Zabbix does not seem to support RHEL as well as say Debian or Ubuntu

            Comment

            • geno
              Junior Member
              • Nov 2008
              • 29

              #7
              i find the very hard to beleive

              this is my conf:

              -------start-----

              # This is config file for zabbix_agentd
              # To get more information about ZABBIX, go http://www.zabbix.com

              ############ GENERAL PARAMETERS #################

              # List of comma delimited IP addresses (or hostnames) of ZABBIX servers.
              # No spaces allowed. First entry is used for sending active checks.
              # Note that hostnames must resolve hostname->IP address and
              # IP address->hostname.

              Server=172.1.1.1

              # Server port for sending active checks

              #ServerPort=10051

              # Unique hostname. Required for active checks.

              Hostname=serverdnsname

              # Listen port. Default is 10050

              #ListenPort=10050

              # IP address to bind agent
              # If missing, bind to all available IPs

              #ListenIP=

              # Source IP address for outgouing connections
              SourceIP=172.1.1.2

              # Number of pre-forked instances of zabbix_agentd.
              # Default value is 5
              # This parameter must be between 1 and 16

              StartAgents=5

              # How often refresh list of active checks. 2 minutes by default.

              #RefreshActiveChecks=120

              # Disable active checks. The agent will work in passive mode listening server.

              DisableActive=1

              # Enable remote commands for ZABBIX agent. By default remote commands disabled.

              EnableRemoteCommands=1

              # Specifies debug level
              # 0 - debug is not created
              # 1 - critical information
              # 2 - error information
              # 3 - warnings (default)
              # 4 - for debugging (produces lots of information)

              DebugLevel=4

              # Name of PID file

              PidFile=/tmp/zabbix/zabbix_agentd.pid

              # Name of log file.
              # If not set, syslog will be used

              LogFile=/tmp/zabbix/zabbix_agentd.log

              # Maximum size of log file in MB. Set to 0 to disable automatic log rotation.
              LogFileSize=10

              # Spend no more than Timeout seconds on processing
              # Must be between 1 and 30

              Timeout=30

              ####### USER-DEFINED MONITORED PARAMETERS #######
              # Format: UserParameter=<key>,<shell command>
              # Note that shell command must not return empty string or EOL only
              UserParameter=system.test,who|wc -l
              UserParameter=myps[*],ps aux | grep $1

              -------end --------

              and then i configure an items with these keys:

              system.test
              myps[konsole]

              make sure that you configure the return type correct, if you get it wrong there will be an error message on the items screen next to your configured item.

              maybe post your conf and screen-shots of your item configuration?

              Comment

              • linuxdan
                Junior Member
                • Sep 2008
                • 18

                #8
                User parameters are starting to work!

                Hello Geno

                Thank you for continuing to respond to me. You have helped me through a tough spot. I have recently updated from 1.6.1 to 1.6.2 your inquiry has caused me to re-evaluate the status of user parameters with my system. I could not get them working for the life of me on 1.6.1 but with 1.6.2 I'm having much better luck.

                Looks like it was an issue with the version of 1.6.1 that I grabbed shortly after the release announcement. That will teach me to be an early adopter :-p

                I also noticed that when creating the items one must be careful to select 'ZABBIX agent' from the drop-down list under 'Type' guess that teaches me not to mess with Defaults :-P


                Thanks for all your help,


                Dan

                Comment

                • linuxdan
                  Junior Member
                  • Sep 2008
                  • 18

                  #9
                  Still having issues with macros.

                  I've got the user parameter 'ps.fax' working now but I'm still having an issue getting it into messages that get send with Actions. When I send:
                  Code:
                  Too many processes are running on {HOSTNAME} here is a list of processes:
                  {{HOSTNAME}:ps.fax.LASTVALUE}
                  I get an email with the folowing:
                  Code:
                  Too many processes are running on example.com here is a list of processes:
                  {example.com:ps.fax.LASTVALUE}
                  Any ideas?

                  Comment

                  • geno
                    Junior Member
                    • Nov 2008
                    • 29

                    #10
                    no problem.

                    You must understand that when that message is put together zabbix already knows it is for ps.fax

                    So you want to ask it to put in {ITEM.LASTVALUE} (hope I got it right from memory, just double check the manual)

                    Comment

                    Working...