Ad Widget

Collapse

Custom UserParameters in triggers?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kbcetn
    Junior Member
    • Sep 2023
    • 17

    #1

    Custom UserParameters in triggers?

    I have got to be doing something silly somewhere. I have these UserParameters on all my MySQL agents:

    Code:
    UserParameter=mysql.replication.slave_io_status[*],mysql --defaults-file=/var/lib/zabbix/.my.cnf -e 'show slave status\G' | grep 'Slave_IO_Running:' | sed -e 's/Yes/1/' -e 's/No/0/' | cut -d: -f2- | cut -d' ' -f2-
    UserParameter=mysql.replication.slave_sql_status[*],mysql --defaults-file=/var/lib/zabbix/.my.cnf -e 'show slave status\G' | grep 'Slave_SQL_Running:' | sed -e 's/Yes/1/' -e 's/No/0/' | cut -d: -f2- | cut -d' ' -f2-
    That works as expected.

    Code:
    zabbix_agentd -t mysql.replication.slave_io_status
    mysql.replication.slave_io_status [t|1]
    Good. Now, I'm trying to figure out how to make that work as a monitor. I've tried this expression in my new trigger...

    Code:
    last(/MySQL by Zabbix agent/mysql.replication.slave_sql_status["{$MYSQL.HOST}","{$MYSQL.PORT}"])=0
    ... to which I get ...

    Code:
    Incorrect item key "mysql.replication.slave_sql_status["{$MYSQL.HOST}","{$MYSQL.PORT}"]" provided for trigger expression on "MySQL by Zabbix agent".
    Please help me save a few hairs on my head on this one. :-)
  • kbcetn
    Junior Member
    • Sep 2023
    • 17

    #2
    https://www.zabbix.com/forum/zabbix-...rrect-item-key helped some, but now I'm getting errors trying to get the value (Get value from agent failed). :-/ As you can see above, I am getting values (second code block) from the command-line.
    Last edited by kbcetn; 06-03-2024, 20:16.

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #3
      Second code block only says, that agent "should" be able to get that info (testing item directly on agent). Do you actually have that item attached to the host also?

      Comment

      Working...