[ZBXNEXT-1375] Set maintenance when agent is switched off Created: 2012 Aug 24  Updated: 2016 Jun 16

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Agent (G)
Affects Version/s: None
Fix Version/s: None

Type: New Feature Request Priority: Trivial
Reporter: Alessandro De Maria Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: maintenance, notifications
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Hello,

I think if would be interesting to have a feature where the Agent sends a message back to the server when it is being switched off.
This could be captured the server and the host cold be forced into maintenance.

Does it make sense? This would allow us not to receive messages if a host is being powered off by a system administrator rather than going down on its own.
Obviously it should be able to select which hosts we want this feature to be enabled on, via a configuration parameter?

Regards
Alessandro



 Comments   
Comment by Oleksii Zagorskyi [ 2012 Aug 27 ]

I'd like to link here another issue which similar to this one in a similar aspect: the agent should report "something" to the server before the correct stop.
It's ZBXNEXT-444

Comment by Alessandro De Maria [ 2012 Dec 10 ]

Hello,
we keep being notified by hosts going down because sysadmin are restarting them.
I opened this ticket to be able to stop notification when the agent is turned off.

I solved the problem by changing the init scripts (RedHat Only for now) to SEND a message through zabbix_sender.

This way we can use the value to make the trigger go off only when the server is genuinely down and not then people are working on it.

# functions
start() {
        if [ $RUNNING -eq 1 ]
                then
                echo "$0 $ARG: $BINARY_NAME (pid $PID) already running"
        else
                action $"Starting $BINARY_NAME: " $FULLPATH

                [ ${ENABLE_SENDER} -ne 0 ] && $SENDER -z ${ZABBIX_SERVER} -p ${ZABBIX_PORT} -k ${KEY} -s ${HOSTNAME} -o ${STARTED} >/dev/null
                touch /var/lock/subsys/$BINARY_NAME
        fi
}

stop() {
        echo -n $"Shutting down $BINARY_NAME: "
        killproc $BINARY_NAME
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ]
            then
                [ ${ENABLE_SENDER} -ne 0 ] && $SENDER -z ${ZABBIX_SERVER} -p ${ZABBIX_PORT} -k ${KEY} -s ${HOSTNAME} -o ${STOPPED} >/dev/null
                rm -f /var/lock/subsys/$BINARY_NAME
        fi
        RUNNING=0
}

Will post soon my solution to the forum.

The current solution sends a message from the init script, but something slighlty more elegant might be to have a "post_start" and "before_stop" directory where you can drop in scripts. This way you can easily create other useful scripts using the API that can be used to do all sort of magic.

Comment by Marc [ 2013 Apr 16 ]

What about having a new status like 'Zabbix-Agent status' for action conditions and filters, similar to 'Maintenance status'?
That way one could use for example an action condition 'Zabbix-Agent status not "stopped"'...

Comment by Oleksii Zagorskyi [ 2016 Jun 16 ]

See also ZBXNEXT-1514 and http://zabbix.org/wiki/Docs/simplify_ad_hoc_maintenance

Generated at Fri Apr 19 09:14:31 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.